Next: IHR(1) Up: WFDB Applications Guide Previous: HRFFT(1)On This Page


hrstats - collect and summarize heart rate statistics from an annotation file


hrstats -r record -a annotator [ options ... ]


hrstats reads the annotation file specified by record and annotator and produces a uniformly sampled and smoothed instantaneous heart rate signal, using the IPFM model as originally implemented in tach.c. In this context, heart rate (HR) is defined as ten times the number of beat-to-beat (RR) intervals (and fractional intervals) within a 6-second HR measurement window, including intervals beginning and/or ending with ectopic beats, and RR intervals are defined by the locations of consecutive beat annotations in the annotation file.

The first HR window starts at the beginning of the first RR interval in the record and ends 6 seconds later. Subsequent HR windows begin at 1-second intervals following the first, i.e, they overlap by 5/6 (83.33%). HR windows that contain part or all of a very long (>3 sec) or very short (<0.2 sec) interval are discarded. All others are used to generate HR measurements that are accumulated in a histogram with 1 bpm bins.

When all intervals have been processed, summary statistics calculated from the histogram are written to the standard output and to a WFDB ’.info’ file, in this format:

<HR>: 71|73/75/81|86 +-1.8 bpm [atr]

This example is the output of ’hrstats -r mitdb/100 -a atr’. From left to right, it shows:

the characteristic that is summarized [HR]

extreme low value [in the example, 71]

5th percentile [73]

mean (trimmed, excluding outliers below 5th or above 95th percentiles) [75]

95th percentile [81]

extreme high value [86]

sample deviation (of values included in the trimmed mean) [1.8]

units of all statistics [bpm]

source of data [atr annotations]

Optionally, the HR histogram can also be written to a file containing two columns separated by a tab. The second column contains the number of measurements of heart rate falling within 0.5 bpm of the heart rate in the first column. The histogram includes only heart rates between the extreme low and extreme high heart rates inclusive.

Options include:

Print a usage summary.
-o file
Write the HR histogram to the specified file.


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

See Also

ihr(1) , tach(1)


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