[FieldTrip] common filters - beamforming
Davide Rivolta
drivolta81 at gmail.com
Thu Aug 18 15:18:19 CEST 2011
Dear Fieldtrippers,
I am trying to learn beamforming using the tutorial. I am succesful in
calculating, with my own data, the relative change between the stuimulus and
the baseline condition (as shown in the tutorial).
However, if I want to do statistic (ie., compare the baseline and stimulus
condition) I would need a common filter (not in the tutorial). I found very
useful the website where this step is explained (examples of matlab scripts
section).
I am however confused on how to perform stats at the source level. I get the
2 conditions separately and I wish to compare them and hopefully plot WHERE
the difference is seen.
Do you have any advice on how to do it (or where to look)?
Here is my script and I am sure I am doing some silly mistake in the last
(statistic part) since it gives the error: ??? Reference to non-existent
field 'pow'.
cfg = [];
cfg.toilim = [-0.5 0];
dataPre = ft_redefinetrial(cfg, DataOut);
cfg.toilim = [0.5 1];
dataPost = ft_redefinetrial(cfg, DataOut);
data = ft_appenddata([], dataPre, dataPost);
design = [ones(1, length(dataPre.trial)) ones(1, length(dataPost.trial))*2];
cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd';
cfg.taper = 'dpss';
cfg.keeptrials = 'yes';
cfg.keeptapers = 'no';
cfg.foi = 57:2:63;
cfg.tapsmofrq = ones(length(cfg.foi), 1).* 5;
freq = ft_freqanalysis(cfg, data);
cfg = [];
cfg.frequency = 60;
cfg.method = 'dics';
cfg.grid = grid;
cfg.vol = vol;
cfg.grad = DataOut.hdr.grad;
cfg.keepfilter = 'yes';
source = ft_sourceanalysis(cfg, freq);
cfg = [];
cfg.frequency = 60;
cfg.method = 'dics';
cfg.grid = grid;
cfg.vol = vol;
cfg.grad = DataOut.hdr.grad;
cfg.grid.filter = source.avg.filter; %uses a precomputed filter (common
filter)
cfg.rawtrial = 'yes';
source = ft_sourceanalysis(cfg, freq);
A = find(design==1);
B = find(design==2);
sourceA = source;
sourceA.trial(B) = [];
sourceA.cumtapcnt(B) = [];
sourceA.df = length(A);
cfg = [];
cfg.keeptrials = 'yes';
sourceA = ft_sourcedescriptives([], sourceA);
sourceB = source;
sourceB.trial(A) = [];
sourceB.cumtapcnt(A) = [];
sourceB.df = length(B);
cfg = [];
cfg.keeptrials = 'yes';
sourceB = ft_sourcedescriptives([], sourceB);
%STATS
cfg = [];
cfg.parameter = 'pow';
cfg.method = 'analytic';
cfg.statistic = 'actvsblT';
cfg.computestat = 'yes';
cfg.computecritval = 'yes';
cfg.computeprob = 'yes';
cfg.alpha = 0.05;
cfg.tail = 0;
stat = ft_sourcestatistics(cfg, sourceB, sourceA);
Thanks for your help,
Davide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110818/4dffc459/attachment.html>
More information about the fieldtrip
mailing list