FFT to extract psd features

External Email - Use Caution

Hi all,
I'm trying to use
https://github.com/pbashivan/EEGLearn/tree/master/Sample%20data to classify
my epoched data. Everything is all right but I'm still not able to extract
the frequency features to be like as mentioned the example:

FeatureMat_timeWin:
FFT power values extracted for three frequency bands (theta, alpha,
beta). Features are arranged in band and electrodes order (theta_1,
theta_2..., theta_64, alpha_1, alpha_2, ..., beta_64). There are seven
time windows, features for each time window are aggregated
sequentially (i.e. 0:191 --> time window 1, 192:383 --> time windw 2
and so on. Last column contains the class labels (load levels).

Each of my epochs have 250 frames. I want to have 10 time windows for each
epochs. I can add the las "labels" column. this is not a problem.
Since I have 32 electrodes, I get using (mne.time_frequency.psd_welch) a
tuple of (number of samples, 96). 96 corresponds to 3*32. 32 electrodes * 3
frequency bands. That's all right but I need it to be windowed. So instead
of having tuple of (number of samples, 93) I want to have a tuple of:
(number of samples, 96*number of time windows). I'm using the following
code:

def eeg_power_band(epochs):
   FREQ_BANDS = {"theta": [4.5, 8.5], "alpha": [8.5, 11.5], "beta": [15.5,
30]}
   epochs = epochs.load_data().pick_channels(EEG_CHANNELS).get_data()
   psds, freqs = mne.time_frequency.psd_welch(epochs, n_per_seg=10,
fmin=0.5, fmax=30.,n_fft=250, n_overlap=0)
    # Normalize the PSDs
    psds /= np.sum(psds, axis=-1, keepdims=True)

    X = []
    for _, (fmin, fmax) in FREQ_BANDS.items():
        psds_band = psds[:, :, (freqs >= fmin) & (freqs <
fmax)].mean(axis=-1)
        #X.append(psds_band.reshape(len(psds), -1))
        X.append(psds_band)

    return np.concatenate(X, axis=1)

Many Thanks for any help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190313/9de54e21/attachment.html