sampling rate and time frequency analysis

External Email - Use Caution

Hi MNE experts,

I conducted time frequency analysis on resampled MEG data (from 1000Hz to
500 Hz) with the following parameters. the length of epoch is between -2s
to 12s.
n_cycles = 6
freqs = np.arange(4., 100., 1.)
power= tfr_morlet(epoch, freqs=freqs, n_cycles=n_cycles, use_fft=True,
decim=3,n_jobs=1,average=False,return_itc=False)

The length of the resulting power is 2334. However, I expect that the
length should be 14*500/6, which is 1667, where 14 is the total length of
epoch, 500 is sampling rate and 6 is the number of cycle. It seems that the
sampling rate is still 1000, rather than the new sampling rate (500). I am
pretty sure that I resampled the data before time frequency analysis.
Anyone has a clue why the length of the power from tfr_morlet does not
respect the length of the epoch. Thanks.

Best,
Veda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181121/2577eba7/attachment.html

External Email - Use Caution

Hi!

Can you share the full code that starts with the raw data (or a minimal working example)? Note that you also set decim=3 in tfr_morlet, which should also influence the length of the result.

Clemens

External Email - Use Caution

Hi Clemens,
Thanks for your reply.
To your question, I tried to change the decim as 1, the output is still not
correct.

Here are the codes:

raw = mne.io.kit.read_raw_kit(file, stim=[200], preload=True)

raw.resample(500)

raw.filter(0.5, None)

events_all = numpy.loadtxt(f3)

tmin, tmax = -2, 12

baseline = (None, 0)

epoch2 = mne.Epochs(raw, events_sel,event_id , tmin, tmax, picks=picks,
baseline=baseline, reject=dict(mag=1.5e-11), preload=True)

ica.apply(epoch2, exclude=rlist.tolist())

n_cycles = 6

freqs = np.arange(4., 100., 1.)

power= tfr_morlet(epoch2, freqs=freqs, n_cycles=n_cycles, use_fft=True,
decim=3,n_jobs=1,average=False,return_itc=False)

Veda

External Email - Use Caution

hi Veda,

please open an issue at : https://github.com/mne-tools/mne-python/issues

and provide a full code snippet we can easily run to replicate the problem
(ideally with sample dataset).

thanks
Alex