User Reference:GDFFileWriter

From BCI2000 Wiki
Jump to: navigation, search


The GDFFileWriter component writes out data in the GDF File Format.

In addition to the parameters provided by the EDFFileWriter, the GDFFileWriter provides an option to define mappings between state variables and GDF events.


Common Data Storage Parameters

These are storage parameters common to all Data File Formats.


Path to an existing directory. Recorded data will be stored below that directory. The path may be absolute, or relative to the source module's working directory at startup. Usually, the working directory at startup matches the source module's executable location in the prog directory.


A textual ID for the subject. This text will appear in session directories, and data file names.


A textual ID for the current session. Sessions correspond to data directories. The path of a session directory is constructed according to



A number indicating the current run. Runs correspond to data files. To avoid accidental loss of data, run numbers are auto-incremented to the largest unused value. Within a session directory, data file names are constructed according to


A data file's extension depends on its File Format.

ID_System, ID_Amp, ID_Montage

These parameters are provided for documentation purposes and may contain arbitrary text.


Determines whether a BCI2000 parameter file is saved along with the GDF file. As of version 2.1, GDF is able to represent BCI2000 parameters, and parameter information is no longer lost if SavePrmFile is switched off. This parameter is optional, and will not appear in the parameter configuration dialog by default. To use it, specify --SavePrmFile=1 on the command line when starting up the source module.

GDFFileWriter Specific Parameters


Year the subject was born, in YYYY format.


An enumerated value specifying the subject's sex:

  • 0: not specified,
  • 1: male,
  • 2: female.


A string describing the transducer (sensor) type, e.g. EEG: Ag/AgCl.


A string specifying the physical unit of the calibrated signal. Differently from the notation used throughout the rest of BCI2000, this is usually "uV" rather than "muV".


A string identifying the equipment provider. Since GDF version 2.0, the equipment ID field has been 8-byte numeric rather than string-valued. Consequently, the EquipmentID parameter is treated as an integer value, and written into the numeric field. If the parameter string evaluates to 0 -- e.g., because it begins with a letter rather than a digit -- its first 8 bytes are copied into the numeric equipment ID field in a byte-wise manner. Remaining bytes are padded with zero bytes if the parameter's string representation contains fewer than 8 characters.


BCI2000 does not prescribe the meaning of its state variables. GDF, on the other hand, associates a fixed set of events with certain numeric codes. Thus, a general mapping of BCI2000 states onto GDF events is not possible. Instead, GDF events are created via a user-defined set of mapping rules in the EventCode parameter, which also has a set of rules predefined for the most important cases.

The EventCodes parameter is a two-column matrix, with each row associating a boolean expression with a hexadecimal event code as defined in the GDF File Format. The expression is evaluated for each data block. Whenever its value switches from "false" to "true", the GDF event code from the second column is entered into the GDF event table; whenever its value switches back from "true" to "false", the same event code is entered into the table but with the most significant bit set to 1 (bitmask 0x8000).

The default value of the EventCodes parameter defines the most common mappings between BCI2000 states and GDF event codes:

Condition Code GDF Event
TargetCode!=0 0x0300 trial begin
TargetCode==1 0x030c cue up
TargetCode==2 0x0306 cue down
(ResultCode!=0)&&(TargetCode==ResultCode) 0x0381 hit
(ResultCode!=0)&&(TargetCode!=ResultCode) 0x0382 miss
Feedback!=0 0x030d feedback onset

In addition to GDF events, BCI2000 state variables will be mapped to additional signal channels the same way as for EDF.



See also

User Reference:DataIOFilter, User Reference:Data File Formats