-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add channels in raw.info['bads'] to unusable channels in Reference class #146
Comments
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! |
… bad, closes #146 (#156) * allows manually marked bad channels to be excluded from reference / interpolated, without being removed (which had been causing an error) * adds new contributor to CITATION.cff * adds new contributor ORCID * Update authors.rst * Update changelog.rst * fixes some formatting issues flagged by CI * adds manual bad channels to find_noisy_channels * changes name of manual bads to match find_noisy_channels (which requires a specific format to work properly) * adds test coverage * fixes bug and formatting in test * format
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 :)The text was updated successfully, but these errors were encountered: