Back to the main page.

Bug 419 - singleplotTFR is not robust

Reported 2011-01-20 10:09:00 +0100
Modified 2011-07-13 14:46:37 +0200
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Jan-Mathijs Schoffelen - 2011-01-20 10:09:00 +0100

the underlying uimagesc seems to crash (due to rounding issues) if the input TFR has non evenly spaced tois (and there also seems to be an issue with the fois, which is not straightforward to reproduce). E.g. when creating a TFR from downsampled data (cfg.resamplefs = 256 in this case), and specifying the cfg like this cfg.foi = 2.5:2.5:30; cfg.t_ftimwin = ones(1,nfoi).*0.4; cfg.toi = -0.2:0.05:1 cfg.etc there are 2 issues: -the t_ftimwin will never exactly be 0.4, so the frequencies will be adjusted slightly -the toi can never be exactly the requested bins, because dt is not an integer number of samples the plotting should be made robust against this, or the user should be punished by specifying a problematic cfg for ft_freqanalysis, and ordered back to the drawing table.

Roemer van der Meij - 2011-01-20 10:25:03 +0100

Hmmm, another consequence of the more accurate foi that I didn't anticipate? I think the most robust way, but probably also the most difficult way, to fix this would be: * using imagesc instead of uimagesc * do not give in the exact axis as it is done now, but a placeholder axis (which is monotonously increasing) * 'manually' add the axis-labels and a automatically defined set of axis-ticks (by using set(gca,'Ytick',....,'yticklabel',...)) andsoforth. This would have one drawback though that I think cannot be avoided. If the axis labels are set by the plotting function itself, it will scale with the figure window. Meaning, if the window is enlarged, more ticks are added at the axis. This will never happen if the ticks are set manually... Oh, and that will of course also mean that the axis are not 'scaled linearly' by adding copies of time-bins/frequency-bins (what uimagesc does I think). Hmmm...

Robert Oostenveld - 2011-01-20 10:29:12 +0100

> * using imagesc instead of uimagesc uimagesc is required for logarithmic and otherwise irregular spaced (but nevertheless monotonic) foi and toi specifications.

Roemer van der Meij - 2011-03-18 01:17:43 +0100

Has this been discussed in the meetings the past weeks? I'm still curious how we would fix this. Strangely enough, aren't the new, more accurate, foi's still monotonically increasing? (which is what the error tells us if we want to plot new freqdata). Aren't we maybe just talking about a bug in uimagesc (just crossed my mind while commenting)?

Robert Oostenveld - 2011-07-13 14:46:37 +0200

changed the status for a whole bunch of resolved bugs to CLOSED