|Next: PARSESCP(1) Up: WFDB Applications Guide Previous: NGUESS(1)||On This Page|
Each ECG (or other) signal is paired and combined with a noise signal.
A gain (a, a multiplicative scale factor) to be applied to the noise samples
is set independently for each clean signal. If there are fewer noise signals
than ECG signals, noise signals are paired with more than one clean signal
as necessary. For example, if there are three clean signals and two noise
signals, they are paired and combined as follows:
output signal 0 = clean signal 0 + a * noise signal 0 + b
output signal 1 = clean signal 1 + a * noise signal 1 + b
output signal 2 = clean signal 2 + a * noise signal 0 + b
The initial values of the gains, a, and offsets, b, are zero for all signals (i.e., no noise is added). In the protocol annotation file, the time field of each NOTE annotation specifies when gains are to be changed, and the aux field specifies new values for the gains (in scanf(3) %lf format, beginning with a; values are separated by white space within the aux field). The offsets, b, are recalculated at these times to cancel out step changes in signal levels when gains are changed. During the intervals between NOTE annotations in the protocol annotation file, gains and offsets are fixed.
If no protocol annotation file is specified, nst generates one using a standard protocol (a five-minute noise-free ‘‘learning period’’, followed by two-minute periods of noisy and noise-free signals alternately until the end of the clean record). The gains to be applied during the noisy periods are determined in this case by measuring the signal and noise amplitudes (see Signal-to-noise ratios, below).
Generation of the output signals ends at the time of the last NOTE annotation in the protocol annotation file, or at the end of the clean record, whichever comes first. If the noise record ends before that time, nst ‘rewinds’ the noise record to the beginning as necessary to obtain additional noise samples.
If a non-standard protocol is needed, it is probably easiest to run nst without the -p option to obtain a standard protocol annotation file. The standard file can be converted to text by rdann(1) , edited as needed using any text editor, and converted back into annotation file format by wrann(1) .
The major difficulty in applying such a definition to the noise stress test is that most measurements of signal power are not particularly meaningful when applied to the ECG. A measurement based on mean squared amplitude, for example, will be proportional to the square of the heart rate. Such a measurement bears little relationship to a detector’s ability to locate QRS complexes, which is typically related to the size of the QRS complex. A less significant problem is that unweighted measurements of noise power are likely to overestimate the importance of very low frequency noise, which is both common and (usually) not troublesome for detectors. In view of these issues, nst defines S as a function of the QRS amplitude, and N as a frequency-weighted noise power measurement. The definitions of S and N have been chosen such that SNRs given for noise stress tests will correspond roughly in terms of an intuitively defined ‘signal quality’ with SNRs such as those that may be encountered in other contexts.
To determine S, nst invokes sigamp(1) to read the reference annotation file for the ECG record and to measure the peak-to-peak amplitude of each of the first 300 normal QRS complexes (in each case, by measuring the range of amplitudes during a window from 50 ms before to 50 ms after the QRS annotation). The largest 5% and the smallest 5% of the measurements are discarded, and sigamp estimates the peak-to-peak QRS amplitude as the mean of the remaining 90% of the measurements. nst squares this peak-to-peak amplitude estimate and divides the result by 8 (correct for sinusoids, close enough for these purposes) to obtain the QRS ‘‘power’’ estimate, S.
To determine N for the unscaled
noise signals, sigamp divides the first 300 seconds of the noise record
into one-second chunks. For each chunk, sigamp determines the mean amplitude
and the root mean squared difference, n, between the signal and this mean
amplitude. As in the calculation of S, the largest 5% and the smallest
5% of the 300 measurements of n are discarded, and sigamp estimates the
RMS noise amplitude as the mean of the remaining 90% of the measurements.
N is the square of this estimate; if a noise signal is scaled by a gain,
a, then N is scaled by the square of a. To obtain the desired SNR given
S and N, nst solves for a in the equation:
SNR = 10 log (S/(N * a**2))
The calculations of S, N, and a are performed separately for each pair of clean and noise signals.
Although an early
version of nst generated the records in the nstdb/old directory, the signal-to-noise
ratios of these records were not determined using the definitions above.
(Unfortunately, they were not calculated as stated in the readme.doc file
on the first edition CD-ROM, either.) Using the definitions above, the signal-to-noise
ratios (in dB) for the noisy portions of these records are as follows:
|Record||Signal 0||Signal 1||Record||Signal 0||Signal 1|
The standard protocol is designed to provide a fair yet difficult challenge to most analyzers. Segments of noise-free signals during the test period illustrate how rapidly the analyzer recovers its ability to analyze clean signals after having been presented with noisy signals.
Tests of multichannel analyzers should include records in which not all signals are equally noisy. Such records can be generated by nst with appropriately constructed protocol annotation files.
It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).
Table of Contents
Up: WFDB Applications Guide
Please e-mail your comments and suggestions to email@example.com, or post them to:PhysioNet
Updated 28 May 2015