Back to the main page.
Bug 3035 - ft_apply_montage incorrectly deals with channels containing NaNs
Status | CLOSED FIXED |
Reported | 2016-01-08 15:13:00 +0100 |
Modified | 2023-01-20 17:22:17 +0100 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P5 normal |
Assigned to: | Eelke Spaak |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Eelke Spaak - 2016-01-08 15:13:41 +0100
This was found by Freek. ft_componentanalysis was run on an EEG data set, using only the EEG channels. Additionally, the EEG data set contained some eye tracker channels (which were not used for the component analysis). These eye tracker channels had NaNs in them. After ft_rejectcomponent (using the extra 3rd input argument), the output data also contained NaNs, even though none of the EEG channels contained NaNs. As a check, I subselected only the EEG channels in the original data prior to ft_rejectcomponent. In this case, no NaNs were present in the output. This indicates a problem in ft_rejectcomponent (and/or ft_apply_montage) in selecting the appropriate channels from the data input based on comp.topolabel of the second input. I'm writing a test script and hope to be able to fix this.
Eelke Spaak - 2016-01-08 15:55:05 +0100
eelke@eelkebox:~/repos/fieldtrip/test$ svn commit test_bug3035.m Adding test_bug3035.m Transmitting file data . Committed revision 11045. I've copied the required test data (as loaded by the test script) to /home/common/matlab/fieldtrip/data/test/bug3035/bug.mat
Eelke Spaak - 2016-01-08 17:31:46 +0100
Fortunately the problem is less big than I previously thought; it's not a scrambling of channels. ft_apply_montage deals with channels not mentioned in the montage structure labels by concatenating an identity-matrix block to the montage.tra matrix before multiplication (or, alternatively, in case of keepunused='no', by concatenating an all-zeros block only to one edge of the matrix). This works fine when the data has no NaNs, since 0*x==0 and 1*x==1 for any real x, but when x is NaN, this does not hold.
Eelke Spaak - 2016-01-08 17:32:25 +0100
(In reply to Eelke Spaak from comment #2) > 1*x==1 1*x==x of course
Eelke Spaak - 2016-01-08 18:20:48 +0100
eelke@eelkebox:~/repos/fieldtrip$ svn commit test/test_bug3035.m forward/ft_apply_montage.m Sending forward/ft_apply_montage.m Sending test/test_bug3035.m Transmitting file data .. Committed revision 11046. I added an explicit check on NaNs, now throwing an error rather than just mixing them into the output.
Robert Oostenveld - 2019-08-10 12:32:45 +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.