I am trying to calculate the Welch power spectral density over specific frequency bands for EEG signal processing ($\delta$ (0–4 Hz), $\theta$ (4–8 Hz), $\alpha$ (8–13 Hz), $\beta$ (13–30 Hz), $\gamma_1$ (30–60 Hz), and $\gamma_2$ (60–90 Hz)). I thought I could accomplish this by passing an array of integers with the desired frequency bins to the 'window' parameter, but this doesn't quite work as expected. Unfortunately this particular use case of the parameter is not well documented, so I'm having a hard time understanding how I can alter my code to at least get close to the abovementioned bins.
Currently, I am doing the following:
bands = [0,4,8,13,30,60,90]
frequency_bins, psd = welch(sample, fs=256, window=bands)
However, frequency_bins==[0, 36.57142857, 73.14285714, 109.71428571]
. Can anyone explain what the window
parameter is accomplishing in this case, and if it is possible to somehow make the frequency_bins
output equal to bands
?
I think this code may help you.