You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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':
However, I dont know whether this is the best fix.
Regards,
Tyler
PS loving the toolbox
The text was updated successfully, but these errors were encountered: