ils-labs-dev

How-tos

How to send markers/triggers from ZEP (EEG)

Last updated on 8 December 2017 by Chris

If you have suggestions on how to improve this document, or find mistakes, please send them to labman.gw@uu.nl

Introduction

Using markers during electroencephalography (EEG) helps to identify specific events in your data. When analyzing data the markers become crucial for synchronizing epochs or identify responses. It is of paramount importance that these markers are very precise; any jitter reduces the quality of your data. The accuracy of markers is of less importance. Markers are generally added by triggering output-lines of a parallel port that outputs from the stimulus-presentation equipment to the EEG-recording equipment.

When using Zep (2.x) for stimulus presentation during EEG it is relatively simple to add markers to your recording. Adding markers/triggers can be done by using the custom-built Zep-marker module. This Zep module is maintained on a repository on GitHub. It requires the use of Zep 2.x and the presence of a parallel port. This how-to assumes you already have a Zep-scripted experiment that needs only the addition of markers as a finishing touch but is otherwise ready-to-go.

This module’s performance in precision and accuracy of markers has been tested against that of Presentation©. The tests suggested that Zep performs equally well or even better.

Open the latest-release page on the GitHub repository. Download the ZEP-Markers-Module-X.X.zip by clicking on ‘Source code (zip)’ of the latest release.



Unpack the zip archive you previously downloaded and then copy the files zep_markers.zm and zep_markers_settings.zm to the modules/ folder in your experiment’s directory:



Firstly, import the module in the top-level Zep script (.zp file) by adding the line import zep_markers;:



Secondly, after setting up the presentation of a stimulus within your experiment script add the following function call:

setup_marker_at( marker, tref );

With marker being the integer you want to send and tref being the (expected) time the event you want to mark will start:



The best way to mark a participant response is to add a fixed delay (10~20 milliseconds) between the response of the participant and the setup onset of the marker. For example, when receiving a response at time X (e.g. an event_time in Zep) use setup_marker_at( 1, event_time + 20ms ) to mark the response. Using send_marker( 1 ); would be more accurate but less precise. This is because of a small but variable latency between the time of response registration and the time that Zep actually handles response event. In EEG precision is everything.
Sending a marker as explained below will result in unreliable marker/trigger timing and should be used with caution!

Use the following function call for sending out a marker as quickly as possible:

send_marker(marker);

This call will setup a marker to be sent as quickly as possible. Because of internal logistics there is a minimum setup time required before sending the marker. This setup is determined by the sum of SCHEDULER_PRE_EMPT and SCHEDULER_PRE_EMPT_ERROR_TOLERANCE variables from the settings. Using the default settings in zep_markers_settings.zm this minimum is 7.5 milliseconds.