MCPcopy
hub / github.com/mne-tools/mne-python / _check_ptp

Function _check_ptp

mne/preprocessing/_annotate_amplitude.py:197–216  ·  view source on GitHub ↗

Check the PTP threhsold argument, and converts it to dict if needed.

(ptp, name, info, picks)

Source from the content-addressed store, hash-verified

195
196
197def _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
219def _check_bad_percent(bad_percent):

Callers 1

annotate_amplitudeFunction · 0.85

Calls 3

_validate_typeFunction · 0.85
setFunction · 0.85
get_channel_typesMethod · 0.80

Tested by

no test coverage detected