Applying notch_filter to epochs?

Hello,

Is it possible to apply the notch_filter to an epoch object (instead of a raw object)?
At the moment I am getting the following error:

#Epochs object
data_iti
Out[52]: 
<EpochsFIF |  296 events (all good), 0 - 1 sec, baseline off, ~139.2 MB, data loaded,
 'H1_A_idx': 36
 'H1_B_idx': 40
 'H2_A_idx': 37
 'H2_B_idx': 40
 'T1_A_idx': 35
 'T1_B_idx': 37
 'T2_A_idx': 36
 'T2_B_idx': 35>

#notch filter command
data_iti.notch_filter(range(1,5),
                               filter_length='auto',
                               phase='zero')

Traceback (most recent call last):
  File "/tmp/ipykernel_202029/677223996.py", line 1, in <module>
    data_iti.notch_filter(range(1,5),

AttributeError: 'EpochsFIF' object has no attribute 'notch_filter'

Thank you!

Ana P

Hello, there is currently “official” way to apply a notch filter to anything but raw data in MNE. In theory we could add this, but I’m wondering if this feature is maybe missing on purpose.

@larsoner, WDYT? Since notch filters are usually applied to frequencies in the “higher” frequency range (e.g., to remove line noise) the required filter length should commonly be rather short, hence it should be safe to have this feature, no? Also we don’t impose any limitations on the usable frequency ranges for our existing band-pass filters either….

1 Like

Hello,

@richard and @larsoner thank you for your replies.
For now I went back to the raw data and applied the notch filter there.
So I believe I worked around it…

Cheers!

Ana P

Great! Yes in principle I think we could add notch_filter support to Epochs and Evoked but users haven’t asked for it a lot yet