bioelectric-interfaces / nfb

Build experiments in real-time EEG-MEG paradigm.
https://bioelectric-interfaces.github.io/nfb/
32 stars 24 forks source link

ButterFilter defined on 1-d vectors not working #38

Open jnvandermeer opened 4 years ago

jnvandermeer commented 4 years ago

Dear Alex and Nikolai,

Something I came across when using your toolbox:

The ButterFilter, when you wish to use it for a 1-D signal (a numpy array with shape of (1, ), then you create it with f.e.: ButterFilter([1, None], sampling_freq, 1), with n_channels being the 1.

This now become a problem when you apply the filter on 1-D signals (such as are created after applying all of the Spatial Filtering). Since the 'zi' is defined with no.zeros(X, 1), which has a shape of f.e. (5, 1) and therefore scipy will itself spit out the "ValueError: object of too small depth for desired array".

One possible solution could be to np.squeeze it in line 92 of the filters.py in directory signal_processing. But perhaps there's something more elegant. Do you wish me to ask pull requests when I encounter things?