[Mne_analysis] mn.time_frequency.tfr_array_stockwell

Eric Larson larson.eric.d at gmail.com
Thu Jul 9 15:20:50 EDT 2020
Search archives:

        External Email - Use Caution        

For now you can work around it by doing `data = data[np.newaxis]` to make
it of shape `(n_epochs, n_channels, n_times)` (which appears to be what the
function actually wants). Can you open an issue on the MNE-Python issue
tracker so that we don't forget to fix this? It should really just operate
along the last dimension and not assume that's 2.

Eric


On Thu, Jul 9, 2020 at 3:18 PM Paul Fishback <fishbacp at mail.gvsu.edu> wrote:

>         External Email - Use Caution
>
> Hi Alex,
>
> Thanks so much for responding to my message. I tried what you suggested,
> but I'm still getting an error:
>
> raw=mn.io.read_raw_edf('/Users/fishbacp/Desktop/11.edf', preload=True)
> Fs=raw.info['sfreq']
>
> data,times=raw[:,:]
> print('data: '+str(data.shape)) #This indicates the data shape is
> 46-by-123200, which makes sense for my recording: 46 channels, 10 minute
> time length, and sampling frequency 200 Hz.
>
> signal = data[[0]]
> print('signal: '+str(signal.shape))    # This produces 1-by-123200 for
> this channel
> min_freq = 5
> max_freq = 100
> st_power, itc, freqs = mn.time_frequency.tfr_array_stockwell(signal,Fs,
> fmin=min_freq, fmax=max_freq)
>
> This is the error message:
>
> Traceback (most recent call last):
>   File "/Users/fishbacp/Desktop/Python_Sabbatical/plot_stockwell.py", line
> 145, in <module>
>     st_power, itc, freqs =
> mn.time_frequency.tfr_array_stockwell(signal,Fs, fmin=min_freq,
> fmax=max_freq)
>   File
> "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mne/time_frequency/_stockwell.py",
> line 172, in tfr_array_stockwell
>     n_out = data.shape[2] // decim + bool(data.shape[2] % decim)
> IndexError: tuple index out of range
>
> Lines-171-173 in the script, located at
> https://github.com/mne-tools/mne-python/blob/maint/0.20/mne/time_frequency/_stockwell.py#L101-L199 are
> as follows:
>
> [image: image.png]
>
> I don't see how data.shape[2] could even be defined if data lacks a third
> dimension.
>
> I'm not wed to using this implementation of the stockwell transform. I
> tried it first because I enjoy using MNE, but if you know of other good
> implementations, I would enjoy hearing about them.
>
> Many, many thanks.
>
> Best,
>
> Paul
>
> On Thu, Jul 9, 2020 at 10:38 AM Alexandre Gramfort <
> alexandre.gramfort at inria.fr> wrote:
>
>>         External Email - Use Caution
>>
>> hi Paul,
>>
>> try:
>>
>> import numpy as np
>> import mne
>>
>> raw = mne.io.read_raw_edf('/Users/fishbacp/Desktop/EEG_file.edf',
>> preload=True)
>> Fs = raw.info['sfreq']
>> data, times=raw[:, :]
>> signal = data[[0]]
>> min_freq = 5
>> max_freq = 100
>> st_power, itc, freqs = mne.time_frequency.tfr_array_stockwell(signal,
>> Fs, fmin=min_freq, fmax=max_freq)
>>
>> --
>>
>> signal must be a 2d array with dimensions: channel x time
>>
>> Alex
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>
>
> --
> Professor of Mathematics, Grand Valley State University
>
> Department of Mathematics (MAK C-2-408)
> Grand Valley State University
> 1 Campus Dr.
> Allendale, MI 49401
> fishbacp at mail.gvsu.edu
> 616.331.2040
> 616.331.3120 (fax)
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200709/98ed298d/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27673 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200709/98ed298d/attachment-0001.png 


More information about the Mne_analysis mailing list