How to Combine Multiple Channels of EEG signals into one Channel EEG Signal?

** Hello Everyone,

I am new in this domain. I am working on this dataset: OpenNeuro

I want to convert the EEG signal into a Continuous Wavelet Transform (CWT) form.

Now I am facing some issues. Actually, an EEG signal consists of 120 channels, So the shape of the EEG is (num_of_channel,length_of_the_signal) If I give it to the cwt it returns the shape in this form (num_of_channels, scaling, length of the signal).

I want a signal to combine all the channels into 1 signal, and when I give it to cwt it will return this shape (scaling, length_of_the_signal), Not (num_of_channels, scaling, length_of_the_signal). How can I do this? Please guide me I am struggling a lot.

I am using the cwt library pywt (PyWavelets - Wavelet Transforms in Python — PyWavelets Documentation)

Thanks in advance.

Hi @Sameer-Ahmed7 , have you considered simply averaging across the channels before passing the data to pyWavelets? Something like

# assuming your EEG data is stored in a Numpy array
eeg_data_avg = eeg_data.mean(0)

No I didn’t but it will work? Actually I want to give this data to the cnn model after the processing. It will not damage the information of the whole channels?

It will work technically but whether it’s valid for your data and/or research question is harder to answer… That being said I’ve never averaged all my channels into 1 signal, In my experience working with scalp level EEG electrodes, I usually do something like this:

  1. Identify bad channels, and reject them or interpolate them: see this tutorial
  2. identify and select a subset of EEG channels that you are interested in, for example electrodes over the occipital cortex. See mne.raw.pick. Hopefully after step 1, you can be confident that there are no noisy channels in this subset.
  3. Now your data will have a shape (n_selected_channesl, n_samples). Next, compute a metric of interest (in your case this PyWavelets function)
  4. average across the channels dimension (this way you are averaging across a subset of channels instead of the entire EEG net).

Maybe you can verify that this approach is valid for your metric of interest, but I think this is a fairly common approach in EEG analyses.

1 Like

Thank you so much for the steps. Will you give more information about how to do 4th step?

Since you said that this cwt function returns a Numpy array of shape (num_of_channels, scaling, length of the signal), I assume you can do my_cwt_array.mean(0). Though I’ve never worked with PyWavelets.

No, Basically If I give the whole EEG signal consisting of 120 channels data, which shape is (scaling, length_of_the_signal) to the cwt it will return this shape (num_of_channels, scaling, length of the signal).

But in my case, I am giving one channel at a time so it returns the shape (scaling, length of the signal) then this signal I convert into the image.

Looks Like that:
CWT_EEG_IMAGE

But I have to combine every channel so that we have only one image that gives the information of all channel’s data not one.

So that’s why I am not using my_cwt_array.mean(0) .

ah ok, does the function return the same shape for each channel? if so, I would put all of the arrays into a list, and pass that list of arrays to np.concatenate, to combine them. Then I would take the average as I described before.

Yes, it returns the same shape. Perfect, It works for me. Thank you so much.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.