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.
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:
Identify bad channels, and reject them or interpolate them: see this tutorial
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.
Now your data will have a shape (n_selected_channesl, n_samples). Next, compute a metric of interest (in your case this PyWavelets function)
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.
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:
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.