PIA-Group / BioSPPy

Biosignal Processing in Python
Other
577 stars 273 forks source link

what is nch in eeg.py ? #77

Closed myagmur01 closed 3 years ago

myagmur01 commented 3 years ago

Hi ,

could you explain what is nch in eeg.py?
I have a single signal with a shape of (3000, 1) . When I input it to get plf plot, it throws an error as below:

    233     # ensure numpy
    234     signal = np.array(signal)
--> 235     nch = signal.shape[1]
    236 
    237     sampling_rate = float(sampling_rate)

IndexError: tuple index out of range
anascacais commented 3 years ago

Hi,

nch is the number of channels in your signal and as such it should correspond to the number of columns in your signal (i.e. signal.shape[1]).

I managed to reproduce that issue if signal was either a list or a numpy array with shape (3000,). Please try to reshape your signal before using it as input to eeg(), that should do the trick: signal = np.reshape(np.array(signal), (-1,1))

afonsocraposo commented 3 years ago

Closing this due to no further responses. Feel free to comment if something is unclear.