Skip to content

Commit

Permalink
Allow misc as an option to find bad segments.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgohil8 committed Feb 21, 2024
1 parent e111554 commit 3aa6a77
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions osl/preprocessing/osl_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ def detect_badsegments(
ref_meg : str
ref_meg argument to pass with :py:func:`mne.pick_types <mne.pick_types>`.
mode : str
Should be ``'diff'`` or ``None``. When ``mode='diff'`` we calculate a difference time
series before detecting bad segments.
Should be ``'diff'`` or ``None``. When ``mode='diff'`` we calculate a difference time series before detecting bad segments.
detect_zeros : bool
Should we detect segments of zeros based on the maxfilter files?
Expand All @@ -341,14 +340,12 @@ def detect_badsegments(
Notes
-----
Note that for Elekta/MEGIN data, we recommend using ``picks: 'mag'`` or ``picks: 'grad'``
separately (in no particular order).
Note that for Elekta/MEGIN data, we recommend using ``picks: 'mag'`` or ``picks: 'grad'`` separately (in no particular order).
Note that with CTF data, mne.pick_types will return:
~274 axial grads (as magnetometers) if ``{picks: 'mag', ref_meg: False}``
~28 reference axial grads if ``{picks: 'grad'}``. Thus, it is recommended to
use ``picks:'mag'`` in combination with ``ref_mag: False``, and ``picks:'grad'`` separately (in no particular order).
~28 reference axial grads if ``{picks: 'grad'}``.
Thus, it is recommended to use ``picks:'mag'`` in combination with ``ref_mag: False``, and ``picks:'grad'`` separately (in no particular order).
"""

gesd_args = {'alpha': significance_level}
Expand All @@ -365,6 +362,8 @@ def detect_badsegments(
chinds = mne.pick_types(raw.info, ecg=True, ref_meg=ref_meg, exclude='bads')
elif picks == "emg":
chinds = mne.pick_types(raw.info, emg=True, ref_meg=ref_meg, exclude='bads')
elif picks == "misc":
chinds = mne.pick_type(raw.info, misc=True, exclude='bads')
else:
raise NotImplementedError(f"picks={picks} not available.")

Expand Down Expand Up @@ -459,13 +458,12 @@ def detect_badchannels(raw, picks, ref_meg="auto", significance_level=0.05):
Notes
-----
Note that for Elekta/MEGIN data, we recommend using ``picks:'mag'`` or ``picks:'grad'``
separately (in no particular order).
Note that for Elekta/MEGIN data, we recommend using ``picks:'mag'`` or ``picks:'grad'`` separately (in no particular order).
Note that with CTF data, mne.pick_types will return:
~274 axial grads (as magnetometers) if ``{picks: 'mag', ref_meg: False}``
~28 reference axial grads if ``{picks: 'grad'}``. Thus, it is recommended to
use ``picks:'mag'`` in combination with ``ref_mag: False``, and ``picks:'grad'`` separately (in no particular order).
~28 reference axial grads if ``{picks: 'grad'}``.
Thus, it is recommended to use ``picks:'mag'`` in combination with ``ref_mag: False``, and ``picks:'grad'`` separately (in no particular order).
"""

gesd_args = {'alpha': significance_level}
Expand All @@ -480,6 +478,8 @@ def detect_badchannels(raw, picks, ref_meg="auto", significance_level=0.05):
chinds = mne.pick_types(raw.info, eog=True, ref_meg=ref_meg, exclude='bads')
elif picks == "ecg":
chinds = mne.pick_types(raw.info, ecg=True, ref_meg=ref_meg, exclude='bads')
elif picks == "misc":
chinds = mne.pick_type(raw.info, misc=True, exclude='bads')
else:
raise NotImplementedError(f"picks={picks} not available.")
ch_names = np.array(raw.ch_names)[chinds]
Expand Down

0 comments on commit 3aa6a77

Please sign in to comment.