Back to the main page.
Bug 1976 - Inverse solution with one time point and one trial fails
Status | CLOSED FIXED |
Reported | 2013-02-06 19:07:00 +0100 |
Modified | 2014-02-24 10:56:34 +0100 |
Product: | FieldTrip |
Component: | inverse |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P3 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
- 2013-02-06 19:07:50 +0100
if you put only one time point and one trial into ft_sourceanalysis avg has a wrong dimension and generates an error in function computing inverse problem, see attached file
- 2013-02-06 19:08:17 +0100
Created attachment 421 bug example
- 2013-02-07 10:44:52 +0100
consider line 807 and 882 from ft_sourceanalysis: 807: avg = reshape(avg, [1 Nchans Nsamples]); 882: dip(i) = minimumnormestimate(grid, sens, vol, squeeze(avg(i,:,:)), optarg{:}); and following MATLAB feature: >> Nchans = 21; Nsamples = 1; A = zeros(Nchans,Nsamples); A = reshape(A,[1 Nchans Nsamples]); size(squeeze(A(1,:,:))) ans = 1 21 >> Nchans = 21; Nsamples = 2; A = zeros(Nchans,Nsamples); A = reshape(A,[1 Nchans Nsamples]); size(squeeze(A(1,:,:))) ans = 21 2 it generated an error in line 211 of minimumnormestimate 211: mom = w * dat; same occurs for another inverse solution methods
Johanna - 2013-02-07 12:27:18 +0100
Hi Pawel, Thanks for spotting this, and including the useful example test file. It is a silly Matlab feature. For now, I will make this patch in the MNE section of ft_sourceanalysis (as of SVN version 7450): if size(avg,3)==1 squeeze_avg = avg(i,:)'; else squeeze_avg = squeeze(avg(i,:,:)); end if hascovariance dip(i) = minimumnormestimate(grid, sens, vol, squeeze_avg, optarg{:}, 'noisecov', squeeze(Cy(i,:,:))); else dip(i) = minimumnormestimate(grid, sens, vol, squeeze_avg, optarg{:}); end Then your test script runs fine. However, I wonder which other methods within ft_sourceanalysis this may apply to. Note, some methods won't like only 1 time point, but it's ok for MNE, so I don't think it's as simple as adding these lines for all methods. I will add more later about that.
- 2013-02-07 12:56:19 +0100
this bug applies to lcmv too
Johanna - 2013-02-21 15:50:17 +0100
I have updated it for all timelock methods. Svn commit 7520. test function added svn commit 7521, based on your bug example attached to this bug. (this means a test of the code will run automatically if changes to ft_sourceanalysis are made in future) I consider this bug fixed, but please re-open if you are not satisfied.
Robert Oostenveld - 2013-09-25 16:24:45 +0200
Hi Johanna, the test script "test_bug1976" contains towards the end the following test_bug1049 cd /home/common/matlab/fieldtrip/test test_bug1298 cd /home/common/matlab/fieldtrip/test test_bug1563 cd /home/common/matlab/fieldtrip/test test_bug1599 cd /home/common/matlab/fieldtrip/test test_ft_sourceanalysis cd /home/common/matlab/fieldtrip/test test_ft_sourcemovie cd /home/common/matlab/fieldtrip/test test_ft_timelockanalysis_new cd /home/common/matlab/fieldtrip/test test_historical cd /home/common/matlab/fieldtrip/test test_testbug1563 cd /home/common/matlab/fieldtrip/test I suggest that those lines are removed and that we don't do tests twice. Right now one of the test scripts fails (due to a completely unrelated plotting error). Once test_bug1976 runs again to completion, I will disable these lines from your script. Ok?
Johanna - 2013-09-26 11:51:45 +0200
Hi Robert, yes that makes sense to not run the tests twice; thus fine with me to comment out those lines.
Robert Oostenveld - 2013-12-05 09:48:38 +0100
(In reply to comment #5) Johanna wrote "I consider this bug fixed, but please re-open if you are not satisfied." It seems to me that the bug has been resolved, but the present status is "REOPENED". I will close it once more as FIXED, if anyone objects please reopen and state why there is still a concern.