mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.66k stars 1.31k forks source link

add skip_by_annotation to notch_filter and resample #10447

Open jasmainak opened 2 years ago

jasmainak commented 2 years ago

We have TMS-EEG data at MGH for which we're trying to figure what is the best processing pipeline. The TMS pulses are recorded as triggers, so we can create annotations of 10 ms around those triggers and use that to exclude from operations such as ICA and raw.filter. This seems to work well but we noticed that skip_by_annotation is not supported in notch_filter and resample. Would it make sense to add these functionality to these functions as well? It would also make the API more consistent.

larsoner commented 2 years ago

Agreed this would be useful!

jasmainak commented 1 year ago

Thinking about this more, if resample function was to have skip_by_annotation, how is the "skipped" segment to be handled? Would there still be decimation but no filter since MNE-Python only supports a single sampling frequency ...

larsoner commented 1 year ago

how is the "skipped" segment to be handled? Would there still be decimation but no filter since MNE-Python only supports a single sampling frequency ...

Yes there would be no need, it would just get subsampled somehow. An upfirdn (with no filter / a delta) could do it as you suggest