import mne
import matplotlib.pyplot as plt
filename = non_excluded_data['Filename'].iloc[0]
filepath ="../datasets/raw/PSG/case03_sub102.EDF"
raw = mne.io.read_raw_edf(filepath, preload=False)
print(raw.info)
duration_seconds = raw.n_times/raw.info['sfreq']
print("Duration (s) : ", duration_seconds)
outputs
Extracting EDF parameters from /home/jovyan/Lucid-Dream-Detection/datasets/raw/PSG/case03_sub102.EDF...
EDF file detected
Setting channel info structure...
Creating raw.info structure...
<Info | 8 non-empty values
bads: []
ch_names: Fpz, Fz, Cz, Pz, Oz, Fp1, Fp2, F3, F4, C3, C4, P3, P4, O1, O2, ...
chs: 27 EEG, 1 Stimulus
custom_ref_applied: False
highpass: 0.0 Hz
lowpass: 500.0 Hz
meas_date: 2021-06-07 15:17:04 UTC
nchan: 28
projs: []
sfreq: 1000.0 Hz
subject_info: 3 items (dict)
>
Duration (s) : 805.0
/tmp/ipykernel_80/2266911936.py:7: RuntimeWarning: Number of records from the header does not match the file size (perhaps the recording was not stopped before exiting). Inferring from the file size.
raw = mne.io.read_raw_edf(filepath, preload=False)
Along with this error, the printed duration isnβt correct since the actual duration is 1050 seconds.
Things that I have tried:
- Opened the file in EDFBrowser, which worked correctly. I saw the full length of the data.
- Ran a check on EDF compliance and that stated that there was no issue with the EDF file.
- Made a trivial annotation and exported the file again, which did not help.
Any help on how to fix this file would be greatly appreciated.
Here are my system details:
Platform Linux-5.15.0-124-generic-x86_64-with-glibc2.35
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Executable /usr/bin/python
CPU x86_64 (128 cores)
Memory 4031.7 GB
Core
ββ mne 1.8.0 (latest release)
ββ numpy 1.24.3 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
ββ scipy 1.14.1
ββ matplotlib 3.9.3 (backend=module://matplotlib_inline.backend_inline)
Numerical (optional)
ββ pandas 2.2.3
ββ unavailable sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py
Visualization (optional)
ββ ipywidgets 8.0.6
ββ unavailable pyvista, pyvistaqt, vtk, qtpy, ipympl, pyqtgraph, mne-qt-browser, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional)
ββ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
None
The file in question is here: case03_sub102.EDF