@@ -29,7 +29,8 @@ class NoisyChannels:
2929 Parameters
3030 ----------
3131 raw : mne.io.Raw
32- An MNE Raw object to check for bad EEG channels.
32+ An MNE Raw object to check for bad EEG channels. Channels set to bad
33+ in ``raw.info["bads"]`` will not be used to find additional bad channels.
3334 do_detrend : bool, optional
3435 Whether or not low-frequency (<1.0 Hz) trends should be removed from the
3536 EEG signal prior to bad channel detection. This should always be set to
@@ -49,6 +50,10 @@ class NoisyChannels:
4950 to other methods. RANSAC can detect bad channels that other
5051 methods are unable to catch, but also slows down noisy channel
5152 detection considerably. Defaults to ``True``.
53+ bad_by_manual : list of str
54+ List of channels that are bad. These channels will be excluded when
55+ trying to find additional bad channels. Note that the union of these channels
56+ and those declared in ``raw.info["bads"]`` will be used.
5257
5358 References
5459 ----------
@@ -66,13 +71,15 @@ def __init__(
6671 matlab_strict = False ,
6772 * ,
6873 ransac = True ,
74+ bad_by_manual = None ,
6975 ):
7076 # Make sure that we got an MNE object
7177 assert isinstance (raw , mne .io .BaseRaw )
7278
7379 raw .load_data ()
7480 self .raw_mne = raw .copy ()
75- self .bad_by_manual = raw .info ["bads" ]
81+ bad_by_manual = bad_by_manual if bad_by_manual else []
82+ self .bad_by_manual = list (set (bad_by_manual + raw .info ["bads" ]))
7683 self .raw_mne .pick ("eeg" ) # excludes bads
7784 self .sample_rate = raw .info ["sfreq" ]
7885 if do_detrend :
0 commit comments