Back to the main page.
Bug 1357 - ft_singleplotER crashes on single channel freq data
Status | CLOSED FIXED |
Reported | 2012-03-06 09:52:00 +0100 |
Modified | 2012-08-23 14:02:02 +0200 |
Product: | FieldTrip |
Component: | plotting |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P3 normal |
Assigned to: | Jörn M. Horschig |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Gio Piantoni - 2012-03-06 09:52:43 +0100
ft_singleplotER crashes when freq data contains only one channel. Can you check if the bugfix works for all the cases? freq = []; freq.dimord = 'chan_freq_time'; freq.label = {'E1' 'E2'}; freq.time = 0:.1:2; freq.freq = 1:20; freq.powspctrm = randn(numel(freq.label), numel(freq.freq), numel(freq.time)); figure cfg = []; cfg.channel = freq.label; cfg.zlim = [8 12]; % (btw not documented) ft_singleplotER(cfg, freq); % works freq = ft_selectdata(freq, 'channel', 1) figure cfg = []; cfg.channel = freq.label; cfg.zlim = [8 12]; ft_singleplotER(cfg, freq); % crashes at Error in ft_singleplotER (line 467) dat = dat(sellab, xidmin(i):xidmax(i)); % BUGFIX line 405: squeeze is overenthusiastic varargin{i}.(cfg.parameter) = squeeze(varargin{i}.(cfg.parameter)); I think permute is better varargin{i}.(cfg.parameter) = permute(varargin{i}.(cfg.parameter), [1 3 2]); I could commit it, but I'm afrad I'm missing some particular usage. Thanks! A similar fix could be used at line 410 (but I cannot run this code because yparam is never "time", line 214 and 218 are testing the same condition).
Jörn M. Horschig - 2012-03-06 10:29:43 +0100
Hey Giovanni, the permute fix is a good idea, I implemented the same in ft_multiplotTFR some weeks ago, see bug 1168. I fixed it like this, in order to be more flexible if dimord is not standard: % get dimord dimensions dims = textscan(data.dimord,'%s', 'Delimiter', '_'); dims = dims{1}; ydim = find(strcmp(yparam, dims)); xdim = find(strcmp(xparam, dims)); zdim = setdiff(1:ndims(dat), [ydim xdim]); % and permute dat = permute(dat, [zdim(:)' ydim xdim]); Maybe this should be implemented in the multiplotER and singleplotTFR as well - didn't think about it back then. I can fix that (but not before Thursday)
Jan-Mathijs Schoffelen - 2012-03-06 10:30:31 +0100
what about using shiftdim?
Gio Piantoni - 2012-03-12 16:05:48 +0100
(In reply to comment #1) Hi Jörn, In my snafu today, I committed my local changes to the main repo. One of the changes was "permute" at line 405 of ft_singleplotER. http://code.google.com/p/fieldtrip/source/browse/trunk/ft_singleplotER.m I think 'permute' is only a temporary solution, I prefer your approach which is more flexible. This comment is only if you track changes to ft_singleplotER.m and you wonder why I committed the change. Cheers, G
Jörn M. Horschig - 2012-03-12 17:09:47 +0100
Hey Gio, thanks for letting me know. I was a bit busy the last days cause of the BioMag deadline, but I'll make sure that the fix you committed is really a 1-2 day temporary fix ;)
Jörn M. Horschig - 2012-03-13 12:03:38 +0100
I hope that all data structures have a dimord-field, but I guess ft_checkdata takes care of this, doesn't it? svn ci -m "bugfix-#1357- singleplot and multiplot do not squeeze anymore + testscript" Sending ft_multiplotER.m Sending ft_singleplotER.m Sending ft_singleplotTFR.m Sending test/sourceanalysisDICS.m Sending test/test_bug1168.m Sending test/test_bug1351.m Adding test/test_bug1357.m Transmitting file data ....... Committed revision 5446.