Skip to content

Commit

Permalink
ENH - added test script for http://bugzilla.fieldtriptoolbox.org/show…
Browse files Browse the repository at this point in the history
…_bug.cgi?id=3182, no problem detected
  • Loading branch information
robertoostenveld committed Sep 14, 2016
1 parent 4d39df2 commit 40a3b1a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/test_bug3182.m
@@ -0,0 +1,44 @@
function test_bug3182

% MEM 1500mb
% WALLTIME 00:10:00

% TEST test_bug3182
% TEST ft_freqanalysis ft_freqdescriptives

%% generate some data

data = [];
for i=1:10
data.trial{i} = randn(2,1000);
data.time{i} = (1:1000)/1000;
end
data.label = {'chan1';'chan2'};
data.fsample = 1000;
data.cfg.trl = zeros(2,3);

%% compute

cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd';
cfg.tapsmofrq = 4;
cfg.foilim = [8 40];

cfg.keeptrials = 'no';
freq1 = ft_freqanalysis(cfg, data);

cfg.keeptrials = 'yes';
freq2 = ft_freqanalysis(cfg, data);

cfg = [];
freq2fd = ft_freqdescriptives(cfg, freq2);

%% compare

if max(abs(freq1.powspctrm(:)-freq2fd.powspctrm(:))./norm(freq1.powspctrm(:)+freq2fd.powspctrm(:)))>1e-10
% small errors are expected due to accumulation of numerical errors
error('they are different');
end


0 comments on commit 40a3b1a

Please sign in to comment.