DBCAL(5)

NAME
dbcal - ECG database calibration file format

DESCRIPTION

Programs compiled using the DB library (see db(3)) require calibration data in order to convert between sample values (expressed in analog-to-digital converter units, or adus) and physical units. Calibration files specify the physical characteristics of calibration pulses that may be present in various types of signals, and specify customary scales for plotting these signals. calibrate(1) reads the signal file(s) for a record, measures the size of the calibration pulses it finds in adus, and uses specifications from a calibration file to determine adu-to-physical unit conversion parameters, the `gain' and `baseline' fields that it writes back into the header file for the record. Other programs, such as pschart(1), make use of the `gain' and `baseline' fields from the header file to determine how to convert adus into physical units, and use customary scale specifications from a calibration file to determine how to convert physical units into units of length on a printed page or on-screen. Most users will find that a single calibration file, perhaps a system-wide default, can be used with all of their DB records.

Calibration files are line-oriented text files. Lines are separated by a carriage-return/line-feed pair. Each type of signal to be calibrated is described by a one-line entry. The format of each entry is:
    DESC<tab>LOW HIGH TYPE SCALE UNITS
where DESC is a string, possibly containing embedded spaces but not tabs, taken from the signal description field of the header file entry for signals of the desired type; LOW and HIGH are the physical measurements that correspond to the low- and high-amplitude phases of the calibration pulse; TYPE specifies the shape of the calibration pulse (`sine', `square', or `undefined'); SCALE specifies the customary scale in physical units per centimeter; and UNITS is a string (without embedded whitespace) that specifies the physical units of the signal (e.g., `mV', `mmHg', `degrees_Celsius'). If LOW is `-', the signal is AC-coupled, and HIGH is taken as the peak-to-peak amplitude of the calibration pulse. LOW must be defined (i.e., must not be `-') for DC-coupled signals. If HIGH is `-', the size of the calibration pulse is undefined.

Lines that begin with `#', empty lines, and improperly formatted lines are treated as comments and ignored.

The DB library function getcal, used by programs such as calibrate(1), dbplot(1), and psfd(1) to obtain calibration data from a calibration file, returns the first entry that matches a signal's description and units. A calibration file entry is considered to match a signal if the DESC field is either an exact match or a prefix of the signal description as given in the header file, and if the UNITS field in the calibration file is an exact match of the units field in the header file. By making use of these two rules, it is possible to write a calibration file that contains entries for several specific cases followed by a `catch-all' case for which the DESC field contains only the common prefix.

Note that SCALE specifications are advisory, not mandatory. The intended use of SCALE is to specify the customary size for signals, and the relative sizes of signals of varying types. When determining a SCALE for a signal type for which there is no customary scale, a good rule of thumb is that the typical short-term range of variation of the plotted signal should be on the order of one centimeter; keep in mind that it may be useful to make measurements on plots, however, and choose a scale that makes such measurements easy to perform. Programs that draw signals at non-standard scales should generally adjust the scales for all signals by the same factor, unless the user specifies otherwise.

  Examples
    # A simple example of a calibration file
    ECG    - 1 sine 1 mV
    NBP    0 100 square 100 mmHg
    IBP    0 - square 100 mmHg
    Resp    - - undefined 1 l
In this example, the first line is a comment. The second line specifies that signals whose descriptions begin with `ECG' are AC-coupled, have units of millivolts (mV), have 1 mV (peak-to-peak) sine-wave calibration signals, and are customarily drawn at a scale of 1 mV/cm. The third line specifies that signals of the `NBP' type are DC-coupled, have units of millimeters of mercury (mmHg), square-wave calibration signals that go from 0 to 100 mmHg, and are customarily drawn at a scale of 100 mmHg/cm. The fourth line specifies that signals of the `IBP' type are DC-coupled (since LOW is specified), also have units of mmHg, and are customarily drawn at a scale of 100 mmHg/cm, but that calibration pulses may vary in amplitude. The last line specifies that `Resp' signals are AC-coupled (since LOW is not specified), have calibration pulses of variable size and shape, and have units of liters [l].

An entry of the form:
    ECG lead I    - 1 sine 1 mV
matches `ECG lead II' as well as `ECG lead I', because of the prefix rule (see above). If `ECG lead I' and `ECG lead II' were to require different calibrations for some reason, an entry of the form:
    ECG lead II    - 2 sine 1 mV
should be inserted before the entry for `ECG lead I'.

ENVIRONMENT
Programs compiled with the DB library use the environment variable DBCAL to determine the name of the calibration file. Calibration files must be located in one of the directories named by the environment variable DB (see setdb(1)).

BUGS
Support for calibration files in this format was added to the DB library in version 6.0. Programs compiled with earlier versions of the DB library must be modified and recompiled in order to use the features described above.

SEE ALSO
calibrate(1), setdb(1), header(5)
ECG Database Programmer's Guide