๐Ÿ–‡๏ธ EDF Info

๐Ÿ–‡๏ธ EDF Info#

Extract Information from EDF Files#

The edfinfo() function in etformat allows users to extract detailed information from an EDF (Eye Data Format) file. It retrieves and displays essential metadata, including:

  • Eye-tracking sampling rate

  • Pupil measurement type

  • Recording mode and type

  • Screen resolution

  • EyeLink version and camera details

  • Calibration type and recording date

This function is useful for verifying EDF file metadata before processing.

How to use it?#

if you have not installed etformat yet, you can install it using the following command:

!pip install etformat

if you have installed etformat, you can use the following code to extract information from an EDF file:

import etformat as et
๐Ÿ“– etformat 1.1.1 - For Documentation, visit: https://ahsankhodami.github.io/etformat/intro.html

To read edf file information you can use the following code:

et.edfinfo(r"D:\Github_web_page_website\test.EDF")
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
Cell In[2], line 1
----> 1 et.edfinfo(r"D:\Github_web_page_website\test.EDF")

File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\etformat\edfinfo.py:29, in edfinfo(edf_file_path)
     26     return
     28 # Load EDF file
---> 29 edf = EDFFile(edf_file_path, loadevents=True, loadsamples=True)
     31 if edf.recordings.empty:
     32     print("โš ๏ธ No recording information found in the EDF file.")

File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\etformat\edffile.py:103, in EDFFile.__init__(self, filename, consistency, loadevents, loadsamples, sample_fields, start_marker_string, end_marker_string, parse_events, wide_variables, trigger_marker, verbose, libpath)
    101 data_type = self._edfapi.edf_get_next_data(self._file)
    102 while data_type != EDF_NO_PENDING_ITEMS:
--> 103     allf_data_ptr = self._edfapi.edf_get_float_data(self._file)
    104     if data_type in EDF_EVENT_CODES.keys():
    105         # trial start
    106         if data_type == EDF_EVENTS["MESSAGEEVENT"] and \
    107            allf_data_ptr.contents.fe["message"].startswith(start_marker_string):

KeyboardInterrupt: 

Tip

edfinfo reads whole EDF file if it is not preloaded into the memory. If you have a large EDF file, it may take some time to read the whole file. In such cases, you can use the preload parameter to load the EDF file into memory before reading it.