Back to the main page.
Bug 3216 - DFT filter is not applied for multiple harmonics, if different numbers samples are needed to fit the full cycle
Status | CLOSED FIXED |
Reported | 2016-12-09 16:03:00 +0100 |
Modified | 2019-08-10 12:41:25 +0200 |
Product: | FieldTrip |
Component: | preproc |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P5 normal |
Assigned to: | Sabine Leske |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Sabine Leske - 2016-12-09 16:03:20 +0100
Created attachment 819 Test script to demonstrate a case, when dft-filter doesn't work There is a bug in ft_preproc_dftfilter.m related to the (maybe rather unusual) case of data-lengths (and/or SR), where harmonics (of 50/60 Hz) need different numbers samples to apply the dft-filter. There is already a loop to deal with this case (line 76), that was introduced here: https://github.com/fieldtrip/fieldtrip/commit/5efa0c76108993fee44d1fef7d9c006151bd74ff But the filtering is not applied (only the last harmonic is removed), because the filtered data is overwritten with the original (unfiltered) data with each iteration in line 77: filt=dat; Probably the problem would be fixed, if this line is moved on top of the loop (e.g. to line 75)? This bugfix is included in the commits (pull request) related to bug2956, adding "spectrum interpolation" to the ft_preproc_dftfilter.
Jan-Mathijs Schoffelen - 2016-12-09 16:54:42 +0100
Great, thanks. I came across this as well a while ago, but did not follow up. Your suggested solution looks fine.
Jan-Mathijs Schoffelen - 2016-12-09 17:59:49 +0100
Since you already have provided a fix, I assign this one to you :o).
Sabine Leske - 2017-02-08 11:23:02 +0100
(In reply to Jan-Mathijs Schoffelen from comment #2) The Bug was fixed in the commits of: Bug2956 and dftfilter bugfix #272 Thank you for merging.
Robert Oostenveld - 2019-08-10 12:35:14 +0200
This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.