You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using mne.channels.combine_channels on mne.Epochs or mne.EpochsArray objects with missing channels where the user had previously used on_missing='ignore' or on_missing='warn' it will raise an exception. There does not appear to be a way within mne.channels.combine_channels to avoid the exception.
Steps to reproduce
importmnesample_data_folder=mne.datasets.sample.data_path()
sample_data_raw_file=sample_data_folder/"MEG"/"sample"/"sample_audvis_raw.fif"raw=mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=60)
events=mne.find_events(raw, stim_channel="STI 014")
# event ID 1000 does not existevent_id= [5, 1000]
epochs=mne.Epochs(raw, events=events, event_id=event_id, on_missing='warn')
mne.channels.combine_channels(inst=epochs, groups={'test': [0, 1]})
Link to data
No response
Expected results
Ideally the previous use of on_missing='ignore' or on_missing='warn' would be stored and used again for constructing the new mne.EpochsArray object, but at least having an on_missing argument in mne.channels.combine_channels would allow this problem to be avoided.
Actual results
The following exception is raised, with apparently no way to avoid it other than manually removing the unused events:
Description of the problem
When using
mne.channels.combine_channels
onmne.Epochs
ormne.EpochsArray
objects with missing channels where the user had previously usedon_missing='ignore'
oron_missing='warn'
it will raise an exception. There does not appear to be a way withinmne.channels.combine_channels
to avoid the exception.Steps to reproduce
Link to data
No response
Expected results
Ideally the previous use of
on_missing='ignore'
oron_missing='warn'
would be stored and used again for constructing the newmne.EpochsArray
object, but at least having anon_missing
argument inmne.channels.combine_channels
would allow this problem to be avoided.Actual results
The following exception is raised, with apparently no way to avoid it other than manually removing the unused events:
Additional information
Platform Linux-5.15.0-105-generic-x86_64-with-glibc2.31
Python 3.10.11 (main, May 16 2023, 00:28:57) [GCC 11.2.0]
Executable /home/toddrjen/bin/anaconda3/envs/mne/bin/python3
CPU x86_64 (16 cores)
Memory 31.2 GB
Core
├☑ mne 1.7.0 (latest release)
├☑ numpy 1.26.4 (OpenBLAS 0.3.23.dev with 16 threads)
├☑ scipy 1.13.0
└☑ matplotlib 3.8.4 (backend=TkAgg)
Numerical (optional)
├☑ sklearn 1.4.2
├☑ numba 0.59.1
├☑ nibabel 5.2.1
├☑ pandas 2.2.1
└☐ unavailable nilearn, dipy, openmeeg, cupy, h5io, h5py
Visualization (optional)
├☑ ipympl 0.9.4
├☑ ipywidgets 8.1.2
└☐ unavailable pyvista, pyvistaqt, vtk, qtpy, pyqtgraph, mne-qt-browser, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
The text was updated successfully, but these errors were encountered: