[FieldTrip] NaNs as output of ft_sourceanalysis (DICS)
Eelke Spaak
eelke.spaak at donders.ru.nl
Tue Jun 4 11:54:51 CEST 2013
Dear Andreas,
How many NaNs do you get exactly and in which field? If it is some
NaNs in source.avg.pow, then it is quite normal: the estimates for
dipole locations which were flagged as outside the brain are always
NaN, as they are not scanned. The following should hold:
sum(isnan(source.avg.pow)) == numel(source.outside)
&&
sum(~isnan(source.avg.pow)) == numel(source.inside)
Best,
Eelke
On 4 June 2013 11:42, Andreas Sauer <sauer.mpih at googlemail.com> wrote:
> Dear all,
>
> I would like to analyze sources with the beamforming approach using the DICS
> method. I followed the steps in the tutorial and everything works well.
> However, the output of ft_sourceanalysis contains only NaNs.
>
> I checked the TF data that I calculated in the step before but that looks
> fine, so I assume the error happens somewhere during ft_sourceanalysis.
>
> That's how I calculate the TFRs:
>
> cfg = [];
> cfg.toilim = [-0.5 -0.3]; % baseline activity
> eval(['dataPre =
> ft_redefinetrial(cfg,Cond_',num2str(cond(j)),');']);
> cfg.toilim = [0.1 1.0]; % task-related activity
> eval(['dataPost =
> ft_redefinetrial(cfg,Cond_',num2str(cond(j)),');']);
>
> % Combine the two datasets...
> data = appenddata(cfg, dataPre, dataPost);
> trialdesign = [ones(1,length(dataPost.trial))
> ones(1,length(dataPre.trial))*2];
>
> % ... and compute the CSD matrices...
> cfg = [];
> cfg.output = 'powandcsd';
> cfg.channel = Channel.meg;
> cfg.method = 'mtmfft';
> cfg.taper = 'dpss';
> cfg.foilim = [75 75];
> cfg.tapsmofrq = 15; % amount of spectral smoothing = +/- 15 Hz
> cfg.channelcmb = {Channel.meg Channel.meg};
>
> % ... for the baseline and task part separately...
> eval(['freqPre.Cond_',num2str(cond(j)), ' =
> ft_freqanalysis(cfg,dataPre);']);
> eval(['freqPost.Cond_',num2str(cond(j)), ' =
> ft_freqanalysis(cfg,dataPost);']);
>
> % ... and for the whole trial
> eval(['freqAll.Cond_',num2str(cond(j)), ' =
> ft_freqanalysis(cfg,data);']);
> eval(['freqAll.Cond_',num2str(cond(j)), '.trialdesign =
> trialdesign;']); % pre and post info
>
> And that's how I calculate the sources:
>
> cfg = [];
> cfg.frequency = 75;
> cfg.method = 'dics';
> cfg.grid = grid; % Here it gives .pos, .inside, .outside to
> the structure
> cfg.vol = vol;
> cfg.dim = template_grid.dim; % Here I give the dimension
> of the template grid
> cfg.grad = Cond_101.hdr.grad;
> cfg.lambda = '5%';
> cfg.reducerank = 'no';
> cfg.projectnoise = 'yes';
> cfg.realfilter = 'yes';
> cfg.keepfilter = 'yes'; % the output saves the computed inverse
> filter
>
> eval(['SourceAll = ft_sourceanalysis(cfg,
> freqAll.Cond_',num2str(cond(k)),');'])
>
> % use the common filter here
> cfg.grid.filter = SourceAll.avg.filter;
> eval(['sourcePre_con = ft_sourceanalysis(cfg,
> freqPre.Cond_',num2str(cond(k)),');'])
> eval(['sourcePost_con = ft_sourceanalysis(cfg,
> freqPost.Cond_',num2str(cond(k)),');'])
>
>
>
> I would really appreciate any help with that! Thanks a lot!
>
> Best,
>
> Andreas
>
> --
> Andreas Sauer
> Max Planck Institute for Brain Research
> Deutschordenstr. 46
> 60528 Frankfurt am Main
> Germany
>
> T: +49 69 96769 278
> F: +49 69 96769 327
> Email: andreas.sauer at brain.mpg.de
> www.brain.mpg.de
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
More information about the fieldtrip
mailing list