Software Open Access
Waveform Database Software Package (WFDB) for Python
Published: Oct. 4, 2021. Version: 3.4.1 <View latest version>
When using this resource, please cite:
(show more options)
Xie, C., McCullum, L., Johnson, A., Pollard, T., Gow, B., & Moody, B. (2021). Waveform Database Software Package (WFDB) for Python (version 3.4.1). PhysioNet. https://doi.org/10.13026/egpf-2788.
Please include the standard citation for PhysioNet:
(show more options)
Goldberger, A., Amaral, L., Glass, L., Hausdorff, J., Ivanov, P. C., Mark, R., ... & Stanley, H. E. (2000). PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation [Online]. 101 (23), pp. e215–e220.
Physiological waveforms - such as electrocardiograms (ECG), electroencephalograms (EEG), electromyograms (EMG) - are generated during the course of routine care. These signals contain information that can be used to understand underlying conditions of health. Effective processing and analysis of physiological data requires specialized software. The waveform-database (WFDB) package for Python is a library of tools for reading, writing, and processing physiological signals and annotations, written in the Python programming language. Core components of the Python package are loosely based on the specifications of the original C-language WFDB software. We aim to implement as many of the core WFDB features as possible, with user-friendly APIs. Additional features are added over time.
Physiological waveforms - such as electrocardiograms (ECG), electroencephalograms (EEG), electromyograms (EMG) - are generated during the course of routine care. These signals contain information that can be used to understand underlying conditions of health. For example, ECGs aid diagnosis of abnormal heart conditions, EEGs aid detection of disorders such as epilepsy, and EMGs aid diagnosis of neuromuscular diseases. Despite the potential utility of waveforms, their complexity and granularity present challenges for retrospective analysis. Effective storage, processing and analysis of physiological signals requires specialized software.
The original Waveform Database (WFDB) Software Package, written in C, provides a large collection of software for processing and analyzing physiological waveforms . Python is an increasingly popular language for data processing and analysis, particularly for tasks such as machine learning .
This project describes Waveform Database Software Package (WFDB) for Python, a version of the WFDB Software implemented in Python. Core components of the Python package are loosely based on the specifications of the original C-language WFDB software, but there are significant differences between the two implementations. While there are many benefits to working with the original C-language library, most noticeably in terms of speed, Python may be a more familiar language to some researchers. At its core, the package allows users to import functions that can be used to read physiological signal files and associated annotations, to plot the signals and annotations, and to extract features of interest.
The development version of the WFDB Software for Python is hosted on GitHub . The code follows standard conventions found in the PEP8 Style Guidelines . Unit tests are written to help ensure integrity of code during development. Core packages used in the implementation include:
- NumPy, the numerical Python library 
- Pandas, for tabular data structures 
- Scikit-Learn, for scientific models 
- SciPy, for general scientific support 
- MatPlotLib, for visual display of signals 
There are a few important concepts that should be well understood before using the WFDB software. These concepts include "records"; "signals, samples, and time"; and "annotations". We suggest reviewing the original WFDB documentation for more details on these concepts .
Installation and Requirements
The distribution is hosted on PyPI, the package manager for Python . The software can be installed directly from PyPI using the following command:
$ pip install wfdb
The development version of the WFDB Software for Python is hosted on GitHub . This repository also contains demo scripts and example data. To install the development version, clone or download the repository, navigate to the base directory, and run:
$ pip install .
Once installed, the following example will load a record named "a1031" and plot the waveform to screen. For more examples, please refer to the online documentation :
# import the WFDB package import wfdb # load a record using the 'rdrecord' function record = wfdb.rdrecord('sample-data/a103l') # plot the record to screen wfdb.plot_wfdb(record=record, title='Example signals')
The source code for the WFDB Software is publicly available on GitHub . If you are a user of the software and encounter issues, then we suggest searching to see if the issue is already tracked on the GitHub repository. If not, then please raise a new issue, clearly describing the problem that you have encountered and what steps you have taken to try to address it. We have limited resources to support the software, and so we encourage community contributions via pull requests.
We also highly recommend reviewing documentation on the original C language implementation of the software . This documentation provides detailed background on various aspects of the WFDB library, including file structures, terminology, and general user guidance.
Development of this Python package has been largely independent of the development of the original WFDB package. As a result, there are significant differences between the two implementations. In future, we hope to more closely align the development processes (for example, making efforts to ensure that behavior is consistent across implementations).
Changes in version 3.4.1:
- Fix axes indexing issue when plotting a single channel
- Update matplotlib version and import only when used
- Performance improvements to smooth_frames=False
- List only direct dependencies in requirements.txt
- Correct an error in the calculation of the signals length for certain cases
- Speed up import time by removing the dependency on scikit-learn when it isn't required
The distribution is hosted on PyPI, the package manager for Python . For the latest stable version of the software, we highly recommend referring to PyPI. For the latest development versions, please refer to GitHub .
Development of this software was supported by the National Institute of Biomedical Imaging and Bioengineering (NIBIB) under NIH grant number R01EB030362.
Conflicts of Interest
The authors have no conflicts of interest to declare.
- Moody, G., Pollard, T., & Moody, B. (2021). WFDB Software Package (version 10.6.2). PhysioNet. https://doi.org/10.13026/zzpx-h016.
- Van Rossum, G., & Drake, F. L. (2009). Python 3 Reference Manual. Scotts Valley, CA: CreateSpace.
- WFDB on PyPI. https://pypi.python.org/pypi/wfdb/ [Accessed: 1 March 2021]
- WFDB Python on GitHub. https://github.com/MIT-LCP/wfdb-python [Accessed: 1 March 2021]
- Style Guide for Python (PEP8). https://www.python.org/dev/peps/pep-0020/ [Accessed: 1 March 2021]
- Harris, C.R., Millman, K.J., van der Walt, S.J. et al. Array programming with NumPy. Nature 585, 357–362 (2020). https://doi.org/0.1038/s41586-020-2649-2
- McKinney, Proceedings of the 9th Python in Science Conference, Volume 445, 2010. https://doi.org/10.25080/Majora-92bf1922-00a
- Scikit-learn: Machine Learning in Python, Pedregosa et al. (2011) Journal of Machine Learning Research (JMLR). Volume 12, pp. 2825-2830.
- Virtanen P, Gommers R, Oliphant T, ... and SciPy 1.0 Contributors. (2020) SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17(3), 261-272. https://doi.org/10.1038/s41592-019-0686-2
- John D. Hunter (2007) Matplotlib: A 2D Graphics Environment, Computing in Science & Engineering, 9, 90-95. https://doi.org/10.1109/MCSE.2007.55
- Documentation for WFDB Python. https://wfdb.readthedocs.io/en/latest/ [Accessed: 1 March 2021]
Anyone can access the files, as long as they conform to the terms of the specified license.
License (for files):
Total uncompressed size: 233.5 MB.
Access the files
- Download the ZIP file (99.1 MB)
- Access the files using the Google Cloud Storage Browser here. Login with a Google account is required.
- Access the data using the Google Cloud command line tools (please refer to the gsutil documentation for guidance):
gsutil -m -u YOUR_PROJECT_ID cp -r gs://wfdb-python-3.4.1.physionet.org DESTINATION
- Download the files using your terminal:
wget -r -N -c -np https://physionet.org/files/wfdb-python/3.4.1/
|Makefile (download)||601 B||2021-03-10|
|conf.py (download)||5.4 KB||2021-09-16|
|index.rst (download)||1.5 KB||2021-09-16|
|installation.rst (download)||513 B||2021-03-10|
|io.rst (download)||725 B||2021-03-10|
|plot.rst (download)||91 B||2021-03-10|
|processing.rst (download)||747 B||2021-03-10|
|wfdb-specifications.rst (download)||684 B||2021-03-10|
|wfdb.rst (download)||799 B||2021-03-10|