SEEG (.edf) file truncated and missing annotations

Hi all, I am new to working with MNE-Python, and am trying to visualize an .edf file containing ~27 hours of SEEG (day 1: ~ 22 hours, day 2: ~ 5 hours) with many event markers/annotations. The recording was acquired through Natus in the .stc file format, then converted to .edf.

When MNE plots the data, the channels are labeled and displayed correctly, and the EEG matches well with what I see when viewing the same .edf file in Persyst. However, only 2 of the many annotations I see in Persyst are showing up in the MNE plot.

Additionally, I am seeing that MNE thinks the recording length is 00:48:58 (HH:MM:SS). This is also the timeframe being plotted. I have confirmed using Persyst that there are still additional annotations within this time range that, other than the 2 mentioned above, are not being displayed in the MNE plot.

I am working in a Jupyter notebook in VS Code using an MNE kernel:

  • MNE version: 1.6.1
  • Python version: 3.11.5
  • operating system: macOS 13.4.1
import mne

# Load the EDF file

file_path = '/Users/adam/Desktop/EMUdataSEEG.EDF'

raw =, preload=True)

# Info about the data


# Plot the SEEG data



Can you show the output of mne.count_annotations(raw.annotations)?

Thanks for your reply. Here is the output:

These are in fact the 2 annotations which are plotted by MNE.

Try to load your EDF with edfio, so we can be sure the annotations are really present in the file. If not, something went wrong during the export.

The following returns 162 annotations, which is more along the lines of what I would expect for this file, and my memory of what I was able to see using Persyst:

from edfio import read_edf

# Load EDF file
edf_reader = read_edf("/Users/adam/Desktop/EMUdataSEEG.EDF")

# Access annotations
annotations = edf_reader.annotations

# Print the total number of annotations
print(f"Total number of annotations: {len(annotations)}")

# Print all annotations
for ann in annotations:
    onset, duration, description = ann
    print(f"Onset: {onset}, Duration: {duration}, Description: {description}")

The annotations printed begin with the same 2 that MNE has been plotting, followed by 160 additional annotations; the first of these is timestamped at 5583 seconds. This is outside of the time range that MNE is recognizing as the recording length: (00:48:58; HH:MM:SS), or 2938 seconds.

I need to double-check using Persyst whether there were more than these 2 annotations in the first 3000 seconds. Regardless, the efio output leads me to beleive the main problem is MNE only reading the .edf file out to 00:48:58.

I think this is by design. MNE does not retain annotations outside the data range. But since you already used edfio to get all annotations, you can probably continue to work with that instead. If MNE is not deducing the recording duration correctly, please let us know.

It does appear MNE is not correctly identifying the length of the recording, which is over 24 hours long. Only the first ~49 minutes are being read in.

1 Like

This sounds like it could be a bug (even though reading the entire file in memory would probably not work in most computers anyway, unless you have 64GB of RAM).

I think you should report this on our issue tracker, but we’ll probably need access to the file to find out what’s wrong with our code.

1 Like

Might be making progress here. I checked with the clinician who exported the file and they segmented clips out of the total 27 hour recordings. Windowing through the data on MNE I have found the small gaps between clips. I need to check with Persyst again to make sure that this is also the case when loaded in that system, as the original timestamps (e.g., day 1, hour 22) were recognized last time I viewed it in Persyst. I thought it was continuous at the time, but that may not be the case.

This leads me to believe MNE is loading the 49 minutes of recording clips in starting at an arbitrary zero start time, with all the successive clips being timestamped in seconds relative to the “zero” start time, and not their true time stamps which are in fact present in the .edf file as demonstrated by Persyst.

It seems that the annotations are retaining their true time stamps, which may be why MNE is reading them as “outside data range”, as the time stamp is greater than the 2938 seconds of total recording time in the file.

Alright, this is indeed interesting. Just out of curiosity, can you open the file with EDFbrowser? Also, I wonder if the file is EDF+D, which stores non-contiguous data segments.