Skip to content

compute_psd: ValueError when n_jobs=-1 and only 1 channel #11297

@sam-s

Description

@sam-s

Description of the problem

when compute_psd is passed n_jobs=-1 and the instance contains only one channel, the method fails.

Steps to reproduce

import numpy as np
import mne
data = np.random.randn(1, 4096) 
info = mne.create_info(ch_names=["EEG 01"], ch_types="eeg")
raw = mne.io.RawArray(data, info)
spectrum = raw.compute_psd(method="welch", n_jobs=-1)


### Link to data

_No response_

### Expected results

no error

### Actual results

ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)


### Additional information

Platform:         Linux-5.19.16-76051916-generic-x86_64-with-glibc2.35
Python:           3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]
Executable:       /usr/bin/python3
CPU:              x86_64: 8 cores
Memory:           15.3 GB

mne:              1.2.1
numpy:            1.23.4 {OpenBLAS 0.3.20 with 8 threads}
scipy:            1.9.3
matplotlib:       3.6.0 {backend=module://matplotlib_inline.backend_inline}

sklearn:          1.1.3
numba:            Not found
nibabel:          Not found
nilearn:          Not found
dipy:             Not found
openmeeg:         Not found
cupy:             Not found
pandas:           1.5.1
pyvista:          Not found
pyvistaqt:        Not found
ipyvtklink:       Not found
vtk:              Not found
qtpy:             2.2.1 {PyQt5=5.15.3}
ipympl:           Not found
pyqtgraph:        Not found
pooch:            v1.6.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions