Back to the main page.

Bug 1461 - clarity in ft_freqanalysis for fboi(lim) calculation

Status CLOSED FIXED
Reported 2012-05-08 14:37:00 +0200
Modified 2013-01-17 10:43:21 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: All
Operating System: All
Importance: P3 trivial
Assigned to: Roemer van der Meij
URL:
Tags:
Depends on:
Blocks:
See also:

Johanna - 2012-05-08 14:37:30 +0200

Lines 447 and 453 of the 20120501 version (FT toolkit 2012) are: fboilim = round(cfg.foilim ./ (data.fsample ./ (cfg.pad*data.fsample))) + 1; and fboi = round(cfg.foi ./ (data.fsample ./ (cfg.pad*data.fsample))) + 1; Why do both of these lines include data.fsample? For clarity and for equivalent computation output, can it not be this instead? fboilim = round(cfg.foilim .* cfg.pad) + 1; and fboi = round(cfg.foi .* cfg.pad) + 1;


Eelke Spaak - 2012-05-08 14:53:56 +0200

I support the change.


Jan-Mathijs Schoffelen - 2012-05-16 07:25:00 +0200

I suggest Johanna and Roemer team up to resolve this


Roemer van der Meij - 2012-05-16 10:37:44 +0200

Clever suggestion. Most likely it is copy paste from a specest function during the time I was working on code in freqanalysis, where the last bit used to say 'total number of samples', which I later replaced by cfg.pad*data.fsample, and I failed to see the easier way of computing the fois. I thought for a while that a downside of the change could be slight difference in fboi's when the cfg.pad is specified instead of calculated because of precision errors in data.fsample (which might not come from the original data in some cases I think, but is instead computed using time axis), but even in that case precision errors only become worse because of using data.fsample multiple times in the way the code is now. (and I doubt that even in weird exotic cases where data.fsample varies because of precision errors and variable length trials that there would be a shift in the fboi's) I have changed to specified lines as suggested, and added a comment to all specest functions for easy reference/documentation


Roemer van der Meij - 2013-01-17 10:43:21 +0100

bug closing time