Skip to main content

Step 4 – Artifact rejection and response averaging

Once the continuous raw signals have been converted into the ELAN .eeg file format, and the event codes have been extracted in the .pos file (via the program eegpos), it is possible to compute the average evoked potentials (EP) of interest using the command line:

eegavg myeegfile.eeg myeegfile.pos myparfile.par myeegfile.rej.pos +v

The parameters necessary for artifact rejection and EP averaging must be specified in a .par texte file. These parameters include:

  • the number and list of event codes defining the EPs to average,
  • the numbers of time samples in the pre- and post-stimulus periods (for each event code),
  • the start and stop latencies for baseline correction (for each event code),
  • the list of channels to be averaged,
  • the list of maximum and minimum threshold values (or other criteria) for amplitude artifact rejection (per channel)… (See eegavg for more detailed information).


Each line of the .par text file begins with a label specifying the type of parameter followed by the user’s parameters. For example, in the case of an odd-ball paradigm in which the standard stimuli had trigger code 10 and targets had code 20, the myparfile.par file used to compute the EPs to standards and targets (with a 100-ms prestimulus baseline correction and artifact rejection for any signal exceeding ± 80 μV at any electrode) will have the following form:

(label)                          (parameters)  (comments)
fileprefix                      myepfile       prefix of the output .p files
nb_eventcode                2                  nb of event codes to process
list_eventcode              10 20             list of event codes to process
prestim_nbsample         200 200         nb samples in the pre-stim period; one val./evt code
poststim_nbsample        800 800         nb samples in the post-stim period; one val./evt code
baseline_eventcode       10 20             list of the event codes used to compute the baseline
baseline_msec_start     -100 -100        baseline start latencies (ms); one val./evt code
baseline_msec_stop        0 0               baseline stop latencies (ms); one val./evt code
ep_channel_flag             1 1 1 1 0 0    list of the channels to average
ep_channel_rejtype        1 1 1 1 0 0    rejection types per channel: 0,1 or 2
rej_max_val                   80 80 80 80 0 0
rej_min_val                   -80 -80 -80 -80 0 0

This structure of the .par file allows to compute a set of ERPs with a great flexibility in the choice of the parameters (rejection criteria, baseline corrections…). See the complete list of labels and possible parameters of the .par file in eegavg.

The outputs of the eegavg program are:

  • the evoked potentials (.p) files (one .p file by event code), with the names formed by the prefix specified in the .par file (‘fileprefix’ label), and extension formed by the event code,
  • a new .pos text file (e.g. .rej.pos file) containing the positions of events whose the codes are specified in the .par file (‘list_eventcode’ label), with the rejection status ‘0’ for the non-rejected event codes, or ‘8’ for rejected codes.

Thus in the example above, the eegavg program will use as input files:
      myeegfile.eeg, myeegfile.eeg.ent, myeegfile.pos, myparfile.par
It will create as output files:
      - Two .p files (myepfile.10.p, myepfile.20.p),
      - A new myeegfile.rej.pos file containing the following information:

6745    10   0
7785    10   0
8765    10   8
9745    20   0
10755   10   0
11775   10   8

This new .pos text file can again be easily processed for event recoding… (see Event Processing tools).