[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6 Calibration Functions

Functions in this section are used to determine specifications for calibration pulses and customary scales for plotting signals. All of them make use of the calibration list, which is maintained in memory and which contains entries for various types of signals.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

calopen

 
int calopen(char *file)

Return:

0

Success

-1

Failure: insufficient memory for calibration list

-2

Failure: unable to open calibration file

This function reads the specified calibration file (which must be located in one of the directories specified by WFDB, see section The Database Path and Other Environment Variables) into the calibration list. If file is NULL, the file named by WFDBCAL is read. Normally, the current contents of the calibration list are discarded before reading the calibration file; if file begins with ‘+’, however, the ‘+’ is stripped from the file name and the contents of the file are appended to the current calibration list. If file is ‘-’, calopen reads the standard input rather than a calibration file. (This function was first introduced in WFDB library version 6.0.)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

getcal

 
int getcal(char *desc, char *units, WFDB_Calinfo *cal)

Return:

0

Success; *cal contains the requested data

-1

Failure: no match found

This function attempts to find calibration data for signals of type desc, having physical units as given by units. If successful, it fills in the contents of the WFDB_Calinfo structure (see section Calibration Information Structures) pointed to by cal. The caller must allocate storage for the WFDB_Calinfo structure, and must not modify the contents of the strings addressed by the sigtype and units fields of the WFDB_Calinfo structure after getcal returns. getcal returns data from the first entry in the calibration list that contains a sigtype field that is either an exact match or a prefix of desc, and a units field that is an exact match of units; if either desc or units is NULL, however, it is ignored for the purpose of finding a match. getcal cannot succeed unless the calibration list has been initialized by a previous invocation of calopen or putcal. (This function was first introduced in WFDB library version 6.0.)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

putcal

 
int putcal(WFDB_Calinfo *cal)

Return:

0

Success

-1

Failure: insufficient memory

This function adds the WFDB_Calinfo structure pointed to by cal to the end of the calibration list. (This function was first introduced in WFDB library version 6.0.)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

newcal

 
int newcal(char *file)

Return:

0

Success

-1

Failure: unable to open file

This function creates a new calibration file (in the current directory) containing the contents of the calibration list (which is not modified). file must satisfy the standard conditions for a WFDB file name, i.e., it may contain letters, digits, or underscores. (This function was first introduced in WFDB library version 6.0.)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

flushcal

 
void flushcal()

This function discards the current calibration list and returns the memory that it occupied to the heap. Note that wfdbquit does not perform the function of flushcal. (This function was first introduced in WFDB library version 6.0.)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

George B. Moody (george@mit.edu)