question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
biancaisla1commented, Jun 19, 2019

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?

0reactions
agramfortcommented, Jun 21, 2019

Glad it works !

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's new — MNE 1.2.2 documentation
Fix bug in mne.io.read_raw_bti() where EEG, EMG, and H/VEOG channels were not detected properly, and many non-ECG channels were called ECG.
Read more >
Working With Additional Files - BESA® Wiki
In Binary Format all channels (scalp, intracranial, polygraphic, MEG) and file events in the selected time range are exported.
Read more >
b. Events - EEGLAB Wiki
Events can be imported into EEGLAB by selecting the File → Import event info ... A value of NaN (MATLAB for not-a-number) indicates...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
systemPrefs with at least two files" status:RESOLVED resolution:OBSOLETE ... Bug:90687 - "app-emulation/bochs: ebuild does not support pci nor pcidev linux ...
Read more >
This is a text file named "Readme - Biometric Research Program
Fixed a bug in the general format importer where there were a large number of samples. Changes and Bug Fixes since Last 4.5.0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found