[FieldTrip] problem with ft_freqanalysis foi
Schoffelen, J.M. (Jan Mathijs)
janmathijs.schoffelen at donders.ru.nl
Sat Feb 5 11:16:52 CET 2022
Hi Grace Mae,
I suspect that the datafile.times is in ms, while fieldtrip expets this to be expressed in good old seconds. Consequence: FieldTrip ’thinks’ that your data is sampled a 1Hz, rather than at 1000 Hz.
Best wishes and happy computing,
On 4 Feb 2022, at 18:26, Elliott, Grace Mae via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
I'm brand new to fieldtrip, so I apologize for what may be a remedial question. I have resting-state continuous EEG data (71 channels, sampling rate 1000Hz, 7 minutes in length) and I'm trying to write a script to analyze connectivity with WPLI. I'm running into two issues right now:
1.) When I try to specify a frequency range with cfg.foi in ft_freqanalysis, I keep receiving an error that the frequencies are above the Nyquist. My sampling rate is 1000Hz, so I'm confused about this error when I'm only entering values up to 60Hz.
2.) When I forgo using cfg.foi and run through the script, I keep ending up with a WPLI spectrum matrix of NaN values and an error message that WPLI requires >1 trial. I've tried segmenting my data and trying to keep trials throughout frequency analysis, but this does not appear to be working.
Thank you to all readers - I am open to any suggestions! The script I've been using:
%load set from EEGLAB
datafile = pop_loadset('data.set')
%format set into fieldtrip compatible structure
hdr = ft_read_header('data.set')
ftdata = 
ftdata.time = datafile.times
ftdata.trial = ft_read_data('data.set','data',hdr)
ftdata.label = hdr.label
ftdata.fsample = 1000.0
ftdata.dimord = 'chan_time'
cfg0 = 
cfg0.length = 105250
cfg0.overlap = 0
freq1 = ft_redefinetrial(cfg0, ftdata)
data2 = ft_datatype(freq1)
cfg2 = 
cfg2.covariance = 'yes'
cfg2.keeptrials = 'yes'
[freq] = ft_timelockanalysis(cfg2, freq1)
cfg8 = 
cfg8.method = 'mtmfft'
cfg8.taper = 'hanning'
cfg8.keeptrials = 'yes'
cfg8.output = 'powandcsd'
cfg8.foi = 9.0:1.0:20.0
freq.label = hdr.label
freq.fsample = 1000.0
freq10 = ft_freqanalysis(cfg8, freq)
data5 = ft_datatype(freq10)
cfg4 = 
cfg4.method = 'wpli'
[wpli] = ft_connectivityanalysis(cfg4, freq10)
fieldtrip mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fieldtrip