[FieldTrip] NaN's in Wavelet TFR

Richard Bethlehem rb643 at medschl.cam.ac.uk
Tue May 26 11:27:38 CEST 2015


Hi Jan-Mathijs,

Essentially I want to do connectivity analysis using the wpli measure for connectivity and use wavelets to get to the frequency domain, I gathered I needed to do frequency analysis to get the power and crosspectrum info for computing wpli (and to decompose into the different frequency bands), but please let me know if this should be done differently?

I thought with such analysis selecting epochs would be fairly standard practice (following van Diessen et al. 2014), but again  please do correct me if I misunderstood. If not, what would be the alternative for getting epochs/trials?

Following you suggestion I have replaced the time axis with the same 0-4second interval as used in the freqanalysis input:
stepSize = 1/1024;
timeVector = 0:stepSize:(epochLength-stepSize);
for i = 1:size(data_iccleaned.time,2)
   data_iccleaned.time{:,i} = timeVector;
end

Unfortunately this still gives me NaN's in the output...

Cheers,

Richard




Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl <mailto:fieldtrip%40science.ru.nl?Subject=Re%3A%20%5BFieldTrip%5D%20NaN%27s%20in%20Wavelet%20TFR&In-Reply-To=%3C0D293943-40CA-45B3-B6E6-0CA403FCFA0B%40fcdonders.ru.nl%3E>
________________________________

Hi Richard,
Is there a specific reason you would want to do a time-frequency type of analysis (with averaging across ‘epochs’ for resting state data? Since there’s no external event, such analysis does not really make sense.
Yet, if you insist on doing this, you need to ensure that the individual ‘pseudo-trial’ time axis (i.e. data_iccleaned.time{x}) contains a ‘pseudo-time-axis’ such that it goes from 0 to 4.
Best,
Jan-Mathijs

On May 25, 2015, at 8:15 PM, Richard Bethlehem <rb643 at medschl.cam.ac.uk<http://mailman.science.ru.nl/mailman/listinfo/fieldtrip><mailto:rb643 at medschl.cam.ac.uk<http://mailman.science.ru.nl/mailman/listinfo/fieldtrip>>> wrote:

Dear Fieldtrippers,

This question has undoubtedly been asked before, but I could find clear guidance on how to work around it. When running ft_freqanalysis with wavelet decomposition I keep getting NaN's in all of my output. It would figure that this would be caused by insufficient data at the data borders, but I am (or at least think I am) not using that part of my epochs... So why am I still ending up with NaN's?

The data is from a 64-channel BioSemi system, sampled at 1k (and not downsampled), fairly 'standard' preprocessing with the addition of one channel repair and ICA artefact rejection (although in this one example dataset there was no clear ICA artefact component in the eyes-closed phase of the resting state). The data consist of two 50 second trials that are further segmented in 4s epochs).

The frequency code is below, the full script can be found at:https://github.com/rb643/fieldtrip_restingState/blob/master/restingstate.m

cfg_freq = [];
cfg_freq.method = 'wavelet';
cfg_freq.output = 'powandcsd';
cfg_freq.channel = 1:64;
cfg_freq.keeptrials ='yes'; %do not return an average of all trials for subsequent wpli analysis
cfg_freq.toi = [0.5:0.05:3.5]; %50ms time-window should give enough specificity
cfg_freq.foi = [0.5:0.02:4]; %delta range with increments of 0.02Hz
[freq_data.delta] = ft_freqanalysis(cfg_freq, data_iccleaned);
cfg_freq.foi = [4:0.02:7];
[freq_data.theta] = ft_freqanalysis(cfg_freq, data_iccleaned);
cfg_freq.foi = [7:0.02:13];
[freq_data.alpha] = ft_freqanalysis(cfg_freq, data_iccleaned);
cfg_freq.foi = [13:0.02:30];
[freq_data.beta] = ft_freqanalysis(cfg_freq, data_iccleaned);
cfg_freq.foi = [30:0.02:60];
[freq_data.gamma] = ft_freqanalysis(cfg_freq, data_iccleaned);

Cheers,

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150526/43b3f770/attachment-0002.html>


More information about the fieldtrip mailing list