Apparent error during bandpass processing

I have a 20-minute continuous EEG file (EEGlab .set format) that I have made a link to. I am experimenting with various pre-processing steps and tried a bandpass filter on the whole file (8-13 Hz). When I display the result, it looks like all I am getting is the latter half of the impulse response, which tapers to flat line on all channels.

I am puzzled.

-Jeff

Can you visualize your data properly before applying the filter?
Please post a screenshot.

Data displayed correctly. How do I share a screenshot?

Just copy and paste in the text box when you are writing a reply

Thanks, Raymundo - how civilized compared to most other forums I have used :slight_smile:
Below are relevant screenshots.
image
image


I am thinking that maybe I am not doing this right, perhaps not understanding how to use the file links?

I should mention that I repeated this today to generate the screenshots and noticed the other half of the filter kernel at the end of the supposed band-passed version, displayed on the final screenshot.

Looking at the resulting waveforms, it appears that the kernel was convolved with the signal once, but never shifted in time and summed. I also note the term "transient_bandpass" on the upper left and right of the last screenshot.

The ripples you see at the edges of the recording are edge effects from the filter. You data is probably too short (how long?) for the 60DB attenuation and the relatively narrow band of 8-13Hz. Try to relax the attenuation to 40dB, and/or indicate a transition band of 1Hz or more for instance, or use longer recordings, if possible. Your data is there, but the amplitude is much smaller than at the edges, hence it looks flat. Increase the gain of the visualization with the +/- icons.

The data is 20 minutes long. I understand your explanation. I was not expecting such a situation, as all other clinical and research EEG software I have used before take care of this type of "edge artifact" produced by using FIR filters so the user does not see it. What I learned many years ago in my signal processing class was to taper (cosine or otherwise) the ends of the signal to zero before convolving it with the filter kernel. After convolution you throw away the added tails created by the kernel at each end so the result is the same number of samples as the original signal. The new ends, of course, are not fully filtered, but at least you do not get the distortion as seen here. I would like to make a feature request for this modification.
Thanks for listening to my rant,
-Jeff

The filer transient seems to be only .5 s long, for a recording of 20 minutes ; is that a critical issue? If you relax the filter parameters as indicated above, you will shorten these transients further. As for signal mirroring or zero padding, this could help indeed, but it is not entirely accurate either because of minute discontinuities at the "'stitches" + not super practical for handling large files etc.