Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data_prep.py scipy.signal.filtfilt throws an error #3

Open
Rane90 opened this issue Jul 12, 2022 · 5 comments
Open

Data_prep.py scipy.signal.filtfilt throws an error #3

Rane90 opened this issue Jul 12, 2022 · 5 comments

Comments

@Rane90
Copy link

Rane90 commented Jul 12, 2022

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 :)

@nikk-nikaznan
Copy link
Owner

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

@Rane90
Copy link
Author

Rane90 commented Jul 12, 2022

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.

@Rane90
Copy link
Author

Rane90 commented Jul 12, 2022

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.

@nikk-nikaznan
Copy link
Owner

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.

@Rane90
Copy link
Author

Rane90 commented Jul 13, 2022

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

Again, thank you for uploading this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants