[FieldTrip] Assistance with Resolving NaN Values in Power Spectrum Using ft_freqanalysis

二姬 wcy131608 at gmail.com
Thu Jan 4 14:38:03 CET 2024


Dear FieldTrip Community,

I am encountering a specific issue while conducting time-frequency analysis
using the ft_freqanalysis function with wavelet decomposition. Through my
readings of previous tutorials and email discussions within the community,
I understand that the NaN values appearing at the boundaries of my time
segments in the output power spectrum are likely due to insufficient data
at the data borders. However, I am particularly keen to learn how to
resolve these NaN values, as the power values at the time boundaries are
crucial for my analysis and cannot be disregarded.

Here is an excerpt of my code for reference:

EEG = pop_epoch( EEG, {  '2   '  }, [-1 1.502], 'newname', 'EEProbe
continuous data epochs', 'epochinfo', 'yes');
ft_data = eeglab2fieldtrip(EEG, 'preprocessing', 'none');
cfg = [];
cfg.channel = 'all';
cfg.method = 'tfr';
cfg.output = 'pow';
cfg.foi = 3:0.29:30;
cfg.toi = -1:0.002:1.5;
cfg.width = 3;
cfg.keeptrials  = 'yes';
subj_data_tf = ft_freqanalysis(cfg, ft_data);

My inquiries are twofold:

Is there a way to adjust parameters within the ft_freqanalysis function,
such as interpolation, zero-padding, or other methods, to eliminate the NaN
values at the edges of the time segments in the power spectrum?

If it's not feasible to resolve these NaN values directly within
ft_freqanalysis, does FieldTrip offer any other functions (similar to
ft_interpolatenan, which seems not applicable in this case) that can
address NaN values in the output of time-frequency analysis?

Any insights, suggestions, or guidance on how to tackle this issue would be
greatly appreciated. I'm particularly interested in understanding if
there's a standard approach within the FieldTrip framework for dealing with
such NaN values.

Thank you in advance for your time and assistance.

Best regards,

Chengyuan Wu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240104/b6e440c3/attachment.htm>


More information about the fieldtrip mailing list