Back to the main page.

Bug 3333 - default_interpmethod not defined in ft_plot_topo, when handling nans

Status CLOSED FIXED
Reported 2017-08-17 23:37:00 +0200
Modified 2017-11-20 20:04:57 +0100
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

- 2017-08-17 23:37:09 +0200

Hi all, I am running into an error when I am trying to use the ft_plot_topo function (located in the plotting folder) with MEG data containing NaNs. I would like to interpolate over data channels containing NaNs when plotting the data on a 2D mesh. The ft_plot_topo function checks for NaNs at line 77, and will remove NaNs if the default_interpmethod is similar to the specified interpmethod (see line 205): % take out NaN channels if interpmethod does not work with NaNs if flagNaN && strcmp(interpmethod, default_interpmethod) dat(NaNind) = []; chanX(NaNind) = []; chanY(NaNind) = []; end However, the default_interpmethod is not defined in this function and is not checked for as an variable input argument. Is the fact that the variable "default_interpmethod" is not defined a bug? Or is it not recommended to use the ft_plot_topo as a stand alone function? One suggestion would be to add another line after line 74 to check for the default_interpmethod as a variable input, and if not defined, set it as 'V4'. For example: default_interpmethod = ft_getopt(varargin, 'default_interpmethod', 'v4'); I am using the latest version of Fieldtrip (as of Aug 17, 2017), on a Macintosh, El Capitan (10.11.6), with data collected from a Yokogawa/KIT MEG160 system. Any thoughts? Thanks, Eline


Jan-Mathijs Schoffelen - 2017-11-09 19:36:57 +0100

I believe that default_interpmethod can be replaced by 'v4'. I am not sure whether the other supported interpolation methods will suffer from NaNs, but we'll find out soon enough.


Jan-Mathijs Schoffelen - 2017-11-09 19:45:32 +0100

I checked: griddata only returns meaningless all(nan) interpolated data with method 'v4'.


Jan-Mathijs Schoffelen - 2017-11-09 20:00:15 +0100

[jansch@mentat002 plotting]$ git commit ft_plot_topo.m [master 7fe8809] FIX - fixed issue with nans 1 file changed, 1 insertion(+), 1 deletion(-) [jansch@mentat002 plotting]$ git push upstream master Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 391 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) remote: Resolving deltas: 100% (3/3), completed with 3 local objects. To https://github.com/fieldtrip/fieldtrip.git 4e1ad88..7fe8809 master -> master