design_fir crashes on data with high sampling rates
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with clean_channels and design_fir, especially clean_channels line 89 and design_fir line 47. Reproduce the crash with a 9600 Hz sampling rate and compare it with 9000 Hz, then determine how nfft should be handled and verify that the filter design completes without the duplicate interpolation grid values.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- MATLAB
- Stars
- 55
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sccn/clean_rawdata
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
sccn/clean_rawdata#45 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
sccn/clean_rawdata#43 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
sccn/clean_rawdata#38 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
sccn/clean_rawdata#37 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
sccn/clean_rawdata#33 · 3 comments ·
All issues in sccn/clean_rawdata
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
VH-Lab/NDIcalc-vis-matlab#107 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
gnu-octave/statistics#498 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
HenrikBengtsson/R.matlab#59 · 3 comments ·
-
enhancement question unconfirmed
Difficulty 2/5 1-2 days Newbie friendliness 83/100