Docs: normerps

Introduction

Normerps (E1) is a program used to "normalize" averaged ERP data in the ERPSS format. Normalization standardizes ERPSS data files so that numerical values represent definite voltages, since the gain of recording apparatuses can vary with experimental setups as well as between channels. This normalization is performed by measuring the size of a known calibration pulse separately for each channel, and then scaling each data channel, given the desired data resolution. Normalization also establishes the polarity of the data, inverting it if necessary so that positive values represent positive voltages. Averaged data from averaging programs requires normalization prior to plotting, measurement, and other forms of data manipulation. By convention, one records calibration pulses of a known size simultaneously on all channels of a recording configuration, and averages these pulses together in bin 0 of an averaged data file.

Note that differences in gains between channels can arise at the polygraph, an analog instrumentation recorder (if employed), or any other intermediate signal processing step. Hence, it is always necessary to record calibration pulses and process them in exactly the same way as the ERPs themselves. If all the processing steps are linear operations and the calibration pulses are of reasonable size, normerps will properly normalize all channels to the same gain and fix the resolution of the stored digital data.

One generally employs normerps with a display device so that the calibration pulses can be viewed and cursors can be placed on the waveform that accurately measure the size of the pulses. If desired, one can average a number of points around the cursors to achieve higher accuracy if the pulses are noisy. The latencies for the low and high cursors is requested from the standard input; these are demarcated on the display of the data by wider traces. The size of the calibration pulses, the polarity of the data (positive or negative "up"), and the desired resolution of the output data (as a number of "points" per microvolt) are then requested. An interactive session then begins wherein one can alter various parameters relating to the normalization process and the display of the data. When satisfied that the parameters are appropriate, normalization begins.

One can also invoke normerps in a non-display, non-interactive, "silent" mode, if desired, where the required parameters are supplied on the command line. This should only be done if one is certain that the parameters are appropriate for the data at hand.

Usage

Normerps is invoked thusly:

where disp_dev is the graphics device on which one wishes to view the calibration pulses (e.g. epft, cxw), in_data_file is the un-normalized ERPSS data file containing the input data to normerps, and out_data_file is the name of the data file in which the normalized output data will be placed. If one wants a synopsis of the invocation and implemented options for normerps, just type "normerps" and a usage message will be printed.

Even though it is possible to renormalize previously normalized data, normerps employs separate input and output data files. This maneuver is designed to allow one to backtrack if valuable averaged data is accidentally clobbered by supplying invalid or incorrect parameters to normerps. The in_data_file is not altered by normerps, and can thus be reused as input to normerps, if necessary. Once one has verified that the data are properly normalized and intact, it is relatively safe to remove the unnormalized data file; doing so conserves disk space.

Command Line Options

Options for normerps are selected by supplying additional arguments on the invocation line that begin with "-". An option may have none, one, or many arguments of its own. In the case of normerps, each option has a specified number of arguments as described below. Since there is no easy way to detect omitted option arguments if more than one option is requested, be sure the invocation line is correct. Many of the options duplicate functions that can be invoked once the interactive session begins. They are available on the invocation line both so that one can, for example, view the data with a better display magnification or select the channels to be displayed at the outset, as well as so that data can be measured non-interactively with certain other options in effect.

Here are the options that are currently implemented:

Normalization Parameters

Four basic parameters control the normalization of data by normerps (E1). These are the size of the calibration pulses in the recorded data (this differs from channel to channel), the actual size, in microvolts, of the calibration pulses when the data were recorded, the polarity of the data, and the desired resolution for the data in the output file, in points per microvolt. The size of the calibration pulses in the recorded data is derived separately for each channel by measuring the data values at two cursors, hence normerps requires that five parameters be set before normalization can occur, whether it be by interactive adjustment of parameters while viewing the data, or by way of the -n invocation option.

In either case, given the normalization parameters, the absolute values of the difference between the data measured at the cursors is used, along with the specified polarity, desired resolution, and size of the calibration pulses, to determine the scaling constant for each channel. Normerps then multiplies the data for each channel by the corresponding normalization constant. This is repeated for each processing function and bin in the input data file, and the result placed in the output data file. The reference header for the output data file is updated to indicate that the data are normalized. Tips and suggestions on how to specify the normalization parameters are contained in the detailed descriptions below.

It should be stressed at this point that the actual size of the calibration pulses delivered to the recording system and the manner in which the calibration device was connected in comparison to the manner in which the subject was connected are critical pieces of information that cannot be reconstructed solely from viewing the data. Careful written records or notes about the recording from each subject are recommended. In addition to these parameters, the recording settings (e.g. filter settings, etc) and a list of abnormal events that occurred can be very helpful down the line, and can often save considerable grief later.

Cursors

Since the amplification accuracy of the data ultimately relies on the size of the calibration pulses as they are measured in the unnormalized data file, one should be careful when setting the low and high measurement cursors. The goal is to accurately assess the size of the pulse in all channels simultaneously. One should ensure that the cursors do not lie on a portion of the waveform that contains overshoot or noise. Since any high-pass filtering will cause square pulses to decay towards the baseline, usually one will attempt to get as close as possible to the leading edge of the pulse with the low cursor while still measuring the pre-pulse data value, and also attempting to stay as close to the leading edge of the pulse with the high cursor but after it has attained its active value. In some cases it may be advantageous to measure the falling edge of the calibration pulses if, for instance, the leading edges have excessive noise, artifactual contamination, or overshoot that is not present on the falling edge. Small random variations in the data values from point to point can be mitigated by averaging a number of points in the vicinity of the cursors together to obtain the data values. This can be accomplished by the -a invocation option, or selected interactively.

Cal Pulse Size

This parameter is straightforward, but its accuracy is crucial to the normalization process. One supplies the size of the calibration pulse delivered to the recording apparatus when the pulses were recorded. This value must be an integer, and since one is the smallest integer, some anticipation of this requirement may be necessary if the calibration device cannot supply arbitrary voltages.

Polarity

The question of the polarity of the recorded data can be confusing, but need not be. A simple rule will allow an accurate determination of the polarity of the data, regardless of whether interposed devices invert the data before digitization or not, or how the various connectors are labeled on the polygraph.


Polarity Rule: -

	IF: the active lead of the amplifier (e.g. vertex) was
	    connected to the positive side of the calibration source?

		IF: if the pulses are displayed going upward on the plot, 
		    positive is up, type a +... 
		ELSE: negative is up, type a -...

	ELSE IF: the active lead of the polygraph amplifier was connected
	    to the negative side of the calibration source?

		IF: the pulses are displayed going upward, negative is up,
		    type a -...
		ELSE: positive is up, type a +...

This rule always works for referential recordings and, indeed, no other type of recording need be made, as the ERPSS software allows computation of arbitrary derivations from "referential" recordings. However, if a number of "bipolar" data channels are included in the data, one should take care that they are recorded in a manner that will allow them to be properly normalized with normerps.

Resolution

The resolution with which the data in the output file will be stored is set by this parameter. It is a tradeoff between the range of voltages that can be represented in a signed 16 bit integer (-32767 to 32767), and the precision of the smallest difference in data values that can be stored. Many of the ERPSS programs employ a default value of 100 points per microvolt, allowing a data range of -327.67 to 327.67 microvolts. This is on the safe side in terms of probability of a data overflow, since even single trials will almost never be this large for scalp-recorded data, and implies a precision of .01 microvolts. A value of 500 gives .002 microvolt precision, yet still allows a range of -65.5 to 65.5 microvolts, generally plenty for averaged ERPs. Nonetheless, the resolution should be chosen according to the type of data and experiment. In any case, it is not too important as long as information is not degraded, as all ERPSS programs consider the data resolution for each file separately when the data are processed, adjusting the values internally if necessary.

Interactive Use

In interactive use, the following sequence of steps is performed by normerps after invocation. First, the input data file is opened, the output data file created, and a description of the data is printed on the standard output. If the -c option is in effect, the calibration data file is opened and checked to ensure that it has the same number of channels as the input data file. Next, the display device is opened and the data are plotted, along with a time base and descriptions of the channels. Note that if a different file is being used for the calibration pulse data, the descriptions will refer to those data, not the input data file, although the descriptions and parameters from the input data file will be transferred to the output file. At this point, normerps requests the required parameters. The data are then re-drawn with the cursor locations (along with any possible averaging of neighboring points) shown with a thicker trace, to enable easy identification of the data that would be used to determine the size of the cal pulse.

An interactive mode is then entered, where normerps accepts single-letter commands from the standard input that alter various parameters. When accepting commands, one does not need to type a return; however, when arguments or parameters are being gathered for a command, a return is needed. When one is satisfied that the parameters are correct, indicate that it's OK to normalize the data. The plot device is then closed, and the input data file is normalized and placed in the output data file. The total number of bins is then printed to indicate that normalization is complete.

Entering Commands and Arguments

In interactive mode, the five required parameters are requested from the standard input; these take values as described above in the section entitled Normalization Parameters. The interactive session then begins, and one selects various functions using single letters without carraige returns. The case of the letters is unimportant, both upper and lower case characters of the same letter have the same function. The five required parameters can, of course, be changed. However, additional commands can be invoked to perform certain optional functions or set optional parameters. When a command requires an argument, normerps prints a brief prompt and waits for input which must be terminated with a carriage return. If the argument is out of range, either in an absolute sense or in relation to other current parameters, normerps repeats the request. Whenever a parameter that affects the display of the data is changed, the plot is re-drawn. In any case where a parameter is changed, normerps prints a summary of the current values of the parameters on the standard output. If an unimplemented command is typed, a brief synopsis of the implemented commands is printed on the standard output. Here follows a detailed description of the optional commands and their functions.

Errors

There are hundreds of primitive operations that can generate errors during the operation of normerps, and a detailed description of each is not worthwhile, as most are self-explanatory. In all cases each nested routine prints the proximal cause of the error, thus giving substantial diagnostic information. Note that most errors are fatal, and cause the removal of the output data file. In addition, during execution, most signals are caught and also cause premature termination with the removal of the output data file.

Three common problems should be discussed. First, to prevent inadvertent destruction of a data file, normerps will not create a data file that already exists! The solution for this is to remove the existing file, if it is no longer wanted, or to use another name for the output data file. The second problem that can crop up is a data overflow. This can be solved by reducing the requested output resolution. Third, if the measured sizes of the calibration pulses is too small, normerps will complain. This is best corrected by increasing the gain of the amplification system during the recording session.

Except for parameters being out of range, other errors generally indicate something is seriously wrong.


NORMERPS
Tutorial Introduction and Reference Manual
Jonathan C. Hansen


© 2005 UCSD ERP Lab
Please send comments and suggestions to the ERPSS Webmaster