[FieldTrip] only NaNs in ft_freqgrandaverage output

Eelke Spaak e.spaak at donders.ru.nl
Fri May 1 16:42:09 CEST 2020


Dear Gina,

Have you checked whether the sinlge-subject TFRs (i.e. the output of
ft_freqanalysis) contain NaNs? (Pay special attention to the baseline
period; since you are later applying ft_freqbaseline, any NaNs in the
baseline would propagate through to the entire time axis after
baseline correction.)

The following might be relevant, if the single-subject TFRs indeed
contain NaNs: http://www.fieldtriptoolbox.org/faq/why_does_my_tfr_contain_nans/

Best,
Eelke

On Sun, 26 Apr 2020 at 21:41, Gina Brazof <gina.brazof at gmail.com> wrote:
>
> Dear Community,
>
> I preprocessed my EEG data in EEGlab and now I would like to run a time frequency analysis using FielTrip. I start by saying that I am new with the time frequency analysis, matlab and fieldtrip, so I say sorry in advance for my ignorance.
> For each of my experiment conditions (experimental design 2*2 within-subjects), I tried to run a wavelet tranformation and a grandavarage across all subjects. However, the values of the gandAverage powspctrm in two out of four conditions are only NaNs and I can not figure out why that is happening. Indeed, the code has been structurally the same for all conditions. In addition, the object of the ft_ freqgrandaverage in these two problematic conditions do not contain the reasonable amount of NaNs to justify the values in the gandaverage. Could someone help me to undertand where the problem could be?
> Below the example of code I used for each condition:
>
> %%%%% oggPain COONDITION 1
>
> TFreqAv_oggPain = cell(1,nSubjs);
> for i = 1:nSubjs
>
>     subs     = subjects{i};
>     fileName = '_data.mat';
>     dataSet  = strcat('C:\Users\bia\Desktop\dati carlotta\', subs, fileName);
>     %dataSet = fullfile(dataPath,subjects{i},fileName);
>     load(dataSet); % loading the variable 'data'
>
>     %%%%%%%%% Computing time-frequency representation for each trial
>     cfg = [];
>     cfg.method = 'wavelet';
>     cfg.foi    = 4:1:30;
>     cfg.toi    = -0.8:0.01:1.5;
>     cfg.width  = 7;
>    %cfg.keeptrials = 'yes';
>     cfg.channel    = 'all';
>     cfg.trials     = find(celltomat(data.trialinfo(:,1)) == 7 | celltomat(data.trialinfo(:,1)) == 8 | celltomat(data.trialinfo(:,1)) == 11 | celltomat(data.trialinfo(:,1)) == 12);  %numbers differ according to exp. condition
>     cfg.outputfile = strcat('C:\Users\bia\Desktop\dati carlotta\', subs,'_oggPain');
>     TFreqAv_oggPain{i}= ft_freqanalysis(cfg,data);
>     clear data
> end
> save TFreqAv_oggPain.mat TFreqAv_oggPain
>
> bslnTFreqAv_oggPain = cell(1,nSubjs);
> for i = 1:nSubjs
>
>     subs     = subjects{i};
>     fileName = '_oggPain.mat';
>     dataSet  = strcat('C:\Users\bia\Desktop\dati carlotta\', subs, fileName);
>     load(dataSet); % loading the variable 'freq'
>
>     %%%%%%%%% Computing the change relative to a baseline
>     cfg = [];
>     cfg.baselinetype = 'relchange';
>     cfg.baseline     = [-0.05 -0.02];
>     bslnTFreqAv_oggPain{i} = ft_freqbaseline(cfg,freq);
>     clear freq
> end
> save bslnTFreqAv_oggPain.mat bslnTFreqAv_oggPain
>
> %% Grand average time-frequency data
> cfg = [];
> gAvgTFreq_oggPain     = ft_freqgrandaverage(cfg,TFreqAv_oggPain{:});
> save gAvgTFreq_oggPain.mat gAvgTFreq_oggPain
> gAvgBslnTFreq_oggPain = ft_freqgrandaverage(cfg,bslnTFreqAv_oggPain{:});
> save gAvgBslnTFreq_oggPain.mat gAvgBslnTFreq_oggPain
>
> Thank for any kind of tips,
>
> Gina
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202



More information about the fieldtrip mailing list