DAT File Format

DAT files store decoded events. The DAT file format is a binary little-endian format file. It is composed of three sections:

  1. ASCII text header

  2. Binary event type and size information

  3. Binary event data

DAT File Header

DAT file header contains ASCII information and metadata associated to the DAT file. It is a sequence of “keyword, value” pairs written line-by-line. More precisely, the file header is composed of text lines starting with “%” (0x25) followed by a space (0x20), a keyword, a space (0x20), a value and New Line NL / Line Feed (0x0A).

Here is an example of DAT file header:

% Data file containing CD events
% Date 2020-09-14 14:18:29
% Version 2
% Width 640
% Height 480

Below, a table with common keyword, value pairs:





Recording Date, format: YYYY-MM-DD HH:MM:SS

Data file containing

Type of event: CD (For now, only supported type)



Format version. Currently: 2



Horizontal size of image sensor array.


Vertical size of image sensor array.

Binary Event Type and Size

This information is provided as two bytes: type and size.

The most important event types are:

  • Event2d: generic 2D event

  • EventCd: specialized Event2d for Contrast Detection (CD) event

  • EventExtTrigger: external trigger event (see documentation on Accessing External Trigger Events)

The event size is 8 for all those types.




First byte

Event type

Event2d: 0x00 (0)

EventCd: 0x0C (12)

EventExtTrigger: 0x0E (14)

Second byte

Decoded event size (in bytes)

8 (0x08)

Binary Event Data

A DAT file with CD events is made of a sequence of 64-bit (8 bytes) words stored in the following format:


The bitfield structure and the padding of the different event types can be found in the events SDK C++ headers of the Base module.

There is an header file for each event type in the SDK Base API (event_cd.h, event_ext_trigger.h etc.) that contains the structure of the raw event as encoded in a DAT file. For example for external triggers:

struct RawEvent {
         uint32_t ts;
         unsigned int p : 4;
         unsigned int pad1 : 22;
         unsigned int id : 6;

DAT File Usage

DAT file can be visualized using:

DAT file format can also be used for offline data processing. For example, we provide some scripts for data processing in MATLAB.

In case you need to convert file from or to DAT format, you can use:


Usually, data in DAT format takes more space on disk compared to RAW format, therefore, it’s preferable to use RAW format for events recording. RAW format also reduces the data rate on the USB communication, lowering the stress on the interface and the risk of introducing delays.