You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A record can declare a signal in format 0, meaning its samples aren't available: no signal file exists, and the file name is ~. wfdb-python reads such a header, but reading the record fails with an internal error.
This is the format0 test record in the WFDB specification (wfdb/wfdb-spec, tests/records/format0). The specification says every sample of a format 0 signal is invalid, and WFDB C reads them that way since version 10.3.17. WFDB C 10.7.0 passes this case. WFDB Python 6.1.0 is reported as not supporting format 0 in the specification's IMPLEMENTATIONS.md.
Expected
read_record(..., kind="digital"): the signal is present, with every sample masked.
read_record(..., kind="physical"): every sample is NaN.
read_segments, and multi-segment reads where a segment has a format 0 signal: the same.
Legacy rdrecord(..., physical=True): NaN. With physical=False there is no stored missing marker for format 0, so either raise a clear error or use the smallest integer of the output type. That needs a decision, as for format 8 in Handle missing samples in format 8 reads #902.
Nothing is read from disk for these signals, and the record's length comes from the header.
Tests: the specification's format0 record in both kinds and layouts, and a record mixing a format 0 signal with a format 16 one in the same window.
Modern API:read_record and read_segments with kind="digital" return format 0 signals with every sample masked. With kind="physical", every sample is NaN. Nothing is read from disk for these signals, and the record's length comes from the header. A record that mixes format 0 and other signals reads the other signals as usual.
Legacy rdrecord(..., physical=True): every sample is NaN, as for other missing physical samples.
Legacy rdrecord(..., physical=False): raise a clear ValueError, naming the format 0 signal and suggesting read_record(..., kind="digital"). A legacy digital Record has no stored missing marker for format 0, so it can't represent these samples, as for format 8 skew tails in Handle missing skew tails in format 8 reads #913.
The fix should remove format0 from the known gaps in tests/spec_conformance.json (#939).
Activity
Run the WFDB specification's test records in CI (#939)
tompollard commentedon Dec 6, 2026
Decision on behaviour:
read_recordandread_segmentswithkind="digital"return format 0 signals with every sample masked. Withkind="physical", every sample is NaN. Nothing is read from disk for these signals, and the record's length comes from the header. A record that mixes format 0 and other signals reads the other signals as usual.rdrecord(..., physical=True): every sample is NaN, as for other missing physical samples.rdrecord(..., physical=False): raise a clearValueError, naming the format 0 signal and suggestingread_record(..., kind="digital"). A legacy digitalRecordhas no stored missing marker for format 0, so it can't represent these samples, as for format 8 skew tails in Handle missing skew tails in format 8 reads #913.The fix should remove
format0from the known gaps intests/spec_conformance.json(#939).