Bandpass filtering

Dear Francois

when I use bandpass filtering on my data, I can see that there is difference between the appearance of my filtered data and the data which is using the filter option on the record tab. it seems that the slope of the filter on the record tab is straighter.

am I right ? when I compute PSD for filtered data, still I can see frequencies lower than my high pass filter. shall I use a higher low cut for a better filtration?

Best
Shadi

Hi Shadi,

We are using the exact same filter for the online filters (visualization of the recordings) and the process “Pre-process > Band-pass filter”.
You can check this by placing a breakpoint at line 125 in file process_bandpass.m.

The difference is the time window that is used: in the offline filter, all the signal is filtered (and mirrored) at once, while in the online filter only the loaded window is filtered. This fast approach introduces important edge effects.

In the configuration of the band-pass filters, the cutoff frequency indicates at which frequency the filter starts to attenuate the signal. To avoid disruptions in time domain, we have to use a smooth transition before the frequencies that are completely removed (stop-band). See for instance this illustration:
http://beausievers.com/synth/synthbasics/#lowpasshighpass

Cheers,
Francois
(low-pass and high-pass are similar)

hello Francois

may I ask you the slope of bandpass filter you have used?
I have filtered my data in ASALab software with the slope of 24. (0.1 to 70 hz). when I open my data in brainstorm and use the view filter in this frequency range, frequency, I have less low frequency noises. is this related to the slope of two filters?
and what shall I do to decrease these noises? re filter by brainstorm at this range of frequencies?

wishes
Shadi

Hi Shadi,

I’m not sure what a slope of 24 means, there are many ways to define a frequency filter. If you filter your signals with the same parameters in different programs, you will never get the same results.
The bandpass filtering in Brainstorm is done in frequency domain (FFT-based), it is not the cleanest way of proceeding but it is very fast. You can find more information about the implementation directly in the code: brainstorm3/toolbox/math/bst_bandpass_fft.m

There are a few other filters implemented, but they all have issues (too slow, too memory-consuming, not clean enough in frequency domain). If you’re interested in testing and refining them, you can use the filter test bench I wrote a while ago: brainstorm3/toolbox/script/test_bandpass.m

I recommend you select the most practical approach for you: if you’re satisfied with the filtering in ASA, keep your recordings this way. If you prefer the filters in Brainstorm, do not filter them in ASA.
To evaluate correctly the result of the filtering, use the process “Frequency > Power spectrum density” as illustrated in the tutorials:
http://neuroimage.usc.edu/brainstorm/Tutorials/ArtifactsFilter

Note the visualization filters you are referring to are not the proper way of filtering your signals (see the WARNING). You should use the process “Pre-process > Band-pass filter”. For filtering below 0.1 Hz you need at least 10s of recordings before the filter starts to work correctly. So this makes sense only to apply this on your continuous recordings.

Cheers,
Francois