1
$\begingroup$

I have an eeg signal with two channels (f3m2 and f4m1) which is divided into epochs. I want to augment the data by taking every 5th sample. I can re-use the discarded samples to create 5 versions of the data (take every 5th sample starting at sample 0, then take every 5th sample starting at sample 1, etc.). I have written my own code to downsample the data starting at sample 0, 1 etc. but I know that in order to avoid aliasing I need to first apply a low pass filter.

How do I decide what filter to use (FIR, IRR, etc.)? How do I decide which cutoff frequency to use? How would I implement this?

My code is in python and I have been considering using the scipy.signal library (but am open to any python libraries).

$\endgroup$
1
  • $\begingroup$ "I can re-use the discarded samples to create 5 versions of the data" Why? After filtering and downsampling, won't those all contain exactly the same information? $\endgroup$
    – endolith
    Feb 12 '21 at 1:39
1
$\begingroup$

Anti-aliasing filtering is applied just as any other LTI filtering: If your input data is $x[n]$, and the impulse response is $h[n]$, then your output will be

$$y[n] = x[n] \star h[n] $$

where $\star$ is the convolution operation, a.k.a. the anti-aliasing filtering in this context.

Your impulse response $h[n]$, ideally, corresponds to a lowpass brickwall filter, with a cutoff frequency of $$ \omega_c = \frac{\pi}{M} $$ radians per sample, where $M=5$ is the downsampling ratio in your particular application. You may design $h[n]$ by any suitable method, but for maintaining high accuracy, you better use tight specs on the desiged filter, this can be achieved by a sufficiently long FIR linear-phase filter, or similar IIR filter. The latter will be more efficient to implement but less accurate due to its nonlinear phase.

Then you can decimate $y[n]$ by $M$ as $$v[n]= y[Mn]$$ to get the downsampled sequence.

$\endgroup$
0
$\begingroup$

If you're using scipy.signal and processing signals offline, then you can just use decimate which handles the filtering for you. It also does zero-phase filtering by default, which you probably want for an EEG signal to avoid shifting the shape of the waveforms? (I know that's desirable for EKG, not sure about EEG.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.