Back to the main page.

Bug 931 - ft_appendfreq fails when the data does not exactly overlap

Status CLOSED WONTFIX
Reported 2011-09-05 09:15:00 +0200
Modified 2011-09-14 14:33:31 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2011-09-05 09:15:23 +0200

This was reported by Yoni at http://bugzilla.fcdonders.nl/show_bug.cgi?id=798#c19 and it can be reproduced by the following piece of code (which I'll save to the test directory) freq1.label = {'1'}; freq1.time = [1 2]; freq1.freq = [1 2 3]; freq1.dimord = 'chan_freq_time'; freq1.powspctrm = randn(1,3,2); freq2.label = {'1'}; freq2.time = [1 2]; freq2.freq = [1 2 3] + 1; % shifted by one freq2.dimord = 'chan_freq_time'; freq2.powspctrm = randn(1,3,2); cfg = []; cfg.parameter = 'powspctrm'; ft_appendfreq(cfg, freq1, freq2); the input is freq data with 1 channels, 3 frequencybins and 2 timebins the input is freq data with 1 channels, 3 frequencybins and 2 timebins the input is freq data with 1 channels, 3 frequencybins and 2 timebins the input is freq data with 1 channels, 3 frequencybins and 2 timebins ??? Error using ==> ft_appendfreq at 203 the input data structures have non-unique frequency bins, concatenation across frequency is not possible Error in ==> ft_appendfreq at 130 freq = ft_appendfreq(tmpcfg, varargin{:});


Robert Oostenveld - 2011-09-05 09:19:24 +0200

manzana> svn commit test_bug931.m Adding test_bug931.m Transmitting file data . Committed revision 4098.


Jan-Mathijs Schoffelen - 2011-09-05 09:29:24 +0200

fixed in ft_appendfreq with cfg.tolerance.


Robert Oostenveld - 2011-09-05 09:38:10 +0200

The error is > the input data structures have non-unique frequency bins, concatenation across > frequency is not possible which is actually consistent with the data: freq1 has [1 2 3], freq2 has [2 3 4] and these cannot be concatenated. Since the problem started in ft_freqstatistics, one might rephrase it as cfg = []; cfg.parameter = 'powspctrm'; cfg.appenddim = 'rpt'; % be explicit ft_appendfreq(cfg, freq1, freq2); failing. The question is whether ft_appendfreq should ensure the overlap of the freq axis (i.e. cut of the first sample in freq1 and the last sample in freq2)? The old ft_freqstatistics was able to deal with this input, so as such the bug remains present, but might not be in ft_appendfreq persee.


Yoni Levy - 2011-09-05 09:52:19 +0200

(In reply to comment #3) > The error is > > > the input data structures have non-unique frequency bins, concatenation across > > frequency is not possible > > which is actually consistent with the data: freq1 has [1 2 3], freq2 has [2 3 > 4] and these cannot be concatenated. > As far as I can see the freq1.freq and freq2.freq in my dataset are identical; but perhaps as you wrote it is inherently shifted by 1 by using the function.


Robert Oostenveld - 2011-09-05 11:17:29 +0200

I discussed this in detail with Jan-Mathijs. For the example script the error-message that is produced by ft_appendfreq is actually correct and desired. The problem in the data of Yoni is due to a small numerical difference in the time axis between the (otherwise consistent) two datasets. This particular problem does not have to be fixed, but ft_selectdata should use nearest (which it did once upon a time, but which it does not do any more).


Robert Oostenveld - 2011-09-14 14:33:31 +0200

I closed all the bugs that were in the status RESOLVED. This includes the ones that we just discussed in the weekly fieldtrip meeting, but also the bugs that we did not discuss.