pythonpython-3.xsignal-processingobspy

how to set the order of zero-phase bandpass filter in obspy


I have a question about setting the order of zero-phase bandpass filter in obspy.

I want to apply a 2nd order zero-phase filter, with corner frequencies of 0.05Hz and 0.1Hz.

I think it's right to type 'st.filter('bandpass', freqmin=0.05, freqmax=0.1, corners=2, zerophase=True)'.

However, I am a little bit confused since it is written that setting 'zerophase=True' results in twice the filter order according to the link below.

https://docs.obspy.org/_modules/obspy/signal/filter.html

So I want to ask if it is correct to set 'corners=2' or 'corners=1' or etc in my case.

It will be a great help to me if anyone gives an answer.

Thank you.


Solution

  • You should specify corners = 1.

    The way a zero-phase filter is implemented is to run the data through the filter twice, once forwards and once backwards. This results in double the magnitude response but cancels out the phase response. Therefore, if you expect 12 dB/octave attenuation in the stopbands, as in a normal 2nd-order filter, then specify corners = 1. This will result in 6 dB/octave attenuation on the forward pass, then another 6 dB/octave on the backwards pass.