Back to the main page.

Bug 590 - wltconvol gives weird results in lower frequencies

Status CLOSED FIXED
Reported 2011-04-19 11:09:00 +0200
Modified 2011-05-05 21:24:27 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Eelke Spaak - 2011-04-19 11:09:57 +0200

Just try and run the last part of the time-frequency tutorial (http://fieldtrip.fcdonders.nl/tutorial/timefrequencyanalysis#morlet_wavelets). Strangely, everything looks fine if you specify cfg.keeptrials='yes' (discovered by two Toolkit participants). Enjoy fixing this while strolling through NYC :)


Jan-Mathijs Schoffelen - 2011-04-19 11:27:38 +0200

*** Bug 583 has been marked as a duplicate of this bug. ***


Roemer van der Meij - 2011-04-20 19:32:34 +0200

I took me a while, but I tracked down the cause of the error. In case of keeprpt = 1, NaNs were not being set when the powspctrcm variables were being filled. I.e. code like "powspctrm(:,ifoi,~acttboi) = NaN;" was commented out (line 615, 619 and 623, current version). This resulted in all low frequency stuff that did not fit into to the time-window to be 0, instead of a NaN. This is only the case for keeprpt == 1, in the other cases the relevant lines are not commented out. I tracked down this change to one you made, JM, on March the 16th: http://code.google.com/p/fieldtrip/source/detail?r=3117&path=/trunk/ft_freqanalysis.m Your svn-log says: "fixed bug related to variable length trials in combination with keeptrials = 'no', leading to the sum over trials not being correctly normalised. introduced option to suppress feedback to screen for mtmfft and mtmconvol methods" Do you remember why you commented the NaN lines out? At the moment I have NOT fixed the bug, I wanted to check with you first.


Jan-Mathijs Schoffelen - 2011-04-22 09:17:43 +0200

I will look at it once I have time. I had a clear motivation for this at the time, but I have to think it over. Who want to use 'wavelet' anyway ;o)


Roemer van der Meij - 2011-04-22 17:52:38 +0200

Totally! It looks like you made a special nan-handling down below if cfg.method = mtmconvol, which inserts nans in the appropriate fields. (and since this code is only executed in case of mtmconvol, wavelet breaks down). I assume this is directly related to changing the way mtmconvol give it's output spectrum, being chan_time_freqtap? And somehow something goes wrong with the acttboi variable used to insert nans the old way? You also do something there with a new trial-count?. A simple fix for the issue, not knowing why the trial-count stuff is necessary, would be to remove the nan-handling from your specific mtmconvol code? As it looks like the main purpose of the code is to do the trial-count stuff?


Jan-Mathijs Schoffelen - 2011-04-26 10:36:34 +0200

Guys, I fixed the issue. Could one of you check whether the problem persists by running part of the tutorial code? (I could not reproduce the problem to begin with). @Roemer: my changes are essential to ensure correct behaviour when the input contains variable length trials. If it is done in the original way, normalization is incorrect/a too constrained section of the TFR will be outputted (outputting only those time bin for which all trials contain data).


Eelke Spaak - 2011-04-26 10:51:51 +0200

Verified: tutorial code yields correct results again.


Robert Oostenveld - 2011-05-05 21:24:27 +0200

bulk action: closed all bugs with status "resolved/fixed"