[FieldTrip] NaNs as output of ft_sourceanalysis (DICS)

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Tue Jun 4 12:17:37 CEST 2013


Hi Andreas,

could it be related to the fact that you redefine your trials and when 
estimating the frequency content, there is no exact 75Hz bin, thus 
ft_sourceanalysis cannot beam the frequency you specify? Since you cut 
out the pre- and poststimulus periods with different lengths, the 
frequency resolution will be strongly different, thus an estimate of 
75Hz will effectively be somewhere around 75Hz, but not exactly 75Hz. 
You could try to set 
cfg.frequency=freqAll.Cond_(yourNumberedCondition).freq instead of 
cfg.frequency=75. Note that in this case, sourceAll might have non-nans, 
but sourcePre and sourcePost will probably still have nans due to the 
resolution issue
If that's not the case, then I agree also with Eelke that more 
information is needed to help you, e.g. in which of the three source 
structures are nans? How many nans are there (try 
all(isnan(source.avg.pow(:))))?

Best,
Jörn

On 6/4/2013 11:54 AM, Eelke Spaak wrote:
> 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
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands




More information about the fieldtrip mailing list