Back to the main page.

Bug 2078 - ft_singleplotTFR crashes with cfg.interactively='yes' and data cantains NaN

Status CLOSED INVALID
Reported 2013-03-26 11:19:00 +0100
Modified 2019-08-10 12:02:49 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Diego Lozano Soldevilla
URL:
Tags:
Depends on:
Blocks:
See also:

Diego Lozano Soldevilla - 2013-03-26 11:19:28 +0100

I was testing the time-frequency analysis using Hanning window, multitapers and wavelets when I tried to interactively select a time window of a TFR with NaN. - Here a piece of code to reproduce the error datadir = '/home/common/matlab/fieldtrip/data/ftp/tutorial/timefrequencyanalysis'; load([datadir,filesep,'dataFIC.mat']); cfg = []; cfg.output = 'pow'; cfg.channel = 'MRC15'; cfg.method = 'mtmconvol'; cfg.taper = 'hanning'; cfg.foi = 2:1:30; cfg.t_ftimwin = 7./cfg.foi; % 7 cycles per time window cfg.toi = -0.5:0.05:1.5; TFRhann7 = ft_freqanalysis(cfg, dataFIC); cfg = []; cfg.baseline = [-0.5 -0.1]; cfg.baselinetype = 'absolute'; cfg.maskstyle = 'saturation'; cfg.zlim = [-3e-27 3e-27]; cfg.channel = 'MRC15'; figure ft_singleplotTFR(cfg, TFRhann7); - Here the error: the input is freq data with 1 channels, 29 frequencybins and 41 timebins the call to "ft_freqbaseline" took 0 seconds and required the additional allocation of an estimated 0 MB the call to "ft_singleplotTFR" took 1 seconds and required the additional allocation of an estimated 0 MB selected cfg.xlim = [0.983333 1.250000] selected cfg.ylim = [15.279240 21.299708] creating layout from data.grad creating layout for ctf151 system the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB the input is freq data with 1 channels, 29 frequencybins and 41 timebins the call to "ft_freqbaseline" took 0 seconds and required the additional allocation of an estimated 0 MB Warning: Some points fall outside the outline, please consider using another layout > In ft_plot_topo at 171 In fieldtrip-dev/private/topoplot_common at 704 In ft_topoplotTFR at 191 In ft_singleplotTFR>select_topoplotTFR at 575 In ft_select_range>evalCallback at 325 In ft_select_range at 159 Error using builtin No tolerance can be NaN. Error in griddata>mergepoints2D (line 162) xyv = builtin('_mergesimpts', [y, x, v], [myepsy, myepsx, Inf], 'average'); Error in griddata>gdatav4 (line 289) [x, y, v] = mergepoints2D(x,y,v); Error in griddata (line 134) vq = gdatav4(x,y,v,xq,yq); Error in ft_plot_topo (line 218) [Xi,Yi,Zi] = griddata(chanX', chanY, dat, xi', yi, interpmethod); % interpolate the topographic data Error in topoplot_common (line 704) ft_plot_topo(chanX,chanY,datavector,'interpmethod',cfg.interpolation,... Error in ft_topoplotTFR (line 191) [cfg] = topoplot_common(cfg, varargin{:}); Error in ft_singleplotTFR>select_topoplotTFR (line 575) ft_topoplotTFR(cfg, varargin{:}); Error in ft_select_range>evalCallback (line 325) feval(funhandle, funargs{:}, val, cmenulab); Error in ft_select_range (line 159) evalCallback(callback, userData.range); Error while evaluating figure WindowButtonDownFcn


Diego Lozano Soldevilla - 2013-03-26 13:46:26 +0100

The error appears because the TFR was computed with only one sensor cfg.channel = 'MRC15', then in ft_topoplot_common line 326 ft_prepare_layout is called and the lay output is the following: lay = pos: [NaN NaN] width: Inf height: Inf label: {'MRC15'} outline: {[101x2 double] [3x2 double] [10x2 double] [10x2 double]} mask: {[101x2 double]} cfg: [1x1 struct] causing then the crash. Recently, the cfg.interactive option was changes to 'yes' as a default. This changed induced me expectations that for this particular case were not true. As fieltrip toolkit is in few days, I?l change the tutorial a bit to select cfg.interactive='no'; to avoid confusion to the users. As this is not a fieldtrip bug, I think that an error after around line 609 (see below) in ft_prepare_layout should be thrown if the channels number cfg.channel and the layout computed at fly using the grad info (see line 324 for example) have a "reasonable" mismatch number (is not very advisable to try to make a topoplot of 3 sensors in a CTF151 system for example). Proposition: line 609 of ft_prepare_layout % throw an error if a topoplot is request with less that 50% of the sensors if length(cfg.channel) < length(setdiff(layout.label, {'COMNT', 'SCALE'}))*0.5 If you agreed, I can check the equivalent for elec


Diego Lozano Soldevilla - 2013-09-24 17:15:47 +0200

does not makes sense to use criteria like "no topoplot can be done if less than 50% of sensors" feel free to reopened if you disagree


Robert Oostenveld - 2019-08-10 12:02:49 +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 https://github.com/fieldtrip/fieldtrip/issues.