Closed john-veillette closed 2 weeks ago
So a quick solution would be to change the offending line to
self.raw.pick_types(eeg=True, eog=False, meg=False, exclude=[])
so that manually marked bad channels are not unintentionally removed. But they should probably also be added to Reference.unusable_channels, so users have the ability to manually tell PREP to leave out certain channels (e.g. if they know the channel is broken in their hardware).
Thanks for the report, I'd be happy to receive a PR for this.
Great, I'll submit a pull request as a soon as I have time!
@john-veillette any news on your expected timeline for this?
Sorry @sappelhoff this slipped my mind, but I have time to work on it today so this week or next seems reasonable.
Okay, that didn't take long once I got to it. I've now opened PR #156 but some CI tests are failing.
Update: was just a formatting thing, fixed now!
Currently, PREP assumes you have no prior information about which channels are bad. This isn't necessarily a bad design choice if it's philosophically important that all bad channel identification be automatic, but currently it will result in an error if you have any channels marked as bad in
raw.info['bads']
before running PREP.The culprit re: the error is in
Reference.__init__
:Raw.pick_types
will not include bad channels in its output by default, and sinceReference
inheritsself.prep_params["ref_chs"] = self.ch_names_eeg
from thePrepPipeline
class that initializes it (where channels manually marked as bad haven't been removed yet), then theself.raw.get_data(picks=self.reference_channels)
inReference.robust_reference
will throw a missing value error.So a quick solution would be to change the offending line to
so that manually marked bad channels are not unintentionally removed. But they should probably also be added to
Reference.unusable_channels
, so users have the ability to manually tell PREP to leave out certain channels (e.g. if they know the channel is broken in their hardware).In the meantime, users can circumvent the problem by just setting
raw.info['bads'] = []
before running PREP. Hopefully that saves someone some trouble :)