Check the PTP threhsold argument, and converts it to dict if needed.
(ptp, name, info, picks)
| 195 | |
| 196 | |
| 197 | def _check_ptp(ptp, name, info, picks): |
| 198 | """Check the PTP threhsold argument, and converts it to dict if needed.""" |
| 199 | _validate_type(ptp, ("numeric", dict, None)) |
| 200 | |
| 201 | if ptp is not None and not isinstance(ptp, dict): |
| 202 | if ptp < 0: |
| 203 | raise ValueError( |
| 204 | f"Argument '{name}' should define a positive threshold. " |
| 205 | f"Provided: '{ptp}'." |
| 206 | ) |
| 207 | ch_types = set(info.get_channel_types(picks)) |
| 208 | ptp = {ch_type: ptp for ch_type in ch_types} |
| 209 | elif isinstance(ptp, dict): |
| 210 | for key, value in ptp.items(): |
| 211 | if value < 0: |
| 212 | raise ValueError( |
| 213 | f"Argument '{name}' should define positive thresholds. " |
| 214 | f"Provided for channel type '{key}': '{value}'." |
| 215 | ) |
| 216 | return ptp |
| 217 | |
| 218 | |
| 219 | def _check_bad_percent(bad_percent): |
no test coverage detected