Table of Contents


Name

normerp_manual - Normerp Tutorial and Manual (ERP manuals)

Description


NORMERP Tutorial Introduction and Reference Manual Jonathan C. Hansen Event-Related Potential Laboratory University of California, San Diego

Table of Contents



1. Introduction
2. Usage
3. Command Line Options
4. Normalization Parameters
4.1.  Cursors
4.2.  Cal Pulse Size
4.3.  Polarity
4.4.  Resolution
5. Interactive Use
5.1.  Entering Commands and Arguments
5.2.  (S)caling the Plot
5.3.  (N)umber of Points to Average
5.4.  (Q)uit Immediately
5.5.  (?) Help
5.6.  (O)K to Normalize
6. Errors

1. Introduction


Normerp 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 apparatus 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 of reasonable size, normerp will properly normalize all channels to the same gain and fix the resolution of the stored digital data.
One generally employs normerp with a display device so that the calibration pulses can be viewed and cursors 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 normerp 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.

2. Usage


normerp is invoked thusly:

normerp  disp_dev  in_data_file  out_data_file  [opts]

where

disp_dev is the graphics device on which one wishes to view the calibration pulses (e.g. mvc, mx).

in_data_file is the un-normalized ERPSS data file containing the input data to normerp, 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 normerp, just type normerp and a usage message will be printed.

Even though it is possible to renormalize previously normalized data, normerp 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 normerp. The in_data_file is not altered by normerp, and can thus be reused as input to normerp, 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.

3. Command Line Options


Options for normerp 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 normerp, 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:
-a lobeavgpts
The -a option causes normerp to average lobeavgpts on both sides of the cursors and the cursor itself to calculate the data values. This can reduce the error if noisy calibration pulses have been recorded. Since the argument is a count for a single side, the total number of points averaged will be 2 * lobeavgpts + 1. This parameter can also be changed in interactive mode.
-s scaleplot
One can select a magnification for the data display by supplying an integer scaleplot with this option. This factor is multiplied by the data, and the result divided by 100 when the data are displayed on the disp_dev. Since the display of data involves certain arbitrary translations and scalings in any case, and changes in the plotted data do not affect the normalization or measurements, one should select a plotting scale factor that facilitates accurate placement of the cursors and an easily viewed display. The actual scaling factor is (thus) scaleplot / 100. The use of an integer in place of an actual floating point magnification speeds the drawing calculations. The plotting scale factor can also the altered with an interactive mode command.
-f caldatafile
One can normalize one data file using the unnormalized calibration pulses from another file, caldatafile. This is useful in a number of situations, such as when the calibration pulses had to be recorded post-hoc or failed to be recorded, and one wishes to employ pulses recorded in another file.
-c calbin
Although bin 0, by convention, contains the calibration pulses in an unnormalized ERPSS data file, the enforcement of this convention is lax and it may be useful on occasion to have more than one bin containing calibration data. This -c options allows one to specify the bin which contains the appropriate calibration data. This bin, calbin, refers to the input data file, unless the -f option is in effect, in which case the specified bin in the calibration data file is used.
-n lo_cursor hi_cursor cal_size polarity resolution
This option prevents normerp from entering an interactive session, and the display device is not opened (and hence does not need to be valid). The information needed to perform the normalization is taken from the five arguments for this option, and consist of the latencies for the low and high cursors (lo_cursor and hi_cursor), the size of the calibration pulses (cal_size) as an integer, the polarity of the data (polarity) as either a + or -, and the desired resolution of the output file (resolution) as an integer number of points per microvolt. These parameters are the same as would be supplied during interactive acquisition, and hence the same considerations apply. While normerp will complain if the parameters are out of range, inaccuracy during the data normalization will occur if the parameters are not appropriate for the data at hand. Thus, care should be used when the -n is employed.

4. Normalization Parameters


Four basic parameters control the normalization of data by normerp. These are the size of the calibration pulses in the recorded data (this differs differs form 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 10 microvolts. 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 normerp 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. Normerp then multiplies the data for each channel by the corresponding normalization constant. This is repeated for each bin in the input data file, and the result placed in the output data file. The verpos element of the bin header is set to 1 or -1 depending on the specified the proper polarity to indicate that the data are normalized. 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.

4.1. 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.

4.2. 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.

4.3. 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 or not before digitization, or how the various connectors are labeled on the polygraph. If the active lead of the amplifier (e.g. vertex) was connected to the positive side of the calibration source, then if the pulses are displayed going upward on the plot, positive is up, type a 1; else negative is up, type a -1; else if the active lead of the polygraph amplifier was connected to the negative side of the calibration source, then if the pulses are displayed going upward, negative is up, type a -1; else positive is up, type a 1. This rule always works for referential recordings and, indeed, no other type of recording need be made, as the ERP 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 normerp.

4.4. 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 ERP 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 ERP programs consider the data resolution for each file separately when the data are processed, adjusting the values internally if necessary.

5. Interactive Use


In interactive use, the following sequence of steps is performed by normerp 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 -f 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 form the input data file will be transferred to the output file. At this point, normerp requests the required parameters. The data are then re-drawn with the cursor locations (along with any possible averaging of neighboring points) shown with short vertical lines, 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 normerp 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.

5.1. 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 carriage returns. 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, normerp prints a brief prompt and waits for input which must be terminated with a carraige return. If the argument is out of range, either in an absolute sense or in relation to other current parameters, normerp 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, normerp 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.

5.2. (S)caling the Plot


The size with which the unnormalized data are plotted on the display device can be changed interactively by using the s command. The argument is the same as described above under Command Line Options. The value should be chosen to maximize the utility of the plot on the display device.

5.3. (N)umber of Points to Average


The parameter, again, is the same as described above under Command Line Options. Remember that this parameter is the number of points on each side of the cursors, and hence the total number of points being averaged is twice this value plus one, centered on each cursor. One should take care that all the points being averaged together are propitiously located on the calibration pulses.

5.4. (Q)uit Immediately


This command immediately exits from normerp, removing the output file.

5.5. (?) Help


By typing a question mark, a breif description of the purpose of normerp and the various parameters is printed on the standard output.

5.6. (O)K to Normalize


When one is certain that all the parameters have appropriate values, invoke this command. Normerp will ask "Are you sure?", and, if one is sure, type Y, yes, or anything beginning with a y. Any other characters cause normerp to revert to the interactive session.

6. Errors


There are hundreds of primitive operations that can generate errors during the operation of normerp, 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 given 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 pre-mature termination with the removal of the output data file.
Three common problems should be discussed. First, to prevent inadvertent destruction of a data file, normerp will not create a data file that already exists. The solution to this is to remove it, 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, normerp 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.


Table of Contents