trged - Trigger Recoding

Synopsis


-----------------------------------------------------------------------------
EEP 3.1  Max-Planck-Institute of Cognitive Neuroscience 1996-99
trged 3.6   (OSF1 V4.0 alpha)                 Wed Sep 15 13:30:22 1999
-----------------------------------------------------------------------------
  trged [-d] [-u] [-s [<file>]] -f <cmd_file>|-e <cmd> ... [<trg in>]

options:
  -f <cmd_file>   file(s) containing trigger search/replace command(s)
  -e <cmd>        trigger search/replace command
  -d              put no discontinuity triggers in output
  -u              put no unmatched triggers in output
  -s [<file>]     write replacement statistics to <file>
                  (to standard error if <file> is omitted)


Some notes to the command line (this one is not typical for EEP modules):

trged can act as a pipe. If no trigger input file is given, stdin is read. Output is always sent to stdout.

The final script to be executed results from the concatenation of all commands behind a -e switch and all commands from the files indicated by a -f switch in the given order. You can have multiple -e commands and -f command files. Don't forget to protect trged commands from the shell if you supply them at command-line!

Description

trged is a search-and-replace tool for trigger code sequences in EEP trg files. It's main purpose is the response dependent recoding of the triggers which are generated by the stimulus sequence. The recoded triggers in turn are needed by the cntaverage module to distinguish the EEG epochs which corresponds to correct or uncorrect answered trials.

The discontinuity triggers "__" and "Rs", which can be generated without your control at any position during recording or evaluation, are ignored in the trigger sequence match.

Script Syntax

This is for reference. The example below is more explanative.

script
list of commands (one per line in case of command files)
command
search_sequence whitespaces replace_sequence
search_sequence
a list of regular_expressions started, separated and closed by a slash "/" character
regular_expression
a "case insensitive Extended Regular Expression (POSIX.2)" with the restriction that it must not contain slash, space or tab characters (they have a special meaning to trged and there is no quoting mechanism in the actual implementation)
whitespaces
any combination of space and/or tab characters
replace_sequence
a list of replace_expressions started, separated and closed by a slash "/" character, must have the same number of entries like the search_sequence
replace_expression
There are some restrictions concerning the script size:
max. 32 commands
max. 80 characters per command
max. 16 entries in each search/replace sequence

Example

Assume you have trial codes "12", "13", "14" followed by a response code "43". This is completely wrong since THE ANSWER is "42" (praise "Deep Thought" for finding it). So you want to change these codes to "22", "23", "24". This could be done by the following trged script:

/12/43/  /22/43/
/13/43/  /23/43/
/14/43/  /24/43/

Since the search sequence consists of regular expressions and the replace sequence supports special tags for "add a constant" and "keep unchanged", you can do the same thing with the completely equivalent command:

/1[234]/43/  /+10/&/
The long first form is self-documenting and easily understood by everyone, whereas the second one looks like a random pile of characters and is cool... Make your own choice.

Using the second form, you could write a shellscript line

cntevents -p foo.cnt | trged -e "/1[234]/43/  /+10/&/" > foo.trg
which extracts the archived triggers from the cnt file, passes them through the editing script and finally writes the recoded triggers to a file.
EEP 3.1 - MPI/ANT(eeprobe@ant-software.nl), 15.09.1999
Copyright © 1996-99 Max-Planck-Institute of Cognitive Neuroscience. All rights reserved.