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
I have data where the channel names contain :. While MNE is able to successfully write this data, it throws a weird error when reading. While I can fix the channel names, I think the error (if at all) should be raised when writing the data, not reading.
Steps to reproduce
importmneroot=mne.datasets.sample.data_path() /'MEG'/'sample'evk_file=root/'sample_audvis-ave.fif'evoked=mne.read_evokeds(evk_file, baseline=(None, 0), proj=True,
verbose=False)[0]
# comment out the following line to see now errorevoked.rename_channels(lambdax: x.replace(' ', ':'))
evoked.info['bads'] = [evoked.info['ch_names'][0]]
mne.write_evokeds('test_ave.fif', evoked, overwrite=True)
evoked2=mne.read_evokeds('test_ave.fif')[0]
Link to data
No response
Expected results
No error
Actual results
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
File/autofs/space/meghnn_001/users/mjas/github_repos/mne-opm/mne_bug.py:1411evoked.info['bads'] = [evoked.info['ch_names'][0]]
12mne.write_evokeds('test_ave.fif', evoked, overwrite=True)
--->14evoked2=mne.read_evokeds('test_ave.fif')[0]
File<decorator-gen-255>:12, inread_evokeds(fname, condition, baseline, kind, proj, allow_maxshield, verbose)
File/autofs/space/meghnn_001/users/mjas/github_repos/mne-python/mne/evoked.py:1186, inread_evokeds(fname, condition, baseline, kind, proj, allow_maxshield, verbose)
1184return_list=True1185ifconditionisNone:
->1186evoked_node=_get_evoked_node(fname)
1187condition=range(len(evoked_node))
1188elifnotisinstance(condition, list):
File/autofs/space/meghnn_001/users/mjas/github_repos/mne-python/mne/evoked.py:1005, in_get_evoked_node(fname)
1003f, tree, _ =fiff_open(fname)
1004withfasfid:
->1005_, meas=read_meas_info(fid, tree, verbose=False)
1006evoked_node=dir_tree_find(meas, FIFF.FIFFB_EVOKED)
1007returnevoked_nodeFile<decorator-gen-35>:10, inread_meas_info(fid, tree, clean_bads, verbose)
File/autofs/space/meghnn_001/users/mjas/github_repos/mne-python/mne/io/meas_info.py:1552, inread_meas_info(fid, tree, clean_bads, verbose)
1549acq_stim=tag.data1551# Load the SSP data->1552projs=_read_proj(
1553fid, meas_info, ch_names_mapping=ch_names_mapping)
1555# Load the CTF compensation data1556comps=_read_ctf_comp(
1557fid, meas_info, chs, ch_names_mapping=ch_names_mapping)
File<decorator-gen-15>:12, in_read_proj(fid, node, ch_names_mapping, verbose)
File/autofs/space/meghnn_001/users/mjas/github_repos/mne-python/mne/io/proj.py:528, in_read_proj(fid, node, ch_names_mapping, verbose)
525data=data.T527ifdata.shape[1] !=len(names):
-->528raiseValueError('Number of channel names does not match the '529'size of data matrix')
531# just always use this, we used to have bugs with writing the532# number correctly...533nchan=len(names)
ValueError: Numberofchannelnamesdoesnotmatchthesizeofdatamatrix
Description of the problem
I have data where the channel names contain
:
. While MNE is able to successfully write this data, it throws a weird error when reading. While I can fix the channel names, I think the error (if at all) should be raised when writing the data, not reading.Steps to reproduce
Link to data
No response
Expected results
No error
Actual results
Additional information
The text was updated successfully, but these errors were encountered: