Description of the problem
read_raw_neuralynx() data loading fails when 1 (non-initial) channel is picked prior to calling raw.load_data().
This is because AnalogSignalGap.load(), which loads zero-arrays representing data gaps, indexes along channel axis in self.signal with idx. But this is not needed since self.signal is constructed based on the size of idx variable. indexing with slice(1, 2) on a 1-dimensional array yields a 0-dim array along channel axis which breaks concatenation with real data.
PR: #12357
Steps to reproduce
from mne.io import read_raw_neuralynx
from mne.datasets.testing import data_path
testing_path = data_path(download=False) / "neuralynx"
exclude = ['LAHC1.ncs', 'LAHC2.ncs', 'LAHC3.ncs', 'xAIR1.ncs', 'xEKG1.ncs', 'LAHCu1.ncs'] # ignore channels with no gaps
raw = read_raw_neuralynx(testing_path, preload=False, exclude_fname_patterns=exclude) # channel names: ['LACH1', 'LAHC2']
raw.pick(picks="LAHC2")
raw.load_data()
Link to data
No response
Expected results
Loads the data and returns raw instance.
Actual results
np.concatenate() in l. 353 of neuralynx.py will yield dimension-mismatch error along channel dimension (real data arrays will be 1-dimensional and zero-arrays will be 0-dimensional).
Additional information
Platform Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:40:35) [GCC 12.3.0]
Executable /home/kriarm/miniconda3/envs/mnedev/bin/python3.11
CPU x86_64 (20 cores)
Memory 31.2 GB
Core
├☒ mne 1.6.0.dev163+g7ff8c586e (outdated, release 1.6.0 is available!)
├☑ numpy 1.24.4 (OpenBLAS 0.3.24 with 20 threads)
├☑ scipy 1.11.3
├☑ matplotlib 3.8.0 (backend=agg)
├☑ pooch 1.8.0
└☑ jinja2 3.1.2
Numerical (optional)
├☑ sklearn 1.3.2
├☑ numba 0.57.1
├☑ nibabel 5.1.0
├☑ nilearn 0.10.2
├☑ dipy 1.7.0
├☑ openmeeg 2.5.6
├☑ pandas 2.1.2
└☐ unavailable cupy
Visualization (optional)
├☑ pyvista 0.42.3 (OpenGL unavailable)
├☑ pyvistaqt 0.0.0
├☑ vtk 9.2.6
├☑ qtpy 2.4.1 (None=None)
├☑ ipympl 0.9.3
├☑ pyqtgraph 0.13.3
├☑ mne-qt-browser 0.6.0
├☑ ipywidgets 8.1.1
├☑ trame_client 2.12.6
├☑ trame_server 2.12.1
├☑ trame_vtk 2.5.9
└☑ trame_vuetify 2.3.1
Ecosystem (optional)
├☑ mne-bids 0.14.dev0
├☑ mne-connectivity 0.6.0dev0
├☑ neo 0.12.0
└☐ unavailable mne-nirs, mne-features, mne-icalabel, mne-bids-pipeline
Description of the problem
read_raw_neuralynx()data loading fails when 1 (non-initial) channel is picked prior to callingraw.load_data().This is because
AnalogSignalGap.load(), which loads zero-arrays representing data gaps, indexes along channel axis inself.signalwithidx. But this is not needed sinceself.signalis constructed based on the size ofidxvariable. indexing withslice(1, 2)on a 1-dimensional array yields a 0-dim array along channel axis which breaks concatenation with real data.PR: #12357
Steps to reproduce
Link to data
No response
Expected results
Loads the data and returns raw instance.
Actual results
np.concatenate()in l. 353 ofneuralynx.pywill yield dimension-mismatch error along channel dimension (real data arrays will be 1-dimensional and zero-arrays will be 0-dimensional).Additional information
Platform Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:40:35) [GCC 12.3.0]
Executable /home/kriarm/miniconda3/envs/mnedev/bin/python3.11
CPU x86_64 (20 cores)
Memory 31.2 GB
Core
├☒ mne 1.6.0.dev163+g7ff8c586e (outdated, release 1.6.0 is available!)
├☑ numpy 1.24.4 (OpenBLAS 0.3.24 with 20 threads)
├☑ scipy 1.11.3
├☑ matplotlib 3.8.0 (backend=agg)
├☑ pooch 1.8.0
└☑ jinja2 3.1.2
Numerical (optional)
├☑ sklearn 1.3.2
├☑ numba 0.57.1
├☑ nibabel 5.1.0
├☑ nilearn 0.10.2
├☑ dipy 1.7.0
├☑ openmeeg 2.5.6
├☑ pandas 2.1.2
└☐ unavailable cupy
Visualization (optional)
├☑ pyvista 0.42.3 (OpenGL unavailable)
├☑ pyvistaqt 0.0.0
├☑ vtk 9.2.6
├☑ qtpy 2.4.1 (None=None)
├☑ ipympl 0.9.3
├☑ pyqtgraph 0.13.3
├☑ mne-qt-browser 0.6.0
├☑ ipywidgets 8.1.1
├☑ trame_client 2.12.6
├☑ trame_server 2.12.1
├☑ trame_vtk 2.5.9
└☑ trame_vuetify 2.3.1
Ecosystem (optional)
├☑ mne-bids 0.14.dev0
├☑ mne-connectivity 0.6.0dev0
├☑ neo 0.12.0
└☐ unavailable mne-nirs, mne-features, mne-icalabel, mne-bids-pipeline