Next: COHERENCE(1) Up: WFDB Applications Guide Previous: BXB(1)On This Page


calsig - calibrate signals of a WFDB record


calsig -r record [ options ... ]


calsig (formerly known as calibrate) rewrites the header file for a WFDB record, setting the gain and baseline fields based on measurements it makes, and setting the units fields based on input from the user or from a calibration file. Normally, calsig is used by specifying a time interval for the measurements; best results will be achieved if the specified interval is restricted to one or more square-wave calibration pulses in each signal to be calibrated, although sine-wave pulses may be usable if the sampling frequency and/or ADC resolution is high enough.

The program constructs a smoothed amplitude histogram for each signal and identifies its two principal modes. Initially, each bin of the histogram counts the number of samples in the analysis interval for which the amplitude has a specified value. The histogram is smoothed by applying a low-pass filter that replaces the contents of each bin by a weighted sum of fifteen bins centered on the bin of interest. The two principal modes in the smoothed histogram must be separated by at least one bin with a count that is less than one-eighth the count of the larger mode. If this criterion is not satisfied for a given signal, calsig warns the user and does not adjust the gain or baseline for the affected signal.

If a signal list is specified using the -s option (see below), only the specified signals are calibrated, and the gain, baseline, and units fields for any other signals are left unchanged. Thus, if calibration pulses are not simultaneously available in all signals to be calibrated, calsig may be run repeatedly with different time intervals and signal lists.

Options include:

-c file
Obtain calibration pulse specifications from the specified file (see wfdbcal(5) ; default: obtain this information from the file specified by the environment variable WFDBCAL, or interactively).
-f time
Begin at the specified time in record (default: the beginning of record).
Print a usage summary.
Instead of using the standard method for calibration, get a ‘quick-and-dirty’ estimate by taking the signal amplitudes at the starting and ending times (as specified by -f and -t) as representative of the low- and high-amplitude phases of the calibration pulse. Use this option only if the standard method fails; the standard method is more accurate.
Use an alternate ‘quick-and-dirty’ estimate based on the range of signal amplitudes over the interval specified by -f and -t. This method may be easier to use than -q for signals with significant high-frequency content, since it does not require precise location of signal extrema. As noted above, the standard method is more accurate if it can be used.
-s signal-list
Calibrate only the signals named in the signal-list (one or more input signal numbers or names, separated by spaces; default: calibrate all signals).
-t time
Process until the specified time in record (default: 1 second after the starting time).
Ask for calibration pulse limits (default: read limits from the calibration file).


It may be necessary to set and export the shell variables WFDB and WFDBCAL (see setwfdb(1) ).

Calibration files must be located in one of the directories named in WFDB, the database path. If the environment variable WFDBCAL is set, it names a calibration file that will be read unless the -c option is used to specify a different calibration file. At most one calibration file is read; if more than one -c option is given, only the last one is effective. If the calibration file does not contain an entry for the type of signal to be calibrated, calsig obtains the information from the user interactively. If the calibration file contains two or more entries for the same signal type, only the first entry is used.

See Also

setwfdb(1) , wfdbcal(5)


George B. Moody (


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 8 March 2019