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

design_fir crashes on data with high sampling rates #4

Open
arnodelorme opened this issue Dec 3, 2019 · 1 comment
Open

design_fir crashes on data with high sampling rates #4

arnodelorme opened this issue Dec 3, 2019 · 1 comment
Labels
wontfix This will not be worked on

Comments

@arnodelorme
Copy link
Contributor

Transfered from https://sccn.ucsd.edu/bugzilla/show_bug.cgi?id=12974

This bug involves the design_fir function which is called by the clean_channels function in the clean_rawdata toolbox

The design_fir function crashes on data with a high sampling rate (9600) but performs perfectly well with data with a lower sampling rate (9000).

line 89 of clean_channels:

B = design_fir(100,[2*[0 45 50]/signal.srate 1],[1 1 0 0]);

line 47 of design_fir:

F = interp1(round(F*nfft),A,(0:nfft),'pchip');

The original F ([2*[0 45 50]/signal.srate 1]) is multiplied by the nFFT (512) to produce [ 0 5 5 512] with a sampling rate of 9600, and [ 0 5 6 512] with a sampling rate of 9000. As griddedInterpolate needs unique numbers, the function crashes with the 9600 sr data.

If you increase the nFFT to 1024, then it becomes [ 0 10 11 1024] (round([2*[0 45 50]/9600 1]*1024)). However, it seems that the nFFT cannot be specified in clean_channels and is determined by the order of the filter, which is currently hardcoded into clean_channels (N=100).

Currently I only have a try and catch around it in clean_channels, where I specify the 'nfft':

try
    B = design_fir(100,[2*[0 45 50]/signal.srate 1],[1 1 0 0]);
catch
    B = design_fir(100,[2*[0 45 50]/signal.srate 1],[1 1 0 0],1024);
end

However, I dont know whether this is the best fix.

Regards,
Tyler

PS loving the toolbox

@arnodelorme
Copy link
Contributor Author

arnodelorme commented Feb 5, 2022

It is a good point. I do not have a solution. I will leave this open.

@arnodelorme arnodelorme added the wontfix This will not be worked on label Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant