[mne-python] tfr_morlet to return single epochs

Dear mne-list,

I would like to make a morlet wavelet on single epochs but as I
understand the tfr_morlet, it returns the average power for all the
epochs. If this is correct is there a way to make tfr_morlet return the
single epochs or is there another function that can?

thanks,
mads

hi Mads,

yes you can. Just call tfr_morlet on epochs[k] to compute it on one epochs.

You can index epochs like arrays with MNE-Python

Alex

hi Alex,

thanks for the reply. I afraid cannot make it work, I get the following
error:

Traceback (most recent call last):

   File "<ipython-input-9-1e05100b604d>", line 30, in <module>
     return_itc=True, decim=3, n_jobs=1)

   File
"/home/mje/Toolboxes/anaconda/lib/python2.7/site-packages/mne-0.9.git-py2.7.egg/mne/time_frequency/tfr.py",
line 892, in tfr_morlet
     data = data[:, picks, :]

IndexError: too many indice

I just used to the code from the example
"time_frequency/plot_time_frequency_sensors.py" and changed the:
power, itc = tfr_morlet(epochs, freqs=freqs, n_cycles=n_cycles,
use_fft=False,
to:
power, itc = tfr_morlet(epochs[0], freqs=freqs, n_cycles=n_cycles,
use_fft=False,
                         return_itc=True, decim=3, n_jobs=1)
            return_itc=True, decim=3, n_jobs=1)

the full code is below,

any thoughts?
best regards,
mads

Hi Mads,

there was 2 problems:

- epochs[0] was a bad epoch so you need to preload epochs or call
epochs.drop_bad_epochs() to make sure epochs[0] is good.

- a bug in mne-python I just fixed
https://github.com/mne-tools/mne-python/pull/1543

I will be in our bug fix release of 0.8 in the next few weeks. You can
also use current development version.

thanks for the bug report

Alex

Hi Alex,

thanks for the update and fix (I'm using the git version)

best,
mads