Help updating eeg info/metadata

mne version: 0.23.4
OS: Ubuntu 20.04 running in WSL

Hello! I am new to MNE and was wondering if someone could help me update my info object in a raw CNT file. My lab previously used a really old version of Neuroscan 4, and I am experimenting with moving some of our previous analysis to MNE. The data that I am reading is an extremely old Neuroscan 4 CNT file and MNE is having problems parsing the ‘meas date’ and ‘lowpass’ data:

/tmp/ipykernel_225/1044717614.py:9: RuntimeWarning:   Could not parse meas date from the header. Setting to None.
  raw = mne.io.read_raw_cnt('7001_ant_beh.cnt', preload=True)

Here is my code:

#Read cnt file

raw = mne.io.read_raw_cnt('7001_ant_beh.cnt', preload=True)

#raw.pick(['FCz'])

raw.load_data()

Raw CNT info:

<Info | 8 non-empty values
 bads: []
 ch_names: O2, O1, Pz, P4, P8, C4, T8, P7, P3, Cz, C3, Fz, F4, F8, T7, F3, ...
 chs: 34 EEG
 custom_ref_applied: False
 highpass: 0.0 Hz
 lowpass: 250.0 Hz
 meas_date: unspecified
 nchan: 34
 projs: []
 sfreq: 500.0 Hz
 subject_info: 5 items (dict)

I managed to get the correct meas date by first exporting the CNT file to EDF in Neuroscan:

<Info | 7 non-empty values
 bads: []
 ch_names: O2, O1, Pz, P4, P8, C4, T8, P7, P3, Cz, C3, Fz, F4, F8, T7, F3, ...
 chs: 34 EEG
 custom_ref_applied: False
 highpass: 0.0 Hz
 lowpass: 70.0 Hz
 meas_date: 2005-03-15 12:34:31 UTC
 nchan: 34
 projs: []
 sfreq: 500.0 Hz

Now I am trying to figure out how to update the meas date in the CNT. The reason why I want the CNT file is that it contains all my annotations, and when I export to EDF in Neuroscan those annotations are removed.

The MNE documentation says:

All other entries should be considered read-only, though they can be modified by various MNE-Python functions or methods (which have safeguards to ensure all fields remain in sync).

I believe this also refers to the ‘meas_date’ entry. Can someone please show me the proper way to update the info ‘meas_date’ entry?

Thanks so much!
Jacob

Hello,

In read_raw_cnt, there is a parameter date_format. Maybe the date stored in your file does not match the default format 'mm/dd/yy' and thus it can not be read. You can try to change this format to read the header correctly.
If you can not, you can set the measurement date of a continuous Raw recording with the method set_meas_date.

Mathieu

2 Likes