mne-tools / mne-tools/mne-python
mne.time_frequency.tfr_array_morlet contiguous error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 1.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
Description
Description of the problem
Running mne.time_frequency.tfr_array_morlet on a multi-epoch multi-channel input returns Python Error: ValueError: ndarray is not contiguous
Steps to reproduce
import mne
import numpy as np
# data is 20 Epochs * 32 Channels * 12000 Times
freqs = np.logspace(np.log10(2),np.log10(100),46)
Power_Event_1_All_Chan = mne.time_frequency.tfr_array_morlet(data(1,:,:), 1000, freqs, n_cycles=6, output='power') % OKAY
Power_Event_2_All_Chan = mne.time_frequency.tfr_array_morlet(data(2,:,:), 1000, freqs, n_cycles=6, output='power') % OKAY
Power_Both_Event_All_Chan = mne.time_frequency.tfr_array_morlet(data(1:2,:,:), 1000, freqs, n_cycles=6, output='power') % ERROR
Power_Event_All_One_Chan = mne.time_frequency.tfr_array_morlet(data(:,1,:), 1000, freqs, n_cycles=6, output='power') % OKAY
Power_Event_All_Two_Chan = mne.time_frequency.tfr_array_morlet(data(:,8:9,:), 1000, freqs, n_cycles=6, output='power') % ERROR
Link to data
No response
Expected results
All five outputs ought to be okay.
Actual results
Power_Event_1_All_Chan and Power_Event_2_All_Chan are okay. As is Power_Event_All_One_Chan.
Error for Power_Both_Event_All_Chan and Power_Event_All_Two_Chan.
In other words, multi-epoch multi-channel data is not being processed: Python Error: ValueError: ndarray is not contiguous
Additional information
Platform: Windows-10-10.0.22621-SP0
Python: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Executable: C:\Users\DELL\AppData\Local\Programs\Python\Python310\python.exe
CPU: Intel64 Family 6 Model 151 Stepping 2, GenuineIntel: 20 cores
Memory: 31.7 GB
mne: 1.3.1
numpy: 1.24.3 {unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl')}
scipy: 1.10.1
matplotlib: 3.7.1 {backend=TkAgg}
sklearn: Not found
numba: Not found
nibabel: Not found
nilearn: Not found
dipy: Not found
openmeeg: Not found
cupy: Not found
pandas: 2.0.3
pyvista: Not found
pyvistaqt: Not found
ipyvtklink: Not found
vtk: Not found
qtpy: Not found
ipympl: Not found
pyqtgraph: Not found
pooch: v1.7.0
mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
mne_icalabel: Not found
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied reproduction for mne.time_frequency.tfr_array_morlet, comparing single-epoch or single-channel inputs with multi-epoch, multi-channel inputs. Trace where the failing input is handled and verify the change against all five cases; done means the multi-epoch and multi-channel calls no longer raise the ndarray contiguity error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100