Hi everyone,
I got wrong in read raw file:
import mne
raw = mne.io.read_raw_edf('/home/lsp/data/osa/osa/ndx/test~test_2350dab4-c9a0-480c-8b83-83c37e8adb90.EDF', preload=True)
print(raw.info)
And it returns
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[31], line 1
----> 1 raw = mne.io.read_raw_edf('/home/lsp/data/osa/osa/ndx/test~ test_2350dab4-c9a0-480c-8b83-83c37e8adb90.EDF',preload=True)
2 print(raw.info)
File ~/.conda/envs/mne/lib/python3.11/site-packages/mne/io/edf/edf.py:1701, in read_raw_edf(input_fname, eog, misc, stim_channel, exclude, infer_types, include, preload, units, encoding, exclude_after_unique, verbose)
1699 if ext != "edf":
1700 raise NotImplementedError(f"Only EDF files are supported, got {ext}.")
-> 1701 return RawEDF(
1702 input_fname=input_fname,
1703 eog=eog,
1704 misc=misc,
1705 stim_channel=stim_channel,
1706 exclude=exclude,
1707 infer_types=infer_types,
1708 preload=preload,
1709 include=include,
1710 units=units,
1711 encoding=encoding,
1712 exclude_after_unique=exclude_after_unique,
1713 verbose=verbose,
1714 )
File <decorator-gen-889>:12, in __init__(self, input_fname, eog, misc, stim_channel, exclude, infer_types, preload, include, units, encoding, exclude_after_unique, verbose)
File ~/.conda/envs/mne/lib/python3.11/site-packages/mne/io/edf/edf.py:158, in RawEDF.__init__(self, input_fname, eog, misc, stim_channel, exclude, infer_types, preload, include, units, encoding, exclude_after_unique, verbose)
156 logger.info(f"Extracting EDF parameters from {input_fname}...")
157 input_fname = os.path.abspath(input_fname)
--> 158 info, edf_info, orig_units = _get_info(
159 input_fname,
160 stim_channel,
161 eog,
162 misc,
163 exclude,
164 infer_types,
165 preload,
166 include,
167 exclude_after_unique,
168 )
169 logger.info("Creating raw.info structure...")
171 _validate_type(units, (str, None, dict), "units")
File ~/.conda/envs/mne/lib/python3.11/site-packages/mne/io/edf/edf.py:544, in _get_info(fname, stim_channel, eog, misc, exclude, infer_types, preload, include, exclude_after_unique)
541 eog = eog if eog is not None else []
542 misc = misc if misc is not None else []
--> 544 edf_info, orig_units = _read_header(
545 fname, exclude, infer_types, include, exclude_after_unique
546 )
548 # XXX: `tal_ch_names` to pass to `_check_stim_channel` should be computed
549 # from `edf_info['ch_names']` and `edf_info['tal_idx']` but 'tal_idx'
550 # contains stim channels that are not TAL.
551 stim_channel_idxs, _ = _check_stim_channel(stim_channel, edf_info["ch_names"])
File ~/.conda/envs/mne/lib/python3.11/site-packages/mne/io/edf/edf.py:518, in _read_header(fname, exclude, infer_types, include, exclude_after_unique)
516 logger.info("%s file detected" % ext.upper())
517 if ext in ("bdf", "edf"):
--> 518 return _read_edf_header(
519 fname, exclude, infer_types, include, exclude_after_unique
520 )
521 elif ext == "gdf":
522 return _read_gdf_header(fname, exclude, include), None
File ~/.conda/envs/mne/lib/python3.11/site-packages/mne/io/edf/edf.py:862, in _read_edf_header(fname, exclude, infer_types, include, exclude_after_unique)
860 else:
861 meas_date = fid.read(8).decode("latin-1")
--> 862 day, month, year = (int(x) for x in meas_date.split("."))
863 year = year + 2000 if year < 85 else year + 1900
865 meas_time = fid.read(8).decode("latin-1")
ValueError: not enough values to unpack (expected 3, got 1)
It seems that time information in head file is wrong. How can I edit it to be read by mne? This EDF file is exported from Natus Medical Device.