Store a WFDB record in a single file

Nov. 30, 2026

A WFDB record is usually spread across several files: a header, one or more signal files, and often annotation files. A multi-segment record can have hundreds. The .wfdb archive format keeps all of them together in one file, which makes a record easier to share, download, and move without losing part of it. The WFDB Python package can read, write, and check archives. Install or upgrade it with pip install --upgrade wfdb. The examples below need version 5.11.0 or later.

What is in an archive. A .wfdb archive is a ZIP file containing the files of a single record: its header file, the signal files listed in the header, and optionally annotation files. The files are at the top level of the archive, and the header is named after the archive, so 100.wfdb contains 100.hea. A multi-segment record is stored in one archive, together with the header and signal files of each segment. Because it is an ordinary ZIP file, you can list or extract its contents with any ZIP tool:

$ unzip -l 100.wfdb
  Length      Date    Time    Name
---------  ---------- -----   ----
      166  11-30-2026 13:40   100.hea
  1950000  11-30-2026 13:40   100.dat
     4558  11-30-2026 13:40   100.atr

Read part of a signal without unpacking it. Files are stored without compression, so a range of samples can be read directly from the archive without decompressing the whole signal file. Archives made by other tools may compress their files, and can still be read.

Package an existing record. Give create_archive the files of a record, including any annotations:

from wfdb.io.archive import create_archive

create_archive(["100.hea", "100.dat", "100.atr"], "100.wfdb")

Read from an archive. Pass the path of the archive, including the .wfdb extension, wherever you would pass a record name:

import wfdb

# The first 10 seconds, and the reference beat annotations
record = wfdb.read_record("100.wfdb", stop=3600)
annotation = wfdb.read_annotations("100.wfdb", annotator="atr", stop=3600)

The long-standing functions rdrecord, rdsamp, rdheader, and rdann accept archive paths too, so existing code needs no other changes.

Write to an archive. write_record writes a record straight into an archive, and wrsamp does the same with its wfdb_archive argument:

wfdb.write_record("100-copy.wfdb", record)

Check an archive before sharing it. The wfdb check command, and the check_record and check_dataset functions, look for malformed headers, missing signal or segment files, and signal data that cannot be read. They check archives in the same way as records stored as separate files:

$ wfdb check 100.wfdb
No WFDB problems found

Current limits. Archives are supported for local files. Reading archives from cloud storage or directly from PhysioNet is not supported yet. An archive holds a single record, so a database is a folder of archives, one per record.

Archive support was added in version 5.0.0, and the newer read_record, read_annotations, and write_record functions support it as well. We would like to hear how archives work for your data. Questions, bug reports, and suggestions are welcome on the GitHub issue tracker.

Read more: https://wfdb.readthedocs.io/en/stable/io.html#wfdb-archives