Markers and Events

Last modified by Jarik den Hartog on 2024/01/25 10:23

Introduction

Measuring physiological signals, such as electrocardiography (ECG), skin conductance, blood pressure, respiration, etc. is common practice within different disciplines of social and behavioral sciences. Usually during an experiment, a participant performs a (computer) task and physiological signals are measured simultaneously. In order to analyze the physiological signals, it is necessary that the physiological signals are segmented into meaningful segments. These segments are usually created based on certain moments in the task. Markers and events signal the occurrence of these moments in an experiment. In this document markers and events are explained in more detail. Note that this document makes a clear distinction between markers and events. The definitions of markers and events are in accordance with the documentation of BIOPAC AcqKnowledge and can deviate from definitions used by other software packages.

Hardware setup

The figure below depicts a typical BIOPAC setup and illustrates how markers are sent. On the stimulus PC a task is running and stimuli are presented to the participant. Physiological signals of the participant, such as ECG, are measured and recorded by the BIOPAC hardware. The stimulus presentation software sends markers from the stimulus PC to the BIOPAC hardware, to signal certain events in the task. The BIOPAC sends its data, which includes both the physiological signals and the marker signal, to the acquisition PC. The signals are recorded and plotted by specialized software (e.g. BIOPAC AcqKnowledge). Although in this example a BIOPAC is used, a similar setup would be used when collecting physiological signals with other hardware, such as BioSemi or VU-AMS, or when eye-tracking data is collected.

Dweep.png

Markers

Markers are sent by stimulus presentation software such as OpenSesame or E-Prime, from the stimulus pc, via a marker cable (LPT, UsbParMarker, EVA) to the physiology hardware (e.g. BIOPAC or BioSemi). Markers are recorded as a continuous signal and this signal typically looks as follows:

Marker signal.png

Markers have the following properties:

  • A value (positive non-zero integer). This is the value or height of the marker.
  • Start and end. The timepoint at which the marker assumes its value is referred to as the start of a marker. When the marker releases that value is called the end.
  • Duration. The time between the start and end of a marker is the duration of the marker.
  • Occurrence (number). The same marker value can be sent multiple times, thus each marker has an occurrence.

Bits and bytes

To fully understand markers, it can be helpful to explore a bit further what markers are. Physiology hardware such as BIOPAC or BioSemi can receive markers in the form of an 8 bit (= 1 byte) digital signal. A bit is a binary digit that consists of either 0 or 1 (“off” or “on”). 8 Bits together can have the states shown in the table below. 8 Bits are equal to 1 byte of data and correspond to decimal values 0 up to 255.

Decimal notationBinary notation
000000000
100000001
200000010
300000011
400000100
500000101
600000110
700000111
800001000
25011111010
25111111011
25211111100
25311111101
25411111110
25511111111

In the stimulus presentation software (e.g. E-Prime, OpenSesame) markers are not specified in binary form (0000001, 00000010, etc.), but as ‘regular’ decimal numbers (1, 2, etc.). This decimal number is sent to the marker cable connected to the stimulus pc (see below for more info on the different marker cables). Then, the marker travels to the physiology hardware, where it is recorded as 8 separate continuous signals, each signal representing one bit (see Figure below). These 8 bit signals are converted back to one marker signal in decimal form. For BIOPAC, this conversion needs to be done in the recording software AcqKnowledge when creating a template, see here for more information on how to do this.

marker signals 8-bit.png

How to send markers

Markers are sent from stimulus presentation software at the desired times in the experiment. For instructions on how to send markers, see Sending Markers in E-Prime and Sending Markers in OpenSesame.

Marker cables

Markers are conventionally sent via the LPT port which has 8 output pins, each representing one bit. However, nowadays pc’s and especially laptops do not have an LPT port anymore. Therefore, Leiden Universities SOLO labsupport developed custom devices for sending markers that are connected via USB and use a serial interface, the UsbParMarker and Eva (used mainly in EEG labs in combination with button boxes).

In the labs of the FSW the LPT port address of the stimulus PCs can be found on a sticker on the PC.

Tips and tricks when sending markers

How markers are sent depends on the stimulus software and marker cable that are used. However, a few general tips can be given that apply to all situations:

  • Make sure that the duration of the marker is at least twice the duration of one sample. When the duration is shorter, the marker will not be recorded, and it will be impossible to analyze the data. The duration of one sample depends on the equipment that is used and the sampling rate that is specified for this equipment. For example, when a sampling rate of 1000 Hz is used, one sample has a duration of 1 ms, therefore a marker should have a duration of at least 2 ms. Usually, a duration of at least 10 ms is recommended as this allows a sampling rate of minimally 200 Hz, but make sure to increase the duration when the sampling rate is lower!
  • Following the previous point, when a marker is sent during a stimulus of which the duration is set to the participant's response, in theory, the marker duration could be shorter than the advised 10 ms when a participant responds within 10 ms. Although unlikely, this is possible. To avoid this, it is recommended to have a minimum duration of 10 ms for the stimulus, and add 10 ms to the response time.
  • Some analysis software only detect markers at their start, that is, when the marker signal changes from 0 to a non-zero positive value. Thus, for this software, it is vital that a marker is reset to 0 before another marker value is sent. Make sure that the period after a marker value is reset to 0 is also at least twice the duration of one sample (in most cases at least 10 ms). See the first point for an explanation.

Events

Events are discrete, i.e. they contain a single location in time. Thus, they do not have an onset and offset, and no duration, but instead have only one timestamp. Events are not strictly a numeric value, but can also be a string (e.g. a certain message such as “Stimulus_Start”).

Thus, events have the following properties:

  • A value (or message). This is usually a string conveying a certain message, such as “Stimulus_Start”.
  • Timestamp. The timepoint at which the label occurs in the data.
  • Occurrence (number). Because the same label can be sent more than once, a label has a certain occurrence (1st, 2nd, etc.).

Equipment and software that utilize events

Below, equipment and software is described that utilizes events and that are used frequently at the Faculty of Social and Behavioral sciences at Leiden.

AcqKnowledge

In AcqKnowledge, software used to record data from BIOPAC equipment, events can be inserted into the physiological signals. These events can be inserted during data acquisition by pressing certain hotkeys on the keyboard. When such a hotkey is pressed, the event is placed at the time of the hotkey press. An event description can then be entered. Setting these types of events in AcqKnowledge can be useful for example when an observational study is performed and the experimenter needs to keep track of certain behavioral events (e.g. participant touches face).

VU-AMS

Events are also utilized when recording data with VU-AMS. When recording data with VU-AMS, events can be inserted in a similar manner as AcqKnowledge, i.e. by pressing a button on the VU-AMS device, an event is inserted at the time of the button press. It is also possible to send events from stimulus presentation software, such as E-Prime or OpenSesame to the VU-AMS. Note that when sending events from E-Prime, the events are referred to as markers and have a value. However, they function as events, i.e. they are discrete (see E-Prime and VU-AMS for more information on how to integrate VU-AMS communication in E-Prime).

When using an EyeLink eye tracker, events can be inserted in the eye tracking data through the stimulus presentation software, such as E-Prime and OpenSesame. Here, events are also referred to as messages. A message consists of a self-chosen string such as “Start stimulus 1”.

Tobii

When using a Tobii eye tracker in combination with E-Prime, a data file (called gazedata file) is created holding the raw eye tracking data. Although it is not possible to insert typical events in this gazedata file, it is possible to track which E-Prime object was currently running. Thus, one can create a separate column in the gazedata file in which for each sample the object that was currently running is stored (e.g. “Fixation”, “Stimulus”). When processing the data it is possible to convert this column to events. This can be accomplished with for example the PhysioData Toolbox. See other documentation for more information on how to integrate Tobii eye tracking in E-Prime.

Marker (or event) table

Because markers consist of the decimal values 0 to 255 and are not very descriptive, it is recommended to make a marker table, in which each of the values is explained. This way, you will have an overview of all markers and can easily check whether all markers are correctly being sent. Of course, an event label table could be created in a similar manner. This is especially advised when the labels are not very descriptive.

Table 1 depicts a marker table of a short conflict task (e.g. a Stroop task) that consists of two test blocks (block 1 and block 2). In total, there are 16 trials (8 congruent and 8 incongruent). A trial consists of a fixation cross with a duration of 100 ms, followed by the stimulus that terminates on response and has a maximum duration of 2000 ms. The stimulus is either congruent (e.g. RED) or incongruent stimulus (e.g. RED). Responses to the stimulus can be correct, incorrect, or missing (no response within 2000 ms). Markers are sent at the start and end of each block, during the Fixation, during the Stimulus, and right after the stimulus to indicate the response.

Marker valueDescriptionOnsetOffsetDuration (ms)Total occurrences
1Start block 1Onset "BlankStartBlock"Offset "BlankStartBlock"1001
11End block 1Onset "BlankEndBlock"Offset "BlankEndBlock"1001
2Start block 2Onset "BlankStartBlock"Offset "BlankStartBlock"1001
12End block 2Onset "BlankEndBlock"Offset "BlankEndBlock"1001
21Fixation congruent trialOnset "Fixation"Offset "Fixation"1008
22Fixation incongruent trialOnset "Fixation"Offset "Fixation"1008
31Congruent stimulusOnset "StimulusSlide"Offset "StimulusSlide"StimulusSlide.RT8
32Incongruent stimulusOnset "StimulusSlide"Offset "StimulusSlide"StimulusSlide.RT8
41Correct responseAfter "StimulusSlide"After "StimulusSlide"1016
42Incorrect responseAfter "StimulusSlide"After "StimulusSlide"10
43No responseAfter "StimulusSlide"After "StimulusSlide"10

Marker and event values

How specific markers or events should be, depends on the paradigm. Usually, the same marker value or event value/message is sent multiple times. For example, in a Stroop experiment a researcher is interested in the difference between the physiological signal during the presentation of congruent stimuli and the physiological signal during the presentation of incongruent stimuli. This researcher then only needs to distinguish the congruent trials from the incongruent trials. Following the table above, epochs marking congruent stimuli are created using the onsets of all occurrences of marker 31 as the start of the epochs and the offsets of all occurrences of marker 31 as the end of the epochs. Similarly epochs marking incongruent stimuli are created using the onsets of all occurrences of marker 32 as the start of the epochs and the offsets of all occurrences of marker 32 as the end of the epochs.

Additionally, it is advised to send markers or events that are consistent. Thus, have the same set of markers or events apply to all participants, or participant groups in case of a between-subject design. Markers and events that are not consistent are for example markers that convey the current accuracy of a participant. Thus, for example, each trial a marker is sent which conveys the percentage of accurate trials (e.g. marker value 40 when the participant has an accuracy of 40%). This will result in a different set of markers for each participant. One advantage of having consistent markers or events is that you can easily check whether all markers and/or events are being sent, for example with the help of a marker table such as the table above. Another advantage is that it allows the segmentation of the physiological data of all participants, or at least a participant group, in one batch, because the same markers or events can be referenced when creating epochs.

Synchronization between multiple devices

When using multiple devices together, for example a BIOPAC and a BioSemi, or a BIOPAC and a Tobii eye-tracker, it may be necessary to synchronize the data. This synchronization can be accomplished easiest when sending the same marker or event at the same time to all devices. For example, when using BIOPAC and BioSemi, a marker can be sent through LPT to both devices at the same time. Or, when using BIOPAC and EyeLink simultaneously, a marker can be sent to BIOPAC at the same time as a message is sent to EyeLink. Be aware that when the sampling rate of the devices differ, the markers and/or events will not be placed at exactly the same moment in the different signals. This difference depends on the difference in sampling rate between devices.

It is also possible to use the markers or events of one device to segment the data recorded with another device. For this, it is necessary that either the devices are started at the same time, or that one or several synchronization pulses are sent to both devices to be able to align the data including events/markers. Note that when using multiple devices, there is a chance of drift between the signals. That is, different devices have different internal clocks that can deviate from each other over time. Depending on how critical the timing, this clock drift should be tested out before starting data collection.

Sound-Locked Markers

Certain experimental designs require that auditory events be precisely marked in the data for stimulus-locked analysis; e.g. when using facial EMG to measure sound-induced startle responses. In such situations, it may not suffice to use the task software to send a marker at the onset of the object that plays the audio, the reason being that there is generally a delay small between initiating the playback of audio, and it actually being played back. This delay is typically between 5 and 100 ms, depending on the software used, the format of the sound file, the computer system performance, etc.

To overcome this, the actual sound signal can recorded along with the EMG (and other signals) to accurately determine the onset of the auditory stimulus. This requires that the PC’s sound output be split, with one end going to the headphones or speakers, and the other to the BIOPAC.

The sound signal can then be analyzed in real time in AcqKnowledge, and transformed into a new marker channel. This channel will contain marker pulses with the same onset time as the activity in the sound signal, and each marker will take the value of the concurrent value in the "real" marker channel. This was, the "real" marker channel is used to set the marker value, and the actual sound signal is used to synchronize the marker to the auditory stimulus. This allows automatic placement of stimulus-locked response epochs in the PhysioData Toolbox (or other software packages).

Please contact SOLO if you wish to perform such an experiment.