Designing IIR Filter with Steeper Attenuation

Dear MNE list,

Filtering-related question here. Using the mne-python default 4th-order BW
filter, I've noticed that even when lowpassing to 120 Hz, the cHPI
artifacts in my MEG data bleeds through substantially. This problem goes
away, however, if using FFT instead.

My group is worried that the FFT filter distorts the phase relationships
among/between the frequency bands in the MEG data. So two questions:

   1. Matti has said (in-person on Friday) that the FFT filter used in
   MNE-C will not disrupt phase relationships. Is this true of the FFT filter
   in mne-python/scipy?
   2. If the FFT filter might distort phase relationships, how can I design
   an IIR filter with a steeper attenuation using mne construct_iir_filter?

Best,
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151122/af9cf65f/attachment.html

Hi Sam,
    The quantity that directly trades-off with how sharp a filter is not
its phase response but the length of the filter in time (i.e., how
many seconds its impulse response is significantly non-zero for and
for IIR how large the filter order is) which translates to how far
from the start (and/or end if time-reversed filtering is done) of your
input signal do you get edge artifacts for. As one might guess,
sharper filters (and filters with cutoff frequencies that are low
numbers) will need to be longer in time.
Another quantity that tends to somewhat trade-off with filter sharpness if
you also try to restrict its time length is filter ripple (i.e., how
non-flat the gain is in the pass band).

Now with the above in mind, to answer your questions:
(1) The "FFT" option in mne-python effectively accomplishes FIR filtering
both forward and backward in time making the phase response zero..so as in
the compiled version of MNE, you wouldn't get any group delays with the
python version either.

(2) If you want to use the IIR option, which I think ignores the
trans_bandwidth option (and hence may not be sharp enough to kill large
signals like the CHPI signals), you will have to increase the filter order
(default for BW is 4 which won't be too sharp). You could try specifying
an order of 10 or more by giving the iir_params[?order?] and
iir_params[?ftype?] as the input to construct_iir_filter(.). One thing
that you might see happen when you use too high an order for IIR filter is
that it could become unstable due to numerical errors. mne-python has a
check for that and will give you a runtime error when the filter is
applied.

Hari

Hari Bharadwaj
Research Fellow,
Martinos Center for Biomedical Imaging,
Massachusetts General Hospital
Charlestown, MA 02129

hari at nmr.mgh.harvard.edu
www.haribharadwaj.com
Ph: 734-883-5954

Dear MNE list,

Filtering-related question here. Using the mne-python default 4th-order

BW filter, I've noticed that even when lowpassing to 120 Hz, the cHPI
artifacts in my MEG data bleeds through substantially. This problem goes
away, however, if using FFT instead.

My group is worried that the FFT filter distorts the phase relationships

among/between the frequency bands in the MEG data. So two questions:

Matti has said (in-person on Friday) that the FFT filter used in MNE-C

will not disrupt phase relationships. Is this true of the FFT filter in
mne-python/scipy?

If the FFT filter might distort phase relationships, how can I design an

IIR filter with a steeper attenuation using mne construct_iir_filter?