nikk-nikaznan/SSVEP-Neural-Generative-Models

Data_prep.py scipy.signal.filtfilt throws an error

Opened this issue · 5 comments

Hi,

Thank you for uploading this code :)

When I try to run in EEG_Gen.py Data_prep.py line 23 throws this error:

The length of the input vector x must be at least padlen, which is 9.
File "C:\work\SSVEP-Neural-Generative-Models\src\Data_prep.py", line 23, in data_process
b, a, input_data[i, :, :], axis=0
File "C:\work\SSVEP-Neural-Generative-Models\src\Data_prep.py", line 55, in
data_class0 = data_process(data_class0)
File "C:\work\SSVEP-Neural-Generative-Models\src\EEG_Gen.py", line 1, in
import Data_prep

I managed to make it work by removing line 8: "input_data = input_data.swapaxes(1, 2)" but I honestly don't know if the data is valid or not.

@nikk-nikaznan Do you know why this happens?

Thank you in advance :)

Hi,

May I know which data you are using? The data shape should be [the batch size, the number of channels for the sensor used, the number of samples]. So the number of channels (axis 1) must be the same to the input channels for CNN. The reason for the 'line 8 : input_data = input_data.swapaxes(1, 2)' is to make sure the data is in the correct order.

Thank you

Thank you

I'm using the data from this repository. Namely: Sampledata\SampleData_class0.npy.
The shape of this np array is: (10, 1500, 2) (before being passed to the swapaxes function).

So if I understand correctly I should use the swapaxes function, although using it produces the above error.

I think I may have found the problem.

The samples files where changed in commit dac6a5c. Shapes of the input file where changed from (50, 2, 1500) to (10, 1500, 2). This means that line 8 can be omitted.

Note that this change influences the fft_plot function as it was created for the old format.

@nikk-nikaznan let me know if you would like me to create a pull request fixing this issue.

Hi there.

Thank you for spotting out the error. Yes please feel free to send the pull request on the corrected one.
And sorry for the mistake.

Sure :) I'll try to work on it in the following weeks.

Again, thank you for uploading this code.