Table of Contents


avg - ERP raw data signal averager


avg presampling avgfile [options]


avg performs signal averaging on ERP raw data. Three files must be specified after the program has been invoked: a raw data file, a log file (both obtained from the dig(2) program), and a binlist file (most often obtained using the cdbl(1) program). More than one set of raw, log, and binlist files may be averaged together. Presampling specifies the length in milliseconds of the pre-stimulus portion of the epoch; it cannot exceed 256 times the sampling period (at the sampling rate used during digitization) and must be greater than or equal to the onset delay specified at digitization time. Note that presampling represents the total prestimulus period desired, including the onset delay (from trigger to stimulus). The averaged data are written to avgfile.

The options are:

-a arfile
Perform artifact rejection using the tests specified in arfile. For more information on artifact rejection and the format of this file, see the garv(1) man page.

Mark the associated log file during averaging to denote events which were not included in the averages due to data error, and due to artifacts if the -a option is specified. These events are marked by setting the log flag 0100 (octal) for data errors, 040 (octal) for events rejected by any of the artifact rejection tests, and 020 (octal) for events rejected specifically by the polinv polarity inversion test (note that for polinv rejected events, both the 040 and 020 flags are set, which for example results in 60 being displayed in the ’Flags’ column of the logexam(1) output).

Artifacts rejected by the polarity inversion test (i.e. blinks) are given special treatment because they are the only type of artifact that can be corrected. When avg runs with the -a option, events with polinv artifacts are excluded from the bin averages along with events containing other artifacts as specified by the tests in the artifact rejection file. However, if avg is also run with the -b option, the blinks can be corrected later with blinkcp(1) . In this case, the polinv rejected events will be corrected and included in the corrected bin average. Giving polinv artifacts a unique log flag allows these blink events to be identified. This can be useful, for instance, if one wishes to compute behavioral measures based only on EEG events that were not rejected. Before applying blinkcp(1) , the polinv events are rejected, after blinkcp(1) they are not: the polinv log flag allows you to keep track of these events.

When the -x option is specified, the log file is processed to clear the above flag bits prior to averaging. If the -x option is not used, the log file is read only to ascertain that the data file, logfile, and binlist files belong together and to detect mismatches. In this case the log entries corresponding to the events that are rejected remain as they were, and the bits are not cleared prior to processing.

Note that only events selected for averaging are tested for data error or artifact rejection, so when using the -x option only the events rejected from this set are marked in the log file.

-r dec_factor
Decrease the sampling rate of the data (decimate) by an integral factor of dec_factor as they are extracted from the raw file.

This is one way to enable the average of long epochs, but be aware of the resulting loss of resolution in the waveform - specifying a dec_factor of 2 will effectively reduce 250Hz sampled data to 125Hz sampled data.

Also see the -c option for enabling the average of long epochs.

-c chan_prec
Instead of employing 256 points in each averaged epoch, use chan_prec * 256, thus increasing the epoch length (as well as the amount of space needed).

This is one way to enable the average of long epochs, but be aware of the increase in the size of the average file - doubling the size of the epoch will pretty much double the size of the average file.

Also see the -r option for enabling the average of long epochs.

Calculate standard error and store it as a second dataset, or processing function, in avgfile. The ploterps_manual(7) gives an example of how to access and plot the standard error data from this second dataset created in avgfile. The ability of erp average files to store multiple datasets, or processing functions, was never really exploited; this option may be the only use of this facility in the erp programs.

-o outfile
Print stats such as mismatches to outfile as well as to the screen.

-b blinkfile
Create the file blinkfile for subsequent use by the blinkcp(1) program. This file contains averages for the epochs that were determined to contain blink artifacts by the polinv artifact rejection test (see garv(1) ). When using the -b option, you must also use the -a option, AND the artifact rejection file must invoke the polinv artifact rejection test.

Work quietly.

-f filt_type cutoff [cutoff]
Filter the data (before artifact rejection), where filt_type is one of lp (lowpass), hp (hipass), or bp (bandpass). The lowpass and hipass filters require a cutoff frequency to be specified; the bandpass filter requires both low cutoff and high cutoff frequencies to be specified. Use of this option is generally discouraged, but it can be useful in special cases such as cleaning data contaminated by 60Hz noise. Also, it is recommended that the resulting average file name be chosen so that it somehow reflects the fact that the data contained in it are filtered.

If all is well following invocation, avg will print out:

Enter raw, log, and bin list filenames...

As long as there remain files to be averaged, specify them here. When averaging is complete, a summary of the various bins and certain data parameters is printed on the standard output.

See Also

dig(2) , garv(1) , blinkcp(1) , avg_manual(7) , ploterps_manual(7) , erp_overview(7) , garv_manual(7)


Too many too list here, most are explained in the "avg User’s Manual".

Table of Contents