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 <dominik.welke@web.de>
|
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
…/CarinaFo/mne-python into channel_specific_epoch_rejection
…/CarinaFo/mne-python into channel_specific_epoch_rejection
…Ns and renamed test function
Implements channel-specific epoch rejection as suggested in PR #11705.
Use case: In ECoG recordings, an epoch may be corrupted for a single channel only, while remaining valid for other channels. The current MNE implementation rejects entire epochs across all channels, which is appropriate for EEG/MEG but overly restrictive for ECoG data.
This change enables channel-wise epoch rejection.
Important consideration: Channels may end up with substantially different numbers of retained epochs. This can introduce issues during source localization, where nave (number of averaged epochs, integer) is used to scale the noise covariance. Downstream handling of nave must therefore account for channel-specific epoch counts.
Current state of this PR:
ToDo:
Issues:
Alternatives:
Key hypothesis to test:
Channel-specific epoch rejection preserves more usable data without increasing localisation error.
ToDo:
-pairwise covariance instead of sample covariance if NaNs detected
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.cov.html
Update:
2 Options: