[Eeglablist] Cleanline and Basic FIR filter

Andreas Widmann widmann at uni-leipzig.de
Wed Sep 9 13:14:53 PDT 2015

Hi Eric,

> Thank you very much for your responses! I've been trying to adapt the function for windowed sinc FIR filter as you suggested with Kaiser as window type (Widmann et al. 2015):
> EEG = pop_firws(EEG, 'fcutoff', [1 70], 'ftype', 'bandpass', 'wtype', 'kaiser', 'warg', 5.65326, 'forder', 1812, 'minphase', 0);
> However, I have some questions about the use:
> 1) Is this the best way to use a FIR filter?
Basically yes. In many to most situations in M/EEG analysis separate highpass and lowpass filters are to be preferred over bandpass as the lowpass part can be of considerably lower order this way. The forder parameter depends on sampling rate so I cannot comment on this.

> 2) Is there any way to estimate the "Kaiser window beta" ('warg') without using the GUI?
pop_kaiserbeta and

> 3) Is there a way to estimate the filter order ('forder') without using the GUI?
pop_firwsord work both on the command line.

> In addition to the last questions: 
> 4) What should the Max passband deviation be 0.001 or 0.0001?
This depends on your application. For my (mainly ERP) work passband deviation is much less relevant than corresponding stopband attenuation. For me .001 equivalent to -60 dB stopband attenuation is usually more than sufficient. By default I usually first try with .002 (-54 dB, Kaiser beta = 5; equivalent to Hamming window but somewhat more efficient/lower order).

> 5) What should the transition bandwith be? 3.6 or 5.0?
This completely depends on your application/intended frequency response. Sorry, no reasonable recommendation possible. For your bandpass from above, the maximal possible transition band width is 2 Hz (2 times the distance of the 1 Hz highpass half amplitude cutoff in the center of the transition band to DC). For a separate lowpass for ERPs I would personally always use a much shallower roll-off/wider transition band, here 10 to 30 Hz (see above)?

Hope this helps,

> Best,
> Eric
> On Wed, Sep 2, 2015 at 8:02 PM, Makoto Miyakoshi <mmiyakoshi at ucsd.edu> wrote:
> Dear Eric,
> > The only major difference is that you define passband edges in pop_eegfiltnew but half amplitude (-6 dB) cutoffs in the windowed sinc filter.
> For details, see below.
> https://cloud.github.com/downloads/widmann/firfilt/firfilt.pdf
> http://sccn.ucsd.edu/wiki/Firfilt_FAQ
> Makoto
> On Sun, Aug 30, 2015 at 11:20 AM, Andreas Widmann <widmann at uni-leipzig.de> wrote:
> Hi Eric,
> > I have some questions about both cleanline and the basic FIR filter:
> >
> > 1) Do you have any recommendation about which one should be used first? At the moment I'm doing this (cleanline first and then bandpass filtering):
> Highpass filtering should be done before cleanline. Cleanline expects stationary data. See Nima’s recent paper for a more detailed explanation (Bigdely-Shamlo N, Mullen T, Kothe C, Su K-M and Robbins KA (2015) The PREP pipeline: standardized preprocessing for large-scale EEG analysis. Front. Neuroinform. 9:16. doi: 10.3389/fninf.2015.0001). Consider the „temporary highpass“-solution suggested there in applications not requiring a highpass otherwise.
> > [EEG, Sorig, Sclean, f, amps, freqs, g] = pop_cleanline(EEG, 'Bandwidth',2,'ChanCompIndices',[1:EEG.nbchan], ...
> >                           'SignalType','Channels','ComputeSpectralPower',true,             ...
> >                           'LineFrequencies',[50 100] ,'NormalizeSpectrum',false,           ...
> >                           'LineAlpha',0.01,'PaddingFactor',2,'PlotFigures',false,          ...
> >                           'ScanForLines',true,'SmoothingFactor',100,'VerboseOutput',1,    ...
> >                           'SlidingWinLength',EEG.pnts/EEG.srate,'SlidingWinStep',EEG.pnts/EEG.srate);
> >
> > EEG = pop_eegfiltnew(EEG, 1, 70, 1650, 0, [], 1);
> >
> > 2) I'm doing the filtering before epoching the data (on continuous data). Can that lead to any problem with the filtering?
> Filtering should always be done on the continuous data!
> > In cleanline: Both the 'SlidingWinLength' and 'SlidingWinStep' are the length of the recording. However, the 'SmootingFactor is 100, which shouldn't matter when the window length = EEG length.
> >
> > 3) Is there an easy way to figure out the filter order for pop_eegfiltnew? The current 1650 is just what was decided through the GUI.
> Use the windowed sinc FIR filter to manually adjust the filter order. pop_eegfiltnew is just a front-end for the windowed sinc filter with hardcoded hamming window and a default heuristic for filter order as explained in the help text. The only major difference is that you define passband edges in pop_eegfiltnew but half amplitude (-6 dB) cutoffs in the windowed sinc filter.
> Hope this helps! Best,
> Andreas
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
> -- 
> Makoto Miyakoshi
> Swartz Center for Computational Neuroscience
> Institute for Neural Computation, University of California San Diego

More information about the eeglablist mailing list