mne-python: BUG: Import raw CNT file channels in integer format; not strings

Having trouble importing raw .CNT file. Previous steps include importing os, importing MNE, importing numpy as np, importing mayavi, setting log level, importing cnt, defining the file path, and defining the raw_fname. When trying to use read function I get the following:

`In [12]: raw = mne.io.read_raw_cnt(input_fname='./raw/s1066.cnt', montage=('montage'), eog=('VEOU', 'VEOL', 'HEOR', 'HEOL'), 
                          misc=('SCR', 'SCL'), ecg=('HR'), 
                          emg=('PA-L-SCALP', 'PA-L-EAR', 'PA-R-SCALP', 'PA-R-EAR', 'ORB-NOSE', 'ORB-EAR', 'COR-NOSE', 'COR-EAR', 'ZYG-MOUTH', 'ZYG-EAR'), 
                          data_format='auto', date_format='mm/dd/yy', preload=True, stim_channel=True)
<ipython-input-12-a085b95a7d93>:4: RuntimeWarning:   Could not parse meas date from the header. Setting to None.
  data_format='auto', date_format='mm/dd/yy', preload=True, stim_channel=True)
<ipython-input-12-a085b95a7d93>:4: RuntimeWarning: Could not define the number of bytes automatically. Defaulting to 2.
  data_format='auto', date_format='mm/dd/yy', preload=True, stim_channel=True)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-a085b95a7d93> in <module>
      2                           misc=('SCR', 'SCL'), ecg=('HR'),
      3                           emg=('PA-L-SCALP', 'PA-L-EAR', 'PA-R-SCALP', 'PA-R-EAR', 'ORB-NOSE', 'ORB-EAR', 'COR-NOSE', 'COR-EAR', 'ZYG-MOUTH', 'ZYG-EAR'),
----> 4                           data_format='auto', date_format='mm/dd/yy', preload=True, stim_channel=True)

~\Anaconda3\envs\mne\lib\site-packages\mne\io\cnt\cnt.py in read_raw_cnt(input_fname, montage, eog, misc, ecg, emg, data_format, date_format, preload, stim_channel, verbose)
    176     return RawCNT(input_fname, montage=montage, eog=eog, misc=misc, ecg=ecg,
    177                   emg=emg, data_format=data_format, date_format=date_format,
--> 178                   preload=preload, stim_channel=stim_channel, verbose=verbose)
    179 
    180 

~\Anaconda3\envs\mne\lib\site-packages\mne\io\cnt\cnt.py in __init__(self, input_fname, montage, eog, misc, ecg, emg, data_format, date_format, preload, stim_channel, verbose)
    430         input_fname = path.abspath(input_fname)
    431         info, cnt_info = _get_cnt_info(input_fname, eog, ecg, emg, misc,
--> 432                                        data_format, _date_format, stim_channel)
    433         last_samps = [cnt_info['n_samples'] - 1]
    434         _check_update_montage(info, montage)

~\Anaconda3\envs\mne\lib\site-packages\mne\io\cnt\cnt.py in _get_cnt_info(input_fname, eog, ecg, emg, misc, data_format, date_format, stim_channel_toggle)
    317 
    318     chs = _create_chs(ch_names, cals, FIFF.FIFFV_COIL_EEG,
--> 319                       FIFF.FIFFV_EEG_CH, eog, ecg, emg, misc)
    320     eegs = [idx for idx, ch in enumerate(chs) if
    321             ch['coil_type'] == FIFF.FIFFV_COIL_EEG]

~\Anaconda3\envs\mne\lib\site-packages\mne\io\utils.py in _create_chs(ch_names, cals, ch_coil, ch_kind, eog, ecg, emg, misc)
    278             coil_type = FIFF.FIFFV_COIL_NONE
    279             kind = FIFF.FIFFV_EOG_CH
--> 280         elif ch_name in ecg or idx in ecg:
    281             coil_type = FIFF.FIFFV_COIL_NONE
    282             kind = FIFF.FIFFV_ECG_CH

TypeError: 'in <string>' requires string as left operand, not int```

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

I’d be glad to share the files we’ve been trying to import. Having the real files will be invaluable for this kind of debugging. I’ve got three sample files, all of which have been successfully imported using a custom Matlab toolbox and which are readable in Scan from the vendor’s software.

How would you like us to send them to you?