-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
implement channel specific epoch rejection #12219
base: main
Are you sure you want to change the base?
implement channel specific epoch rejection #12219
Conversation
for more information, see https://pre-commit.ci
…o/mne-python into channel_specific_epoch_rejection
…o/mne-python into channel_specific_epoch_rejection
apart from the main functionality and some test (tbd), we would probably also want some kind of record that this was done. any good idea? |
btw, i dont know about the state of the PR but for me this code doesnt work so far.. |
Co-authored-by: Dominik Welke <[email protected]>
Update: the code works after implementing a preload_check. TBD: do we want channel specific epoch rejection, meaning we kick out epoch outliers based on the channel specific standard deviation OR do we calculate the standard deviation over all channels to define outlier epochs? |
related to one of my previous comments: but this would be a deeper change, and basically a design decision. |
+1 for this question! |
Sorry it took me so long to look at this PR
This implementation is actually a bit more specific than I was expecting ("specific" in the sense that it bakes in the idea of using standard deviation to decide what to do). I was expecting @larsoner's idea (2) from here, as I tried to indicate in my subsequent comment:
In other words, I was thinking the implementation should be something like:
That way, the user's job is to somehow create the inputs to that new function (or the modified @larsoner was this more or less what you were expecting, or am I way off base here? |
Yes that sounds reasonable to me! |
7d17f89
to
9f0dfef
Compare
…o/mne-python into channel_specific_epoch_rejection
…o/mne-python into channel_specific_epoch_rejection
for more information, see https://pre-commit.ci
…o/mne-python into channel_specific_epoch_rejection
for more information, see https://pre-commit.ci
…o/mne-python into channel_specific_epoch_rejection
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I continued working on this and decided to include a method to the BaseEpochs class called set_bad_epochs_to_NaN(). I decided against adjusting interpolate_bads(), as this method is within the class InterpolationMixin, which allows for Raws and Evokeds and would create a conflict with epoch-based rejection. |
I'll be away for the next ~1.5 weeks, but I just wanted to note that another option would be to define a method of the same name for if some_custom_case_holds: # only relevant for Epochs
# insert new code here
return my_new_result
else:
return super().interpolate_bads(copy_the_relevant_input_params_here) I'm not sure if this actually will help / work / make it more efficient to implement than your proposed approach of writing a brand new function... but I wanted you to know it's an option, in case you want to work more on this PR before I have a chance to look in greater depth. |
hi @CarinaFo ill try to have a deeper look into it soon :) initially your new approach makes sense to me, as the method is really only intended for epochs, but I'm not deep enough in the codebase to judge potential caveats (other than the api change, which i guess is generally disliked). |
and if you didnt see it, i already flagged two minor things that i believe would break the doc built |
hi @CarinaFo
|
…o/mne-python into channel_specific_epoch_rejection
…o/mne-python into channel_specific_epoch_rejection
…ch_rejection DW initial revisions
another comment: currently the input defining bad epochs is quite sparse - a list of lists for all channels, and if a channel doesnt contain bad epochs it has to be an empty list.. another option would be a dictionary s.a. identification of epochs would still not happen/be based on sequence.. not optimal (bc other functions might kick epochs out and thereby change order) but its not easy to get around it. a |
#11705
implement a epochs method that allows for channel specific epoch rejection