Back to the main page.

Bug 2648 - ft_specest_mtmconvol with padding should allow estimates at edge time bins

Reported 2014-07-14 11:20:00 +0200
Modified 2019-08-10 12:29:37 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to:
Depends on:
See also:

Eelke Spaak - 2014-07-14 11:20:04 +0200

Currently, ft_specest_mtmconvol fills estimates with NaNs if their corresponding time bin if not fully 'filled' with data. I.e. if cfg.toi = 0:0.05:2 trial{k}.time = 0:1/fsample:2, and cfg.t_ftimwin = 0.5, then the first time point for which the estimate is non-NaN will be 0.25. Conceptually, it is possible to get estimates at earlier time points as well, by adding zero or edge padding. Even though one can specify cfg.pad, this is only applied to the data directly prior to fft-ing, thus it affects the spectral and not the temporal resolution. For short trials, it is desirable to artificially crank up the temporal resolution as well. This should be fairly easy to implement, e.g. by just applying the padding earlier in the code. Note that mirror padding is probably a very bad idea in this case, only zero or edge makes sense. Am I right in thinking that this would be nice to have? Or am I missing some obvious reason why this isn't in the code?

Jörn M. Horschig - 2014-07-14 11:32:29 +0200

well, I guess the reason for it not being there is that the output would be just plain wrong. On the other hand, the user should of course know this and not interpret the data in the beginning. And since we provide a toolbox, such a tool can be nice for data visualization... hmmm...maybe, if you add this, add a warning that the data at the edges should be interpreted?

Eelke Spaak - 2014-07-14 11:38:59 +0200

(In reply to Jörn M. Horschig from comment #1) Indeed the output would be "wrong", in the sense that padded data was used for certain estimates. But the exact same argument can be given for users requesting a 1 Hz-spaced frequency axis while their time window is 0.5s (= Rayleigh frequency 2 Hz), and no warning is given in that case either. Furthermore, with zero or edge padding, the resulting TFR (given true activity in the data) will show a ramp up/down at the edges away from/towards the true effect, so the wrongness would be "clean" (i.e. no artificial blobs will occur).

Eelke Spaak - 2014-08-06 12:16:01 +0200


Robert Oostenveld - 2019-08-10 12:29:37 +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 describing the issue on