diff --git a/README.md b/README.md index 829bad45..bfbce19e 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,14 @@ import wfdb record = wfdb.read_record("physionet://mitdb/1.0.0/100", layout="uniform", stop=3600) annotation = wfdb.read_annotations("physionet://mitdb/1.0.0/100.atr", stop=3600) -print(record.fs) # Sampling frequency: 360 Hz -print(record.sig_name) # ['MLII', 'V5'] -print(record.p_signal.shape) # (3600, 2): samples x channels +print(record.metadata.fs) # Sampling frequency: 360 Hz +print([channel.name for channel in record.metadata.signals]) # ['MLII', 'V5'] +print(record.signals.values.shape) # (3600, 2): samples x channels print(annotation.sample[:5]) # Sample positions of the first five annotations -wfdb.plot_wfdb(record=record, annotation=annotation, title="Record 100") +wfdb.plot_wfdb( + record=record.to_legacy_record(), annotation=annotation, title="Record 100" +) ``` The `physionet://` URI reads data from PhysioNet. For local files, pass the @@ -50,8 +52,11 @@ record = wfdb.read_record("path/to/record", layout="uniform") annotation = wfdb.read_annotations("path/to/record.atr") ``` -`record.p_signal` is a NumPy array of signals in physical units. Use -`kind="digital"` with `read_record` to read digital values in `record.d_signal`. +`record.signals.values` is a NumPy array of signals in physical units. Use +`kind="digital"` with `read_record` for digital values, including a mask for +missing samples. `read_record` returns a `RecordData` with fixed metadata and +editable signal values. `rdrecord` remains available when you need a mutable +legacy `Record`. Annotations provide sample positions, symbols, and other label information. ## Write a record diff --git a/changelog.d/recorddata-read-record.rst b/changelog.d/recorddata-read-record.rst new file mode 100644 index 00000000..3f3f6c58 --- /dev/null +++ b/changelog.d/recorddata-read-record.rst @@ -0,0 +1,8 @@ +**Make read_record return RecordData in 6.0** + ``read_record`` now returns a ``RecordData`` with one selected signal form, + fixed metadata, editable arrays, and source provenance. Use ``read_segments`` + for uncombined segments. ``read_signals`` and the public ``SignalRead`` + aliases are removed; ``wfdb.io.signal_values.SignalRead`` remains for old + pickles. Errors for removed names and the old ``combine_segments`` argument + name their replacements. The mutable ``Record`` and ``MultiRecord`` remain + available through ``rdrecord``. See the migration guide for code changes. diff --git a/docs/io.rst b/docs/io.rst index 35aa76d2..a8aaad58 100644 --- a/docs/io.rst +++ b/docs/io.rst @@ -12,34 +12,31 @@ WFDB Records :members: rdrecord, read_record, write_record, write_signals, find_record, wfdb_search_path, rdheader, read_header, read_multi_segment_headers, read_channel_header, - read_signals, read_segments, iter_dataframes, + read_segments, iter_dataframes, rdsamp, wrsamp, sampfreq, signame, wfdbdesc, wfdbtime -``read_record(path, layout="uniform")`` returns the same mutable ``Record`` -or ``MultiRecord`` as ``rdrecord``. It names the selected frame range -``start`` and ``stop`` -(exclusive), uses ``kind`` and ``layout`` for the loaded signal values, and -spells out ``combine_segments`` and ``resolution``. The caller must choose -``layout="uniform"`` or ``layout="expanded"``. Uniform layout averages -samples when a channel has more than one sample per frame; expanded layout -keeps every sample. Other defaults are physical values and combined segments. -``read_signals`` also requires an explicit layout. ``rdrecord`` remains -available with its existing arguments and behavior. - -When selecting channels by name, ``read_record`` and ``read_signals`` raise +``read_record(path, layout="uniform")`` returns ``RecordData``: one selected +signal representation, fixed metadata, and editable signal arrays. The +``start`` and exclusive ``stop`` arguments select frames; ``kind`` chooses +physical or digital values. The required ``layout`` is ``"uniform"`` to +average multiple samples per frame or ``"expanded"`` to retain every sample. +Multi-segment records are combined. Use ``read_segments`` for uncombined +segments, or ``rdrecord`` for the mutable legacy ``Record`` or ``MultiRecord``. + +When selecting channels by name, ``read_record`` raises an error if any requested name is absent from the source header. Use ``missing_channels="ignore"`` to select only matching names. For a variable-layout record, a name in the layout header is valid even if no selected segment contains it; ``force_channels`` controls whether that channel remains in the returned record. If no requested names match the -header, the new readers raise an error even in ``"ignore"`` mode. +header, the reader raises an error even in ``"ignore"`` mode. Duplicate channel selections and a bare string for ``channel_names`` are also rejected with clear errors. ``rdrecord`` keeps its existing behavior of skipping unknown names. -The newer readers no longer accept ``warn_empty`` (which was available in +The newer reader does not accept ``warn_empty`` (which was available in 5.10.0); invalid or empty channel-name selections give clear errors instead. -They accept lists, tuples, ranges, and one-dimensional NumPy arrays for +It accepts lists, tuples, ranges, and one-dimensional NumPy arrays for channel selection. ``Record`` and ``MultiRecord`` have a mutable ``signal_names`` alias for @@ -126,7 +123,7 @@ in the constructor or for assignment. Both spellings share the same object; there is no extra copy or synchronization. Several forms can be present, and editing one form does not update the others. ``Record.write`` requires a ``kind`` or ``layout`` choice when it cannot select a unique form. For an -explicit result containing exactly one form, use ``read_signals``. +explicit result containing exactly one form, use ``read_record``. Assignments through the readable names check that uniform values are 2D NumPy arrays and expanded values are per-channel 1D arrays. Physical arrays must have a floating dtype and digital arrays an integer dtype. Expanded @@ -138,7 +135,7 @@ names retain their existing behavior. import wfdb - record = wfdb.read_record("sample-data/100", layout="uniform", stop=10) + record = wfdb.rdrecord("sample-data/100", sampto=10) assert record.signal_names == ["MLII", "V5"] record.signal_names[0] = "ECG" assert record.sig_name[0] == "ECG" @@ -153,7 +150,7 @@ record as its receiver. Before writing, it checks that ``n_sig`` (when set), the selected signal array, and retained per-channel header fields agree on the channel count. A mismatch raises ``ValueError`` listing every mismatched field and suggests using -``read_record(..., channels=[...])`` for a subset. ``byte_offset`` is cleared; +``rdrecord(..., channels=[...])`` for a mutable subset. ``byte_offset`` is cleared; ``init_value`` and ``checksum`` are regenerated from the selected values. When several arrays are loaded, ``kind`` and ``layout`` select the one whose channel count is checked. If ``n_sig`` is unset, the writer fills it on its @@ -198,9 +195,9 @@ creating files, returns ``None``, and leaves the input arrays unchanged. "sample-data/100", layout="uniform", start=100, stop=200, kind="digital", ) - assert record.d_signal.shape == (100, 2) + assert record.signals.values.shape == (100, 2) -For a read/write round trip, pass the loaded ``Record`` to ``write_record``: +For a read/write round trip, pass the loaded ``RecordData`` to ``write_record``: .. code-block:: python @@ -217,17 +214,17 @@ For a read/write round trip, pass the loaded ``Record`` to ``write_record``: restored = wfdb.read_record( "output/100-copy", layout="uniform", kind="digital" ) - np.testing.assert_array_equal(restored.digital_signals, original.digital_signals) + np.testing.assert_array_equal(restored.signals.values, original.signals.values) This preserves the logical digital samples and record metadata needed for the selected view, rather than promising identical file bytes or storage layout. Physical values may change slightly when encoded and read again. When any selected channel has nonzero skew, ``write_record`` and -``Record.write`` require ``signal_alignment``. Use ``"aligned"`` when skew +``Record.write`` and ``RecordData.write`` require ``signal_alignment``. Use +``"aligned"`` when skew was applied during reading or values were filtered or trimmed from that aligned read. Use ``"raw"`` when the values still have the file's skew, -including reads made with ``signal_alignment="raw"``. This is also required -after replacing an aligned array with raw values: +including a full read made with ``signal_alignment="raw"``: .. code-block:: python @@ -238,8 +235,9 @@ after replacing an aligned array with raw values: "sample-data/100skew", layout="uniform", kind="digital", signal_alignment="raw", ) - aligned.d_signal = raw.d_signal - wfdb.write_record("output/100skew-copy", aligned, signal_alignment="raw") + wfdb.write_record("output/100skew-aligned", aligned, + signal_alignment="aligned") + wfdb.write_record("output/100skew-raw", raw, signal_alignment="raw") ``signal_alignment`` applies only to that write and does not shift samples. The error explains both choices before creating any files. ``Record.wrsamp`` @@ -384,8 +382,8 @@ including flattened multi-segment reads, but not on ``MultiRecord``. .. autoclass:: wfdb.io.SignalStorageMetadata :no-index: -Records loaded with ``read_record`` or ``rdrecord``, and ``RecordData`` values -returned by ``read_signals``, expose read-only ``source_header``, +``RecordData`` values from ``read_record`` and mutable records from +``rdrecord`` expose read-only ``source_header``, ``source_signal_header``, and ``source_selection`` views. ``source_header`` has the same immutable type as ``read_header`` and describes the original file before channel selection, range selection, or skew alignment. An omitted header @@ -397,7 +395,7 @@ segment header already loaded by the read. ``source_selection.start`` and requested indices in ``source_signal_header.signals``, in requested order. A variable-layout read with ``force_channels=False`` may omit some requested channels from the -returned view. If none remain, ``read_signals`` raises ``ValueError``. For a +returned view. If none remain, ``read_record`` raises ``ValueError``. For a multi-segment read, frame offsets refer to the main source header. A segment within a preserved ``MultiRecord`` has its own source views when loaded. @@ -451,7 +449,7 @@ array before writing: record.wrsamp(write_dir="output") For expanded data, call ``set_d_features(do_adc=True, expanded=True)`` and -``wrsamp(expanded=True)``. ``read_signals`` returns one form at a time +``wrsamp(expanded=True)``. ``read_record`` returns one form at a time and its conversions return independent arrays. For a flattened multi-segment record, writing may change incompatible signal @@ -462,11 +460,10 @@ of the written data. Explicit signal values ---------------------- -``read_signals`` returns a ``RecordData`` with values, metadata, and source +``read_record`` returns a ``RecordData`` with values, metadata, and source segment provenance. Legacy ``rdsamp`` continues to return a two-dimensional array and a fields -dictionary. The new result types are provisional while the broader naming -design in #672 is being settled. The returned ``signals`` field is either +dictionary. The returned ``signals`` field is either ``UniformSignals`` (a two-dimensional array with one value per channel per base frame) or ``ExpandedSignals`` (one array per channel, retaining every sample). The ``layout`` argument is required: choose ``"uniform"`` to average @@ -476,15 +473,15 @@ every sample. Choose ``kind="physical"`` for floating values or ``i`` has ``n_frames * samples_per_frame[i]`` values and a sample frequency of ``metadata.fs * samples_per_frame[i]``. The metadata describes the selected view, not necessarily the whole source header. -The expanded arrays on a mutable ``Record`` are lists; ``read_signals`` returns +The expanded arrays on a mutable ``Record`` are lists; ``read_record`` returns a tuple of arrays within ``ExpandedSignals``. -Physical values use ``NaN`` for missing samples. Digital ``read_signals`` +Physical values use ``NaN`` for missing samples. Digital ``read_record`` values are NumPy masked arrays: one 2D array for uniform layout, or one 1D array per channel for expanded layout. A missing sample has a true mask entry; the underlying integer at that position is not a valid sample. With no gaps, ``values.mask is np.ma.nomask``. Assigning a value to a masked position clears -its mask. Legacy ``read_record`` and ``rdrecord`` still return integer marker +its mask. Legacy ``rdrecord`` still returns integer marker values in their digital arrays. .. code-block:: python @@ -492,7 +489,7 @@ values in their digital arrays. import numpy as np import wfdb - read = wfdb.read_signals("sample-data/100", layout="uniform", kind="digital") + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital") values = read.signals.values missing = np.ma.getmaskarray(values) valid = values.compressed() @@ -510,12 +507,12 @@ channel's 1D values: .. code-block:: python - expanded = wfdb.read_signals( + expanded = wfdb.read_record( "sample-data/mixedsignals", channels=[0], layout="expanded" ) channel = expanded.signals.values[0] - uniform = wfdb.read_signals( + uniform = wfdb.read_record( "sample-data/mixedsignals", channels=[0], layout="uniform" ) channel = uniform.signals.values[:, 0] @@ -527,7 +524,7 @@ The legacy read options map to the new reader as follows: :widths: 36 28 36 * - ``rdrecord`` or ``rdsamp`` - - ``read_signals`` + - ``read_record`` - Notes * - ``smooth_frames=True`` or ``False`` on ``rdrecord`` - ``layout="uniform"`` or ``"expanded"`` @@ -543,17 +540,17 @@ The legacy read options map to the new reader as follows: - ``stop`` is exclusive, as ``sampto`` is. * - ``m2s=True`` on ``rdrecord`` - Automatic - - ``read_signals`` always combines segments. + - ``read_record`` always combines segments. * - ``m2s=False`` on ``rdrecord`` - - No equivalent - - Use ``read_record(path, layout="uniform", combine_segments=False)`` - for a ``MultiRecord``. + - ``read_segments`` + - Use ``read_segments`` for an immutable segment view, or + ``rdrecord(..., m2s=False)`` for a mutable ``MultiRecord``. -``read_signals`` always returns a ``RecordData``; unlike ``rdsamp``, it does -not return an ``(array, fields)`` pair. ``read_record`` remains available when -the mutable ``Record`` or an uncombined ``MultiRecord`` is needed. +``read_record`` always returns a ``RecordData``; unlike ``rdsamp``, it does +not return an ``(array, fields)`` pair. ``rdrecord`` remains available when +a mutable ``Record`` or ``MultiRecord`` is needed. ``channels`` and ``channel_names`` keep their names. For a raw read, pass -``signal_alignment="raw"`` to ``read_record`` or ``read_signals``; the default +``signal_alignment="raw"`` to ``read_record``; the default is ``"aligned"``. The legacy ``rdrecord`` keeps ``ignore_skew``. Conversions return a new result with independent arrays, even when the values @@ -571,7 +568,7 @@ files that either reader accepts. .. code-block:: python - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/mixedsignals", kind="digital", layout="expanded" ) print(read.signals.samples_per_frame) @@ -661,13 +658,13 @@ do not share the result's source provenance if it is sensitive. .. code-block:: python - read = wfdb.read_signals("sample-data/100", layout="uniform") + read = wfdb.read_record("sample-data/100", layout="uniform") selected = read.select(start=100, stop=200, channels=[1, 0]) edited = selected.with_values(selected.signals.values * 2) labeled = edited.with_channels(names=["ECG lead V5", "ECG lead II"]) labeled = labeled.with_comments(["Reviewed for release"]) - digital = wfdb.read_signals("sample-data/100", kind="digital", layout="uniform") + digital = wfdb.read_record("sample-data/100", kind="digital", layout="uniform") corrected = digital.with_calibration( adc_gain=[200.0, 200.0], baseline=[1024, 1024], mode="reinterpret" ) @@ -733,11 +730,11 @@ writing makes it a valid value. from pathlib import Path Path("output").mkdir(exist_ok=True) - selected = wfdb.read_signals( + selected = wfdb.read_record( "sample-data/100", layout="uniform", kind="digital", start=100, stop=200 ) selected.write("output/selected") - restored = wfdb.read_signals( + restored = wfdb.read_record( "output/selected", layout="uniform", kind="digital" ) assert (restored.signals.values == selected.signals.values).all() @@ -746,14 +743,12 @@ Multi-segment reads ------------------- ``read_record`` combines a multi-segment recording into one continuous -``Record`` by default (``combine_segments=True``). Its signal arrays contain -the selected frames in time order. With ``combine_segments=False``, it -returns a ``MultiRecord`` with a ``segments`` list instead. An entry is -``None`` for a ``"~"`` gap or when a nonempty segment contains none of the -requested channels. Its ``seg_name`` -and ``seg_len`` entries still retain that segment's name and length. In a -variable-layout record, the zero-length first segment describes the channel -layout and contains no samples. +``RecordData``. Its signal arrays contain the selected frames in time order. +``read_segments`` preserves the source boundaries in a +``SegmentedRecordData``. The legacy ``rdrecord(..., m2s=False)`` returns a +mutable ``MultiRecord`` with a ``segments`` list. In a variable-layout +record, the zero-length first segment describes the channel layout and +contains no samples. The three segment descriptors answer different questions: @@ -768,22 +763,22 @@ The three segment descriptors answer different questions: - Full source record; each entry gives its declared ``n_frames``. - Every reference in the main header, including the zero-length layout entry and ``"~"`` gaps. No segment files are read. - * - ``read_record(path, layout="uniform", combine_segments=False).segment_views``: - ``SegmentView`` - - Selected result; ``start`` and exclusive ``stop`` begin at zero. - - Every segment in the preserved result, including the layout entry, - gaps, and data segments whose values were not loaded. + * - ``read_segments(path, layout="uniform").segments``: + ``SegmentData`` + - Selected result in absolute master-record frames. + - Gaps have ``data=None``; real segments carry ``RecordData``. The + zero-length layout entry stays on the container as ``channel_header``. * - ``read_record(path, layout="uniform").source_segments``: ``SourceSegment`` - Combined result; ``start`` and exclusive ``stop`` begin at zero. - Every segment contributing frames, including gaps and data segments with no selected channel values. Zero-length layout entries are absent. -For either loaded form, ``source_selection.start`` and ``.stop`` retain the +For either modern form, ``source_selection.start`` and ``.stop`` retain the requested frame range in the *source* record. This lets you relate a selected view back to the unselected header. A layout entry defines channels but contributes no frames; a gap contributes frames but has no signal file. A -data segment can have no loaded ``Record`` when it has none of the requested -channels, without becoming a gap. +data segment can have a zero-channel ``RecordData`` when it has none of the +requested channels, without becoming a gap. To inspect channel names and calibration without loading samples, use ``read_channel_header(path)``. It works for single- and multi-segment records @@ -794,12 +789,11 @@ fixed layout, it is the first non-gap segment header. Other segments can have different calibration; inspect their headers separately when those details matter. -Use ``read_signals`` when only the selected signal values and metadata are +Use ``read_record`` when only the selected signal values and metadata are needed. It returns a ``RecordData`` for either a single-segment source or a combined multi-segment source; the latter retains ``source_segments`` for provenance. A preserved segment sequence is available through -``read_segments(path, layout="uniform")``. The older -``read_record(..., combine_segments=False)`` still returns a ``MultiRecord``. +``read_segments(path, layout="uniform")``. ``read_segments`` reads the selected window eagerly and returns a ``SegmentedRecordData``. Its ``source_header`` is the master header, and @@ -848,37 +842,18 @@ segments have no samples for them. record = wfdb.read_record( path, layout="uniform", start=25735, stop=25750, force_channels=True ) - assert record.n_frames == 15 + assert record.metadata.n_frames == 15 assert [(s.name, s.start, s.stop) for s in record.source_segments] == [ ("~", 0, 5), ("3234460_0001", 5, 15), ] - segments = wfdb.read_record( - path, layout="uniform", start=25735, stop=25750, - force_channels=True, combine_segments=False, - ) - assert isinstance(segments, wfdb.MultiRecord) - assert segments.segments[1] is None - assert [(s.kind, s.start, s.stop) for s in segments.segment_views] == [ - ("layout", 0, 0), - ("gap", 0, 5), - ("data", 5, 15), - ] - - abp = wfdb.read_record( - path, layout="uniform", start=25740, stop=25750, - channel_names=["ABP"], force_channels=True, - ) - assert [(s.name, s.start, s.stop) for s in abp.source_segments] == [ - ("3234460_0001", 0, 10), - ] - abp_segments = wfdb.read_record( - path, layout="uniform", start=25740, stop=25750, - channel_names=["ABP"], force_channels=True, combine_segments=False, + segments = wfdb.read_segments( + path, layout="uniform", start=25735, stop=25750 ) - assert abp_segments.seg_name[1] == "3234460_0001" - assert abp_segments.segments[1] is None # No ABP values in this segment. + assert isinstance(segments, wfdb.SegmentedRecordData) + assert segments.segments[0].data is None # The five-frame gap. + assert segments.segments[1].name == "3234460_0001" ``read_header`` returns the multi-segment header's references without loading segment samples. Use it when only the source layout is needed. @@ -905,7 +880,7 @@ as ``pd.NA``. The iterator identifies them using each source segment's format, including when a chunk crosses a segment boundary. ``Record.to_dataframe()`` retains its existing integer columns and marker values for digital records. -Use ``read_signals(..., layout="expanded")`` if every sample is needed. +Use ``read_record(..., layout="expanded")`` if every sample is needed. For code using the previous chunked-reader signature, replace ``sampfrom`` and ``sampto`` with ``start`` and ``stop``, ``physical=False`` with ``kind="digital"``, ``ignore_skew=True`` with @@ -1063,10 +1038,10 @@ Source Locations For record and annotation reads, the first argument identifies the source. Legacy functions call it ``record_name``; newer readers such as -``read_record``, ``read_signals``, ``read_annotations``, and ``read_header`` +``read_record``, ``read_segments``, ``read_annotations``, and ``read_header`` call it ``path``. Pass a local record stem, a supported cloud or ``physionet://`` URI, or a -local or remote ``.wfdb`` archive path. ``read_record``, ``read_signals``, +local or remote ``.wfdb`` archive path. ``read_record``, ``read_segments``, ``read_header``, and ``read_multi_segment_headers`` also accept a complete ``.hea`` filename. ``read_annotations`` takes a full annotation filename (such as ``100.atr``), or a record stem or archive with ``annotator="atr"``. diff --git a/docs/migration.rst b/docs/migration.rst index 7b4a3d7e..5cdf4b08 100644 --- a/docs/migration.rst +++ b/docs/migration.rst @@ -1,22 +1,37 @@ .. _migration: -Migrating from the legacy API -============================= +Migrating to WFDB-Python 6.0 +============================ WFDB-Python now has readable names for its functions, arguments and attributes, alongside the names inherited from the WFDB C tools. This page maps the older names to the newer ones and lists the differences that matter when switching. -The newer function signatures are still being refined before the next major -release. Incompatible changes to recently added names will be called out in -release notes. Legacy names remain available while their replacements are -completed. +The 6.0 release changes the recently introduced selected-record API: -``read_signals`` now returns ``RecordData``. The former ``SignalRead`` name is -a deprecated alias for the same class. Accessing it through ``wfdb`` or -``wfdb.io`` warns; reading a record does not. These two public aliases will be -removed in 6.0. The internal class path remains so older pickles keep loading. +.. list-table:: + :header-rows: 1 + + * - 5.18.0 + - 6.0 + * - ``read_signals(path, layout=...)`` returns ``RecordData``. + - ``read_record(path, layout=...)`` returns ``RecordData``. + * - ``read_record(path, layout=...)`` returns a mutable ``Record`` or + ``MultiRecord``. + - Use ``rdrecord`` for a mutable ``Record`` or ``MultiRecord``. + * - ``read_record(..., combine_segments=False)`` returns a ``MultiRecord``. + - Use ``read_segments`` for a ``SegmentedRecordData`` with uncombined + segments, or ``rdrecord(..., m2s=False)`` for a mutable ``MultiRecord``. + * - ``wfdb.SignalRead`` and ``wfdb.io.SignalRead`` are deprecated aliases. + - Use ``RecordData``. The private ``wfdb.io.signal_values.SignalRead`` + alias remains so older pickles can load. + +``read_signals`` is removed without a 5.x warning because its replacement +only starts returning ``RecordData`` in 6.0. The legacy API remains available, +including ``rdrecord``, ``rdsamp``, ``rdheader``, ``wrsamp``, ``Record`` and +``MultiRecord``. Existing deprecation warnings stay; there is no planned +removal date for these legacy names. The older names keep working, so you can switch one call at a time. Calling a legacy function, such as ``rdrecord`` or ``Record.wrsamp``, emits a @@ -35,6 +50,36 @@ To find the calls that need updating, run your code or tests with deprecation warnings shown as errors, for example ``python -W error::DeprecationWarning script.py``. +Code that used 5.x ``read_record`` will now receive ``RecordData``. Its +signal values live in ``signals.values``; ``kind`` and ``layout`` determine +which form is loaded. The common field changes are: + +.. list-table:: + :header-rows: 1 + + * - 5.x mutable ``Record`` + - 6.0 ``RecordData`` + * - ``p_signal`` or ``d_signal`` + - ``signals.values`` with ``kind="physical"`` or ``"digital"`` and + ``layout="uniform"``. + * - ``e_p_signal`` or ``e_d_signal`` + - ``signals.values`` with ``layout="expanded"``. Each channel is a + separate one-dimensional array. + * - ``fs``, ``n_sig``, ``sig_len`` + - ``metadata.fs``, ``metadata.n_signals``, ``metadata.n_frames``. + * - ``sig_name``, ``units`` + - ``[s.name for s in metadata.signals]`` and + ``[s.units for s in metadata.signals]``. + * - Assigning metadata or replacing arrays + - Use ``with_channels``, ``with_comments``, ``with_calibration``, + ``shift_time``, ``select``, or ``with_values``. + * - ``rec.wrsamp()`` + - ``write_record(path, data)`` or ``data.write(path)``. + +If you need to assign legacy fields directly, use ``rdrecord`` to get a +mutable ``Record``. In 6.0, attempts to access common legacy fields on +``RecordData`` raise ``AttributeError`` with the corresponding replacement. + A first example --------------- @@ -76,8 +121,8 @@ The newer functions take one path or URI as their first argument, use ``start`` and an exclusive ``stop`` for sample ranges, and accept their other options as keywords. -``read_signals(kind="digital")`` now returns NumPy masked arrays. Existing -code that compares digital values with a +``read_record(kind="digital")`` returns a ``RecordData`` whose +``signals.values`` are NumPy masked arrays. Existing code that compares them with a format-specific missing marker should use ``np.ma.getmaskarray(read.signals.values)`` instead. An expanded read has one masked array per channel. ``np.asarray`` and ``.data`` discard the mask, so @@ -101,7 +146,7 @@ edit, smoothing, or skew alignment. For example:: - data = wfdb.read_signals("100", kind="physical", layout="uniform") + data = wfdb.read_record("100", kind="physical", layout="uniform") data = data.select(start=100, stop=1100) data = data.with_channels(names=["Lead II", "Lead V5"]) wfdb.write_record("output/copy", data) @@ -109,9 +154,8 @@ For example:: ``read_segments`` returns a ``SegmentedRecordData`` when the original segment boundaries matter. Its entries retain their order and frame positions; ``~`` gaps have no data, and real segments contain ``RecordData`` values. -The segments are loaded eagerly. In 5.x, ``read_record`` still returns the -mutable ``Record`` or ``MultiRecord``; its 6.0 return-type change has not -landed in this release. +The segments are loaded eagerly. ``read_record`` always returns one combined +``RecordData``; use ``read_segments`` to retain source boundaries. ``shift_time`` leaves the source header, comments, annotations, and counter fields unchanged. Check those separately when preparing de-identified data. @@ -155,9 +199,10 @@ Functions - Notes * - ``rdrecord`` - ``read_record`` - - Returns the same mutable ``Record`` or ``MultiRecord``. + - Returns ``RecordData`` with fixed metadata and editable signal values. + Use ``rdrecord`` when the mutable ``Record`` is needed. * - ``rdsamp`` - - ``read_signals`` + - ``read_record`` - Returns a ``RecordData`` with ``signals`` and ``metadata`` rather than an ``(array, fields)`` pair. ``layout`` is required. * - ``rdheader`` @@ -238,14 +283,12 @@ Reading arguments - * - ``smooth_frames=True`` or ``False`` - ``layout="uniform"`` or ``"expanded"`` - - ``read_signals`` and ``read_record`` both require ``layout``. + - ``read_record`` requires ``layout``. * - ``m2s`` - - ``combine_segments`` - - ``read_signals`` always combines segments. ``read_segments`` returns a - ``SegmentedRecordData`` with each source segment preserved. In 5.x, - ``read_record(..., combine_segments=False)`` still returns a - ``MultiRecord``; 6.0 will remove that option in favor of - ``read_segments``. ``rdrecord`` keeps its ``MultiRecord`` path. + - ``read_segments`` + - ``read_record`` always combines segments. ``read_segments`` returns a + ``SegmentedRecordData`` with each source segment preserved. + ``rdrecord(..., m2s=False)`` still returns a mutable ``MultiRecord``. * - ``return_res`` - ``resolution`` - Selects the numeric width in bits. @@ -262,8 +305,8 @@ Reading arguments - A ``physionet://`` or HTTP URL in ``path`` - See `Remote sources`_. -``ignore_skew=True`` becomes ``signal_alignment="raw"`` on ``read_record``, -``read_signals``, and ``iter_dataframes``. Their default is ``"aligned"``. +``ignore_skew=True`` becomes ``signal_alignment="raw"`` on ``read_record`` +and ``iter_dataframes``. Their default is ``"aligned"``. The legacy ``rdrecord`` keeps ``ignore_skew``. ``channels``, ``channel_names`` and ``force_channels`` keep their names. @@ -273,7 +316,7 @@ The legacy ``rdrecord`` keeps ``ignore_skew``. ``channels``, ``return_res`` with ``resolution``, and ``pn_dir`` with a complete ``physionet://`` URI in ``path``. It always returns uniform DataFrames, averaging channels with multiple samples per frame; there is no ``layout`` -argument. Use ``read_signals`` with ``layout="expanded"`` when every channel +argument. Use ``read_record`` with ``layout="expanded"`` when every channel sample is needed. @@ -392,11 +435,11 @@ Put the source in the path instead: * - ``rdrecord("100", pn_dir="mitdb/1.0.0")`` - ``read_record("physionet://mitdb/1.0.0/100", layout="uniform")`` * - ``rdrecord("100", pn_dir="mitdb")`` - - ``read_record("physionet://mitdb/latest/100", layout="uniform")``; pin a version for - reproducible results + - ``read_record("physionet://mitdb/latest/100", layout="uniform")``; + pin a version for reproducible results * - ``set_db_index_url(url)`` with ``pn_dir`` - A complete HTTP URL, such as - ``read_record("https://mirror.example.org/files/mitdb/1.0.0/100", layout="uniform")`` + ``read_record("https://mirror.example.org/mitdb/100", layout="uniform")`` See :ref:`reading-from-physionet` and :ref:`reading-from-custom-http-server`. Cloud storage URIs such as ``s3://`` and local ``.wfdb`` archives work the @@ -410,12 +453,12 @@ Behaviour differences The newer functions are stricter in a few places, so that mistakes fail clearly instead of producing surprising results: -- ``read_record`` and ``read_signals`` raise ``ValueError`` for channel names +- ``read_record`` raises ``ValueError`` for channel names that are not in the record, listing the available names. Pass ``missing_channels="ignore"`` to skip them, as ``rdrecord`` does. Duplicate channels, an empty selection, or a single name passed as a string also raise errors. -- ``read_signals`` returns the same container type whatever the number of +- ``read_record`` returns the same container type whatever the number of channels: a 2D array for ``layout="uniform"``, and a tuple of 1D arrays for ``layout="expanded"``. For one channel, use ``values[:, 0]`` or ``values[0]``. diff --git a/src/wfdb/__init__.py b/src/wfdb/__init__.py index da6063c5..83454a6d 100644 --- a/src/wfdb/__init__.py +++ b/src/wfdb/__init__.py @@ -1,6 +1,3 @@ -import warnings -from typing import TYPE_CHECKING - from wfdb.io.annotation import ( Annotation, merge_annotations, @@ -61,7 +58,6 @@ read_header, read_multi_segment_headers, read_record, - read_signals, sampfreq, signame, wfdbdesc, @@ -75,19 +71,15 @@ from wfdb.plot.plot import plot_all_records, plot_items, plot_wfdb from wfdb.version import __version__ -if TYPE_CHECKING: - SignalRead = RecordData - def __getattr__(name: str): - """Warn when the historical name for a loaded record is requested.""" + """Explain the 6.0 replacements for removed selected-read names.""" + if name == "read_signals": + raise AttributeError( + "wfdb.read_signals was removed in 6.0; use wfdb.read_record instead" + ) if name == "SignalRead": - warnings.warn( - "wfdb.SignalRead is deprecated; use wfdb.RecordData instead (see " - "the migration guide). The legacy name will be removed in a " - "future major release.", - DeprecationWarning, - stacklevel=2, + raise AttributeError( + "wfdb.SignalRead was removed in 6.0; use wfdb.RecordData instead" ) - return RecordData raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/src/wfdb/io/__init__.py b/src/wfdb/io/__init__.py index 2746d197..34bef351 100644 --- a/src/wfdb/io/__init__.py +++ b/src/wfdb/io/__init__.py @@ -1,6 +1,3 @@ -import warnings -from typing import TYPE_CHECKING - from wfdb.io._signal import est_res, wr_dat_file from wfdb.io.annotation import ( Annotation, @@ -62,7 +59,6 @@ read_header, read_multi_segment_headers, read_record, - read_signals, sampfreq, signame, wfdbdesc, @@ -74,19 +70,15 @@ from wfdb.io.signal_values import ExpandedSignals, RecordData, UniformSignals from wfdb.io.signal_write import write_signals -if TYPE_CHECKING: - SignalRead = RecordData - def __getattr__(name: str): - """Warn when the historical name for a loaded record is requested.""" + """Explain the 6.0 replacements for removed selected-read names.""" + if name == "read_signals": + raise AttributeError( + "wfdb.io.read_signals was removed in 6.0; use wfdb.io.read_record instead" + ) if name == "SignalRead": - warnings.warn( - "wfdb.io.SignalRead is deprecated; use wfdb.io.RecordData instead " - "(see the migration guide). The legacy name will be removed in " - "a future major release.", - DeprecationWarning, - stacklevel=2, + raise AttributeError( + "wfdb.io.SignalRead was removed in 6.0; use wfdb.io.RecordData instead" ) - return RecordData raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/src/wfdb/io/record.py b/src/wfdb/io/record.py index d025e1e8..1a422ef3 100644 --- a/src/wfdb/io/record.py +++ b/src/wfdb/io/record.py @@ -1530,7 +1530,7 @@ def wrsamp(self, expanded=False, write_dir="", wfdb_archive=None): can preserve its original skew, but cannot assign a different nonzero skew without supplying additional samples. After manually removing channels, retained skew values must follow their original order; use - ``read_record(..., channels=[...])`` for explicit selection. + ``rdrecord(..., channels=[...])`` for explicit selection. A read with ``ignore_skew=True`` that stops before the source record's end cannot be written with nonzero skew because its arrays omit the tail samples needed to preserve alignment. Read the full record or @@ -3591,104 +3591,6 @@ def _read_record_with_channel_policy( ) -def read_record( - path: str | os.PathLike[str], - *, - start: int = 0, - stop: int | None = None, - channels: "Sequence[int] | np.ndarray | None" = None, - kind: str = "physical", - layout: str, - combine_segments: bool = True, - signal_alignment: str = "aligned", - resolution: int = 64, - force_channels: bool = True, - channel_names: "Sequence[str] | np.ndarray | None" = None, - missing_channels: str = "error", -): - """Read a WFDB record with explicit source, signal, and segment options. - - This returns the same mutable ``Record`` or ``MultiRecord`` as - ``rdrecord``. Multi-segment records are combined into one ``Record`` by - default. Choose ``layout="uniform"`` to smooth multi-frequency signals - to one value per frame, or ``layout="expanded"`` to retain every sample. - ``rdrecord`` retains its existing signature and behavior. - - Parameters - ---------- - path : str or os.PathLike - Local record stem or ``.hea`` filename, HTTP URL, supported cloud or - ``physionet://`` URI, or ``.wfdb`` archive path or URI. - start, stop : int, optional - First and exclusive final sample frame to read. - channels : sequence of int or 1D ndarray, optional - Channel indices to read. Cannot be combined with ``channel_names``. - kind : {"physical", "digital"}, optional - Load physical values into ``p_signal`` or ``e_p_signal``, or digital - values into ``d_signal`` or ``e_d_signal``. - layout : {"uniform", "expanded"} - Return one value per channel per frame, or every channel sample. - Uniform layout averages samples within a frame when a channel has - more than one sample per frame. - combine_segments : bool, optional - Combine a multi-segment source into one ``Record`` (default), or - preserve its segments in a ``MultiRecord``. - signal_alignment : {"aligned", "raw"}, optional - Whether returned values have channel skew applied (the default) or - retain the alignment of the stored file. - resolution : {8, 16, 32, 64}, optional - Numeric width of loaded signal values. Physical values cannot use 8. - force_channels : bool, optional - Retain requested channels in variable-layout multi-segment records - even when no selected segment contains them. - channel_names : sequence of str or 1D ndarray, optional - Channel names to read. Cannot be combined with ``channels``. - missing_channels : {"error", "ignore"}, optional - What to do when a requested channel name is absent from the source - header. By default, raise ``ValueError`` and list missing names. - Set to ``"ignore"`` to skip them, as ``rdrecord`` does. A channel - listed in a variable-layout header is valid even if it is absent - from the selected segments. If no requested names remain, both modes - raise an error. - - Returns - ------- - Record or MultiRecord - The selected, mutable record. A selected read describes the returned - frames and channels; ``source_segments`` records segment provenance - when a multi-segment source is combined. - - """ - _check_new_read_options(kind, layout, resolution, start, stop) - if signal_alignment not in ("aligned", "raw"): - raise ValueError("signal_alignment must be 'aligned' or 'raw'") - channels, channel_names = _normalize_modern_channel_selection( - channels, channel_names, missing_channels - ) - path = _normalize_header_filename(path) - try: - return _read_record_with_channel_policy( - record_name=path, - sampfrom=start, - sampto=stop, - channels=channels, - physical=kind == "physical", - pn_dir=None, - m2s=combine_segments, - smooth_frames=layout == "uniform", - ignore_skew=signal_alignment == "raw", - return_res=resolution, - force_channels=force_channels, - channel_names=channel_names, - warn_empty=False, - missing_channels=missing_channels, - ) - except (TypeError, ValueError) as error: - if message := _modern_read_range_message(error, start, stop): - raise type(error)(message) from error - raise - - def _modern_read_range_message(error, start, stop): """Translate legacy frame-range errors to precise modern argument names.""" message = str(error) @@ -3773,10 +3675,22 @@ def _check_new_read_range(start, stop): raise ValueError("stop must be greater than start") -def read_signals( - path, +class _RemovedCombineSegments: + """Show the migration-only argument clearly in help and signatures.""" + + def __repr__(self): + """Identify the removed option in the public signature.""" + return "" + + +_REMOVED_COMBINE_SEGMENTS = _RemovedCombineSegments() + + +def read_record( + path: str | os.PathLike[str], *, layout, + combine_segments=_REMOVED_COMBINE_SEGMENTS, start=0, stop=None, channels=None, @@ -3786,8 +3700,8 @@ def read_signals( force_channels=True, channel_names=None, missing_channels="error", -): - """Read one explicit signal representation and its logical metadata. +) -> RecordData: + """Read one selected record with its signal values and metadata. This reader shares the WFDB header parser and signal decoder with ``rdrecord``. A multi-segment source is combined into one returned view. @@ -3808,6 +3722,9 @@ def read_signals( layout : {"uniform", "expanded"} Required choice between one value per channel per frame and every channel sample. Uniform layout averages multi-frequency channels. + combine_segments : removed + Accepted only to give migration guidance. Omit it for combined data; + use ``read_segments`` for uncombined segments. signal_alignment : {"aligned", "raw"}, optional Whether returned values have channel skew applied (the default) or retain the alignment of the stored file. @@ -3832,6 +3749,17 @@ def read_signals( """ from wfdb.io.signal_values import _from_read_model + if combine_segments is True: + raise TypeError( + "read_record no longer accepts combine_segments in 6.0; " + "remove the argument because read_record always combines segments" + ) + if combine_segments is not _REMOVED_COMBINE_SEGMENTS: + raise TypeError( + "read_record no longer accepts combine_segments in 6.0; use " + "read_segments(...) for uncombined segments, or " + "rdrecord(..., m2s=False) for a mutable MultiRecord" + ) _check_new_read_options(kind, layout, resolution, start, stop) if signal_alignment not in ("aligned", "raw"): raise ValueError("signal_alignment must be 'aligned' or 'raw'") @@ -4131,7 +4059,7 @@ def _rdrecord( raise ValueError( "Cannot represent the skewed tail of a format 8 signal in a " "digital legacy Record: format 8 has no missing-sample marker. " - "Use read_signals for masked digital values, read physical " + "Use read_record for masked digital values, read physical " "values, or set ignore_skew=True." ) values = _signal._rd_segment( @@ -4492,7 +4420,7 @@ def chunks(): return chunks() -@deprecated_legacy_name("rdsamp", "read_signals") +@deprecated_legacy_name("rdsamp", "read_record") @warn_deprecated_pn_dir def rdsamp( record_name, @@ -5276,7 +5204,7 @@ def _skew_for_write(record: Record): raise ValueError( "Cannot match nonzero skew to source channels after a " "channel-count change; select channels with " - "read_record(..., channels=[...]) or clear skew before writing." + "rdrecord(..., channels=[...]) or clear skew before writing." ) elif tuple(current) != read_skew: raise ValueError( @@ -5298,7 +5226,7 @@ def _skew_for_write(record: Record): raise ValueError( "Cannot match nonzero skew to applied source channels after a " "channel-count change; select channels with " - "read_record(..., channels=[...]) or clear skew before writing." + "rdrecord(..., channels=[...]) or clear skew before writing." ) changed = [ index @@ -5377,7 +5305,7 @@ def _snapshot_record_write_channels( raise ValueError( f"{field} channel count {n_channels} disagrees with: " + ", ".join(mismatches) - + ". For a channel subset, use read_record(..., channels=[...]) " + + ". For a channel subset, use rdrecord(..., channels=[...]) " "or update n_sig and per-channel fields together." ) @@ -6098,7 +6026,7 @@ def write_record( ``signal_alignment="raw"`` first; changing that read's skew is rejected because the values may lack the extra samples. A manually reduced channel list can retain source skew when its values - remain in source order; use ``read_record(..., channels=[...])`` when + remain in source order; use ``rdrecord(..., channels=[...])`` when selecting channels from a source. A short raw-aligned read cannot be written with nonzero skew because it lacks the extra tail samples needed to preserve alignment. Read the full source or clear skew first. diff --git a/src/wfdb/io/signal_values.py b/src/wfdb/io/signal_values.py index 992eb586..3c912cfe 100644 --- a/src/wfdb/io/signal_values.py +++ b/src/wfdb/io/signal_values.py @@ -78,6 +78,28 @@ def __post_init__(self) -> None: raise ValueError("Expanded signal length does not match frame count") +_LEGACY_RECORD_ATTRIBUTE_HINTS = { + "p_signal": "use data.signals.values with kind='physical' and layout='uniform'", + "d_signal": "use data.signals.values with kind='digital' and layout='uniform'", + "e_p_signal": "use data.signals.values with kind='physical' and layout='expanded'", + "e_d_signal": "use data.signals.values with kind='digital' and layout='expanded'", + "fs": "use data.metadata.fs", + "sig_name": "use [s.name for s in data.metadata.signals]", + "n_sig": "use data.metadata.n_signals", + "sig_len": "use data.metadata.n_frames", + "units": "use [s.units for s in data.metadata.signals]", + "adc_gain": "use [s.adc_gain for s in data.metadata.signals]", + "baseline": "use [s.baseline for s in data.metadata.signals]", + "fmt": "use [s.storage.format for s in data.metadata.channels]", + "comments": "use data.metadata.comments", + "base_date": "use data.metadata.base_date", + "base_time": "use data.metadata.base_time", + "wrsamp": "use data.write(path) or write_record(path, data)", + "adc": "use data.to_digital()", + "dac": "use data.to_physical()", +} + + @dataclass(frozen=True, eq=False, init=False) class RecordData: """A selected record view with exactly one loaded signal representation. @@ -86,7 +108,7 @@ class RecordData: flattened multi-segment read, ``source_segments`` identifies the source segments. Conversions return another ``RecordData`` and leave this one unchanged. Use ``write`` to save the selected values. - Construct results through ``read_signals`` or ``read_segments``. Use + Construct results through ``read_record`` or ``read_segments``. Use ``select``, ``with_values``, ``with_channels``, ``with_comments``, and ``shift_time`` for validated edits; ``dataclasses.replace`` cannot construct a complete result with source provenance. @@ -143,9 +165,15 @@ def _record(self): def __init__(self, *args, **kwargs) -> None: """Reserve construction for the reader, which supplies calibration.""" raise TypeError( - "RecordData objects are returned by read_signals or read_segments" + "RecordData objects are returned by read_record or read_segments" ) + def __getattr__(self, name: str): + """Explain where common mutable Record fields moved in 6.0.""" + if hint := _LEGACY_RECORD_ATTRIBUTE_HINTS.get(name): + raise AttributeError(f"RecordData has no attribute {name!r}; {hint}") + raise AttributeError(f"RecordData has no attribute {name!r}") + def __setstate__(self, state: dict) -> None: """Load saved reads that predate the private reader model.""" restored = dict(state) diff --git a/tests/_legacy_reader.py b/tests/_legacy_reader.py new file mode 100644 index 00000000..46ed9b90 --- /dev/null +++ b/tests/_legacy_reader.py @@ -0,0 +1,36 @@ +"""Build mutable legacy records for tests of the retained Record API.""" + +import wfdb + + +def read_mutable_record( + path, + *, + start=0, + stop=None, + channels=None, + kind="physical", + layout="uniform", + combine_segments=True, + signal_alignment="aligned", + resolution=64, + force_channels=True, + channel_names=None, + missing_channels="error", +): + """Translate former read_record options to the retained rdrecord reader.""" + if missing_channels != "error": + raise ValueError("This test helper only supports strict channel names") + return wfdb.rdrecord.__wrapped__( + path, + sampfrom=start, + sampto=stop, + channels=channels, + physical=kind == "physical", + m2s=combine_segments, + smooth_frames=layout == "uniform", + ignore_skew=signal_alignment == "raw", + return_res=resolution, + force_channels=force_channels, + channel_names=channel_names, + ) diff --git a/tests/fixtures/read_record_v5_18.json b/tests/fixtures/read_record_v5_18.json new file mode 100644 index 00000000..221d98ad --- /dev/null +++ b/tests/fixtures/read_record_v5_18.json @@ -0,0 +1,3455 @@ +{ + "multi_041s_boundary:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "c1b4b1068fa137adaf74686b92035853d6ecb9b7baa29445a38c20ac18161f8f" + }, + { + "dtype": "int64", + "mask_sha256": "3892520e7b27c5ba8235287b9b76243832a16e418ac715b7f1cae13c7822e770", + "shape": [ + 32 + ], + "values_sha256": "e11f3044be34abea8e7a9361da347334b5b33758985e67205fc03d9bb90aa651" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "f42ad3d88f144a282871dce5b3bfe0772acfe60e3ab4740043bc85edf0fb3992" + }, + { + "dtype": "float64", + "mask_sha256": "3892520e7b27c5ba8235287b9b76243832a16e418ac715b7f1cae13c7822e770", + "shape": [ + 32 + ], + "values_sha256": "378223d5f3fe6abc4c153d9b589a1b1246626216950f56eeba394fff78388f73" + } + ], + "legacy_fields_sha256": "d0d49840ceaf19f9cd03bcaa853a3bea8668c2dd5000b23d00bc56196c0bb8e3", + "metadata": { + "all_fields_sha256": "dbd6d13f55958e9b07138902e6e25fce7602a8707ae94accf6979d64a4d26e72", + "channel_names": [ + "ABP", + "III" + ], + "fs": 125, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "041s" + }, + "provenance": { + "all_fields_sha256": "cddd6bfc743eb36e0338291086b2228c015c1f8c980ed52948afd9e903b09890", + "segments": [ + [ + "041s01", + 0, + 4 + ], + [ + "041s02", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 996, + "stop": 1004 + }, + "source_record_name": "041s", + "source_signal_record_name": "041s01" + }, + "stdout": "" + }, + "multi_041s_boundary:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "cfa5f72ff50bfbd763982590b1d2ee574075101d6e7acc5572132b353774141f" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "993a6e6037d74c7f51d2880693115ed2fc77243ee6f84c08a5f57c8e70559e6b" + } + ], + "legacy_fields_sha256": "921e5068d6cb0ba17fe0ccae822e606334a81915e865049d73de70e78484ea2a", + "metadata": { + "all_fields_sha256": "2018b631535c21c647524e68cef52c888719cff42358b50897ceafd75948df7a", + "channel_names": [ + "ABP", + "III" + ], + "fs": 125, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "041s" + }, + "provenance": { + "all_fields_sha256": "cddd6bfc743eb36e0338291086b2228c015c1f8c980ed52948afd9e903b09890", + "segments": [ + [ + "041s01", + 0, + 4 + ], + [ + "041s02", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 996, + "stop": 1004 + }, + "source_record_name": "041s", + "source_signal_record_name": "041s01" + }, + "stdout": "" + }, + "multi_041s_boundary:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "f42ad3d88f144a282871dce5b3bfe0772acfe60e3ab4740043bc85edf0fb3992" + }, + { + "dtype": "float64", + "mask_sha256": "3892520e7b27c5ba8235287b9b76243832a16e418ac715b7f1cae13c7822e770", + "shape": [ + 32 + ], + "values_sha256": "378223d5f3fe6abc4c153d9b589a1b1246626216950f56eeba394fff78388f73" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "c1b4b1068fa137adaf74686b92035853d6ecb9b7baa29445a38c20ac18161f8f" + }, + { + "dtype": "int64", + "mask_sha256": "3892520e7b27c5ba8235287b9b76243832a16e418ac715b7f1cae13c7822e770", + "shape": [ + 32 + ], + "values_sha256": "e11f3044be34abea8e7a9361da347334b5b33758985e67205fc03d9bb90aa651" + } + ], + "legacy_fields_sha256": "a690f3bd836e47bed6df274ed437a9a8be90e6ab231224d2a5402a68c04b1674", + "metadata": { + "all_fields_sha256": "e3cea1833b834bad06c6286ef94e586b52e39d91997b1f4e760a689a269664cf", + "channel_names": [ + "ABP", + "III" + ], + "fs": 125, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "041s" + }, + "provenance": { + "all_fields_sha256": "cddd6bfc743eb36e0338291086b2228c015c1f8c980ed52948afd9e903b09890", + "segments": [ + [ + "041s01", + 0, + 4 + ], + [ + "041s02", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 996, + "stop": 1004 + }, + "source_record_name": "041s", + "source_signal_record_name": "041s01" + }, + "stdout": "" + }, + "multi_041s_boundary:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "993a6e6037d74c7f51d2880693115ed2fc77243ee6f84c08a5f57c8e70559e6b" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "cfa5f72ff50bfbd763982590b1d2ee574075101d6e7acc5572132b353774141f" + } + ], + "legacy_fields_sha256": "f12f8e788caf04eb7eedb4bedd81c1df4764d8757d74039b65dd4fd41307ee21", + "metadata": { + "all_fields_sha256": "546708023ff82486dd403a67884bac3b80635ebe93b65df9d097d0ab6b3e0e5a", + "channel_names": [ + "ABP", + "III" + ], + "fs": 125, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "041s" + }, + "provenance": { + "all_fields_sha256": "cddd6bfc743eb36e0338291086b2228c015c1f8c980ed52948afd9e903b09890", + "segments": [ + [ + "041s01", + 0, + 4 + ], + [ + "041s02", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 996, + "stop": 1004 + }, + "source_record_name": "041s", + "source_signal_record_name": "041s01" + }, + "stdout": "" + }, + "multi_fixed_boundary:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "59b77812114accbf81ba4604dc96ae0b965b24cbc63a9dd4ef1d0605a3450b35" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "3d52be510efa0b694fb5ed46e3a7d379e76a625699ea12c3caa845ddb3d2ae5b" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "d044e635437575fc4dac923cedf9710e6a65a4ef14cf83f73cbf0194115199a2" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "dd4c1e254ff16ea9977733071257eb634c6bd600345ac8e5e529cfe50acac32d" + } + ], + "legacy_fields_sha256": "d569fc54230602b6385bd05c22e75aed67100f0d1ec779ab46328fd343bd5262", + "metadata": { + "all_fields_sha256": "e8688e8a4bac0108528257f119cc2fc065e51a6a711d66e7434699999c1bf249", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "16de24e3954d3ee73b33398d113e552689f6d3ff4929669a7e2bd784d07b5ced", + "segments": [ + [ + "v102s_1", + 0, + 4 + ], + [ + "v102s_2", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 74996, + "stop": 75004 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_1" + }, + "stdout": "" + }, + "multi_fixed_boundary:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "7ee338948d87585821e2ecaedec08feab9b1c5b0009f2d00a049233495628136" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "df9834d71cc04784caddb0c0f2c62aae95c51fa02dc3babefe0961a2eac57d36" + } + ], + "legacy_fields_sha256": "0aa784ccc53a6367bf4faaa7cb0bcba703f30cd62f9900a3dca3ffa64b574bd9", + "metadata": { + "all_fields_sha256": "f7b4ff5b88b349577cd4609be2038d872b5d875215c8669fb88e531db5b1626c", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "16de24e3954d3ee73b33398d113e552689f6d3ff4929669a7e2bd784d07b5ced", + "segments": [ + [ + "v102s_1", + 0, + 4 + ], + [ + "v102s_2", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 74996, + "stop": 75004 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_1" + }, + "stdout": "" + }, + "multi_fixed_boundary:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "d044e635437575fc4dac923cedf9710e6a65a4ef14cf83f73cbf0194115199a2" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "dd4c1e254ff16ea9977733071257eb634c6bd600345ac8e5e529cfe50acac32d" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "59b77812114accbf81ba4604dc96ae0b965b24cbc63a9dd4ef1d0605a3450b35" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "3d52be510efa0b694fb5ed46e3a7d379e76a625699ea12c3caa845ddb3d2ae5b" + } + ], + "legacy_fields_sha256": "ff96c956f7ee3a8909a7cd70803ff6be2f82446da2d7f3c7f9d0c6d23a3b1174", + "metadata": { + "all_fields_sha256": "91fc0f5ff92536e40c8f4caded1fcc469bf74ef09b3dac5dc9306c6a9bce884f", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "16de24e3954d3ee73b33398d113e552689f6d3ff4929669a7e2bd784d07b5ced", + "segments": [ + [ + "v102s_1", + 0, + 4 + ], + [ + "v102s_2", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 74996, + "stop": 75004 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_1" + }, + "stdout": "" + }, + "multi_fixed_boundary:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "df9834d71cc04784caddb0c0f2c62aae95c51fa02dc3babefe0961a2eac57d36" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "7ee338948d87585821e2ecaedec08feab9b1c5b0009f2d00a049233495628136" + } + ], + "legacy_fields_sha256": "07bc33ce7ce5ebe4ea6a7fbabf3fa95390fa52166617a97c23e8db713d1121b8", + "metadata": { + "all_fields_sha256": "9d592a827b4906dfaddb5e4c43a0dd4aac5cd18a3c6d8d97e8fba1e93dc096f9", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "16de24e3954d3ee73b33398d113e552689f6d3ff4929669a7e2bd784d07b5ced", + "segments": [ + [ + "v102s_1", + 0, + 4 + ], + [ + "v102s_2", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 74996, + "stop": 75004 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_1" + }, + "stdout": "" + }, + "multi_fixed_later:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "05bf5aeb7ea4c586693cd91d92a8dd21cf48a6fe80cb340d6a7fc332c4d798c0" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "d1a44e235ea538f70910ed192b2265ec66efc1bf6539e062c39d9b5332d0f35b" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "fcc5744c604bc45f57f5cf43514690b2e5c11109d1e965a75bb3b372450af3e5" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "62021cf7d4f2580d11ea7385f7c6383631f462d6cc505fcb4a8224e18e845f9b" + } + ], + "legacy_fields_sha256": "c47b86cd439f552c45abc4b81b67200a514ea146f2d17cb1e67388f15eb06eb1", + "metadata": { + "all_fields_sha256": "03bc5607c68bf6f25071e6f53973d26880511e0a71bda430be5a59c40bcb0313", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "666a7e1d3a1a58fc20f9cfd96e0aa7d7505e45f8820bc6e04226a8c99a73f6c0", + "segments": [ + [ + "v102s_3", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 150000, + "stop": 150008 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_3" + }, + "stdout": "" + }, + "multi_fixed_later:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "d53ba4acd9df74e1a9a9b43351f879a84a37b863d9cfef0c1450b3c2f69f6b01" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "73f0f1399f0b7927416b88f5528f79d8ef03e37e3785cdcac292f268ef7e2670" + } + ], + "legacy_fields_sha256": "41800011c48fc6b02aad37ac1481c98a23d56cb3b4906ce1248c5e33f864be34", + "metadata": { + "all_fields_sha256": "3a81152abe5e5bf6db36194cd968a9bdc70872f98a9c49e158fe45e14a631892", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "666a7e1d3a1a58fc20f9cfd96e0aa7d7505e45f8820bc6e04226a8c99a73f6c0", + "segments": [ + [ + "v102s_3", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 150000, + "stop": 150008 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_3" + }, + "stdout": "" + }, + "multi_fixed_later:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "fcc5744c604bc45f57f5cf43514690b2e5c11109d1e965a75bb3b372450af3e5" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "62021cf7d4f2580d11ea7385f7c6383631f462d6cc505fcb4a8224e18e845f9b" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "05bf5aeb7ea4c586693cd91d92a8dd21cf48a6fe80cb340d6a7fc332c4d798c0" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "d1a44e235ea538f70910ed192b2265ec66efc1bf6539e062c39d9b5332d0f35b" + } + ], + "legacy_fields_sha256": "8cd1b0d844f015bbf8e82eee3df263d75727fc209f8bce50f00c98467b267dac", + "metadata": { + "all_fields_sha256": "91fc0f5ff92536e40c8f4caded1fcc469bf74ef09b3dac5dc9306c6a9bce884f", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "666a7e1d3a1a58fc20f9cfd96e0aa7d7505e45f8820bc6e04226a8c99a73f6c0", + "segments": [ + [ + "v102s_3", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 150000, + "stop": 150008 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_3" + }, + "stdout": "" + }, + "multi_fixed_later:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "73f0f1399f0b7927416b88f5528f79d8ef03e37e3785cdcac292f268ef7e2670" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "d53ba4acd9df74e1a9a9b43351f879a84a37b863d9cfef0c1450b3c2f69f6b01" + } + ], + "legacy_fields_sha256": "4d02e2ebce0e2588b37903d31f29ab8605cc3f4df80e7a9eb086858c399cf0ac", + "metadata": { + "all_fields_sha256": "9d592a827b4906dfaddb5e4c43a0dd4aac5cd18a3c6d8d97e8fba1e93dc096f9", + "channel_names": [ + "RESP", + "II" + ], + "fs": 250, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "v102s" + }, + "provenance": { + "all_fields_sha256": "666a7e1d3a1a58fc20f9cfd96e0aa7d7505e45f8820bc6e04226a8c99a73f6c0", + "segments": [ + [ + "v102s_3", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 150000, + "stop": 150008 + }, + "source_record_name": "v102s", + "source_signal_record_name": "v102s_3" + }, + "stdout": "" + }, + "multi_variable_boundary_one:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "3b1fb14be27ea8cf0081d305dba89cdaf6c97623c055b0bc60dd17275e7c9fba", + "shape": [ + 11 + ], + "values_sha256": "2d06d8c92476ab940d0b00eb963f3b6daaa36f34d55f5e667d347b6dac79804f" + }, + { + "dtype": "int64", + "mask_sha256": "3b1fb14be27ea8cf0081d305dba89cdaf6c97623c055b0bc60dd17275e7c9fba", + "shape": [ + 11 + ], + "values_sha256": "7f5a4eaebca99f4f44b7e479d053acc6b3e55007c0b5d9ece05958a143515af4" + }, + { + "dtype": "int64", + "mask_sha256": "db69d39b42c724d9237f5a11bb61994a1fe0cae9b21a5d13bb2c6eb2d700491b", + "shape": [ + 11 + ], + "values_sha256": "eea3a085fc52e5a0c1ba659cb9764550dcffd1d1acc7bb72841df8371afe76e3" + }, + { + "dtype": "int64", + "mask_sha256": "e555d2df4e09bb6ffe46ccbaa8a8f14646499e3f920ac03a127794e1d9db8e54", + "shape": [ + 11 + ], + "values_sha256": "196a06516a5f1dce54a25b498d050bc9e124dcefc3a173ecad3090eb5d2acf02" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 2 (MCL1): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "8212c6338f521d3766272ba3c8c1a0d56ed20fc9f3d7d8cee77359b496499b96", + "metadata": { + "all_fields_sha256": "ddbb547edfa2257cb8aa8a97e72d0dacc04381cf66e8bb2b53b27171fb394b99", + "channel_names": [ + "II", + "V", + "MCL1", + "ABP" + ], + "fs": 125, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 11, + "n_signals": 4, + "record_name": "s00001-2896-10-10-00-31" + }, + "provenance": { + "all_fields_sha256": "861cb8a37a6e92656db9acb47d805ba1e6f5d4bd24c4c466ac402f9b93a701ee", + "segments": [ + [ + "3975656_0011", + 0, + 1 + ], + [ + "3975656_0012", + 1, + 11 + ] + ], + "selection": { + "channels": [ + 0, + 1, + 2, + 3 + ], + "start": 14428364, + "stop": 14428375 + }, + "source_record_name": "s00001-2896-10-10-00-31", + "source_signal_record_name": "3975656_layout" + }, + "stdout": "" + }, + "multi_variable_boundary_one:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "f72e792aa3370b776fbf0ef2e2ae62edc084c74d3ff56f05ca19a59d26dcd795", + "shape": [ + 11, + 4 + ], + "values_sha256": "afe6deccd1769859cd2a7f65f27d553c72a828e0a71316b4b5f4402121ccc75b" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 2 (MCL1): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "3222ebed43b91daa362cccf1f75c10cec5a6f5135653407c07dd94d7e1b33370", + "metadata": { + "all_fields_sha256": "136c5749f8ed84a75c1d4906186ac331085711a68056f4b936cc91ec852e57bd", + "channel_names": [ + "II", + "V", + "MCL1", + "ABP" + ], + "fs": 125, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 11, + "n_signals": 4, + "record_name": "s00001-2896-10-10-00-31" + }, + "provenance": { + "all_fields_sha256": "861cb8a37a6e92656db9acb47d805ba1e6f5d4bd24c4c466ac402f9b93a701ee", + "segments": [ + [ + "3975656_0011", + 0, + 1 + ], + [ + "3975656_0012", + 1, + 11 + ] + ], + "selection": { + "channels": [ + 0, + 1, + 2, + 3 + ], + "start": 14428364, + "stop": 14428375 + }, + "source_record_name": "s00001-2896-10-10-00-31", + "source_signal_record_name": "3975656_layout" + }, + "stdout": "" + }, + "multi_variable_boundary_one:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "3b1fb14be27ea8cf0081d305dba89cdaf6c97623c055b0bc60dd17275e7c9fba", + "shape": [ + 11 + ], + "values_sha256": "590bef2b07a2c2252c00ad166d838ecef346ab44ecfc8706674950763b299eae" + }, + { + "dtype": "float64", + "mask_sha256": "3b1fb14be27ea8cf0081d305dba89cdaf6c97623c055b0bc60dd17275e7c9fba", + "shape": [ + 11 + ], + "values_sha256": "008a7183ff14e5323c3e3985a42e646cae41666d5a677d2e7a6f70724ff8ee5f" + }, + { + "dtype": "float64", + "mask_sha256": "3b1fb14be27ea8cf0081d305dba89cdaf6c97623c055b0bc60dd17275e7c9fba", + "shape": [ + 11 + ], + "values_sha256": "6b5f8ca7a01131dd4425b6cf437d627d2e8fc1c939d093e39eebbc2d996343ce" + }, + { + "dtype": "float64", + "mask_sha256": "3b1fb14be27ea8cf0081d305dba89cdaf6c97623c055b0bc60dd17275e7c9fba", + "shape": [ + 11 + ], + "values_sha256": "66fa53e88cda6691fe69d8723f978763c4a643d50f89c8fae277f6fb4b17814b" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 2 (MCL1): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "ea71ee63749b10d9fffe56bc1f01f26161fcc09ba81208e0e1e659c8c207f824", + "metadata": { + "all_fields_sha256": "f6ecff7fed6906bb25a820e187c05e1895334c34ece9ef245a1232e692e0a2a5", + "channel_names": [ + "II", + "V", + "MCL1", + "ABP" + ], + "fs": 125, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 11, + "n_signals": 4, + "record_name": "s00001-2896-10-10-00-31" + }, + "provenance": { + "all_fields_sha256": "861cb8a37a6e92656db9acb47d805ba1e6f5d4bd24c4c466ac402f9b93a701ee", + "segments": [ + [ + "3975656_0011", + 0, + 1 + ], + [ + "3975656_0012", + 1, + 11 + ] + ], + "selection": { + "channels": [ + 0, + 1, + 2, + 3 + ], + "start": 14428364, + "stop": 14428375 + }, + "source_record_name": "s00001-2896-10-10-00-31", + "source_signal_record_name": "3975656_layout" + }, + "stdout": "" + }, + "multi_variable_boundary_one:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "babc0ccc8cb3fcb0f7e4d05a98cfd6ea5d9651c67f5ca521cee316e23e75b81a", + "shape": [ + 11, + 4 + ], + "values_sha256": "5a803776966001d660b16f29f6fd442fb1cf2cd883ae11f2ee75b57001e45824" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 2 (MCL1): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "704ebe0aa1b6923305e5d2dfd757e326126df7f4a16f3b93ac9a9064ff09552b", + "metadata": { + "all_fields_sha256": "5def1aac52c43806136605a9713d4d65587d330ac63591e92fdd6d677614c759", + "channel_names": [ + "II", + "V", + "MCL1", + "ABP" + ], + "fs": 125, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 11, + "n_signals": 4, + "record_name": "s00001-2896-10-10-00-31" + }, + "provenance": { + "all_fields_sha256": "861cb8a37a6e92656db9acb47d805ba1e6f5d4bd24c4c466ac402f9b93a701ee", + "segments": [ + [ + "3975656_0011", + 0, + 1 + ], + [ + "3975656_0012", + 1, + 11 + ] + ], + "selection": { + "channels": [ + 0, + 1, + 2, + 3 + ], + "start": 14428364, + "stop": 14428375 + }, + "source_record_name": "s00001-2896-10-10-00-31", + "source_signal_record_name": "3975656_layout" + }, + "stdout": "" + }, + "multi_variable_boundary_two:digital:expanded": { + "error": "Cannot combine s00001-2896-10-10-00-31 as digital values: channel 'MCL1' has different adc_gain across segments (26.0 and 66.0)", + "error_type": "ValueError", + "stdout": "" + }, + "multi_variable_boundary_two:digital:uniform": { + "error": "Cannot combine s00001-2896-10-10-00-31 as digital values: channel 'MCL1' has different adc_gain across segments (26.0 and 66.0)", + "error_type": "ValueError", + "stdout": "" + }, + "multi_variable_boundary_two:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "8d82c118383e08f8ea30bce859b773e73204e48bb05cf11f42843ff59ba4eb15" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "772678da0f939586f29ed95648d14ec71733cc13d13a47a5a83552cc2f4906ab" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "cd641507aeebc3c1a50fd3c3e9182b8648183cb15ec0b7f4ac2a6208f95d2a73" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "8d82c118383e08f8ea30bce859b773e73204e48bb05cf11f42843ff59ba4eb15" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 0 (II): fmt, adc_gain, baseline; 1 (V): adc_gain; 2 (MCL1): adc_gain; 3 (ABP): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "a796a6db76f74077483b0c5a616784a2921931ae5891dd0780a91c63f1cd0aa8", + "metadata": { + "all_fields_sha256": "e933a5ac61e066cdad132c7a202cc9ca4badac8d1541e7e9fedc1e4ecc67396c", + "channel_names": [ + "II", + "V", + "MCL1", + "ABP" + ], + "fs": 125, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 4, + "record_name": "s00001-2896-10-10-00-31" + }, + "provenance": { + "all_fields_sha256": "016fef8034bf95ae340d641dfb5b17608eb6ec5a27d329fbde8335adabec7fb5", + "segments": [ + [ + "3975656_0006", + 0, + 4 + ], + [ + "3975656_0007", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 0, + 1, + 2, + 3 + ], + "start": 2225802, + "stop": 2225810 + }, + "source_record_name": "s00001-2896-10-10-00-31", + "source_signal_record_name": "3975656_layout" + }, + "stdout": "" + }, + "multi_variable_boundary_two:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "591f9351c939e4e6f08d8248c2205c64cba0c0cdbd945f34995482558560df64", + "shape": [ + 8, + 4 + ], + "values_sha256": "f31974be8ac1d0377f77db596a51ea7555f03627e1c2f76d4ff2a93b8275c66c" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 0 (II): fmt, adc_gain, baseline; 1 (V): adc_gain; 2 (MCL1): adc_gain; 3 (ABP): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "2dcdb9b1165891d89f74e7831b3178fcdc9220a36104ffd0e9f91a790019b381", + "metadata": { + "all_fields_sha256": "7505a3a687f93db7a0f0caa00772955445355a28265e800534e7cba14392f59e", + "channel_names": [ + "II", + "V", + "MCL1", + "ABP" + ], + "fs": 125, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 4, + "record_name": "s00001-2896-10-10-00-31" + }, + "provenance": { + "all_fields_sha256": "016fef8034bf95ae340d641dfb5b17608eb6ec5a27d329fbde8335adabec7fb5", + "segments": [ + [ + "3975656_0006", + 0, + 4 + ], + [ + "3975656_0007", + 4, + 8 + ] + ], + "selection": { + "channels": [ + 0, + 1, + 2, + 3 + ], + "start": 2225802, + "stop": 2225810 + }, + "source_record_name": "s00001-2896-10-10-00-31", + "source_signal_record_name": "3975656_layout" + }, + "stdout": "" + }, + "multi_variable_empty_selection:digital:expanded": { + "error": "No selected channels are present in the requested sample range", + "error_type": "ValueError", + "stdout": "" + }, + "multi_variable_empty_selection:digital:uniform": { + "error": "No selected channels are present in the requested sample range", + "error_type": "ValueError", + "stdout": "" + }, + "multi_variable_empty_selection:physical:expanded": { + "error": "No selected channels are present in the requested sample range", + "error_type": "ValueError", + "stdout": "" + }, + "multi_variable_empty_selection:physical:uniform": { + "error": "No selected channels are present in the requested sample range", + "error_type": "ValueError", + "stdout": "" + }, + "multi_variable_names:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "66f6a90e01cf2114ae218f6e44f53e9400c5090e586794d481a3d59c133fc3fa", + "shape": [ + 8 + ], + "values_sha256": "fb1c8a00d4406bc7e2bce76710358385b2ecc86d1e559be1b8c3341cb5085f7b" + }, + { + "dtype": "int64", + "mask_sha256": "66f6a90e01cf2114ae218f6e44f53e9400c5090e586794d481a3d59c133fc3fa", + "shape": [ + 8 + ], + "values_sha256": "fb1c8a00d4406bc7e2bce76710358385b2ecc86d1e559be1b8c3341cb5085f7b" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 0 (ABP): fmt, adc_gain, baseline; 1 (II): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "2ac793a3d1be1f73b2b883afc43be84f1df97e984c1132f942769e9c54c29e62", + "metadata": { + "all_fields_sha256": "34bc48acf3717980dd7a2bcb159bddb7eecbfefe771c425f8c878368a1632611", + "channel_names": [ + "ABP", + "II" + ], + "fs": 125, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "s25047-2704-05-04-10-44" + }, + "provenance": { + "all_fields_sha256": "d63a243247c22c7235f9ae8c196c203e198d51829c232ad8ed289982b6172187", + "segments": [ + [ + "~", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 2, + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "s25047-2704-05-04-10-44", + "source_signal_record_name": "3234460_layout" + }, + "stdout": "" + }, + "multi_variable_names:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "9bb1dbae7c8e8bc1d682a0473cfcdccdaa399bfde4e89dfa200fcbc177786bf0", + "shape": [ + 8, + 2 + ], + "values_sha256": "ded47a1d528c058537f1c0bc5e9756fbadb8d978210ac3bbc0a095e6feb270bf" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 0 (ABP): fmt, adc_gain, baseline; 1 (II): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "b499868a7768ef9aed398b509aee4348d9aa8906daee3455bb03d24320346cd9", + "metadata": { + "all_fields_sha256": "bcc93208f036f858251770c5f8a001f4e0f3c796d57e188e2b55586ae20f5e2b", + "channel_names": [ + "ABP", + "II" + ], + "fs": 125, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "s25047-2704-05-04-10-44" + }, + "provenance": { + "all_fields_sha256": "d63a243247c22c7235f9ae8c196c203e198d51829c232ad8ed289982b6172187", + "segments": [ + [ + "~", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 2, + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "s25047-2704-05-04-10-44", + "source_signal_record_name": "3234460_layout" + }, + "stdout": "" + }, + "multi_variable_names:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "8d82c118383e08f8ea30bce859b773e73204e48bb05cf11f42843ff59ba4eb15" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "8d82c118383e08f8ea30bce859b773e73204e48bb05cf11f42843ff59ba4eb15" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 0 (ABP): fmt, adc_gain, baseline; 1 (II): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "67188651ba81b22a5a00fa4efa030f162207d35e09544967e0fedcc42f25e560", + "metadata": { + "all_fields_sha256": "c335b60058e111b80401e4b448c7d096cbe5560ed2b62a19cd8314a59d12ff01", + "channel_names": [ + "ABP", + "II" + ], + "fs": 125, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "s25047-2704-05-04-10-44" + }, + "provenance": { + "all_fields_sha256": "d63a243247c22c7235f9ae8c196c203e198d51829c232ad8ed289982b6172187", + "segments": [ + [ + "~", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 2, + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "s25047-2704-05-04-10-44", + "source_signal_record_name": "3234460_layout" + }, + "stdout": "" + }, + "multi_variable_names:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "2fc17bd879e5b549350182d20baffd756af9806b42b75ca59e21c9851580e9fe" + } + ], + "conversion": { + "error": "Cannot convert signal values; missing channel fields: 0 (ABP): fmt, adc_gain, baseline; 1 (II): fmt, adc_gain, baseline", + "error_type": "ValueError" + }, + "legacy_fields_sha256": "08c9c5de38cf087395aeedf1ea14d10d15cd88f05d44534745ce1308897c0ec0", + "metadata": { + "all_fields_sha256": "c57e624279888cb9f3fce838c2aee73272b40eb9c925e5a3d9eb7a8ac12c8ac3", + "channel_names": [ + "ABP", + "II" + ], + "fs": 125, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "s25047-2704-05-04-10-44" + }, + "provenance": { + "all_fields_sha256": "d63a243247c22c7235f9ae8c196c203e198d51829c232ad8ed289982b6172187", + "segments": [ + [ + "~", + 0, + 8 + ] + ], + "selection": { + "channels": [ + 2, + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "s25047-2704-05-04-10-44", + "source_signal_record_name": "3234460_layout" + }, + "stdout": "" + }, + "single_basic:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "8922f38557b13e63081af8ad2e1f5d53dd24815fd77e03ed18c545705f2011e0" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "283aeea6b8d4f80ec0318795370ffe5ca0442a0b06a2db503966f047be4a97ff" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "77e7d6d2f1976c9f11eabb22b67b0e8609031ee6dfe6f22d5d6c58907283f7a6" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "c9f3c9fa238e7b5a61e970d7ccfee1bbc4474bc35b293d03668d69f2cdd8cb52" + } + ], + "legacy_fields_sha256": "14e408308ff2fbeb7bd4bbd2fd5d4a26e96f64e722fe1888b642a64950e62d22", + "metadata": { + "all_fields_sha256": "a7a82b7a98d8398c56faf5cd357ed9b7e27023c31303f8f2ee3c61ce5249212d", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "7f7b35ab9f60899a4895784b170f69bc7c7b14d2b98aaff8f0c61f6294d0069c", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_basic:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "fa424a1e384540b53b891555e615617f01572e76e085fa728606f0482c7088fd" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "662b3431e849bc479fca53a0ffa18d7a68f0c302afbb985b2b203fea292c931c" + } + ], + "legacy_fields_sha256": "2e08c69a512b41921324d000e05597655029706b845a4ef1480c3d3624dce814", + "metadata": { + "all_fields_sha256": "7a30d8e24e2dc4f7b424c341be254cd69e46d17074e2cb86de889daf1cbeca4e", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "7f7b35ab9f60899a4895784b170f69bc7c7b14d2b98aaff8f0c61f6294d0069c", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_basic:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "77e7d6d2f1976c9f11eabb22b67b0e8609031ee6dfe6f22d5d6c58907283f7a6" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "c9f3c9fa238e7b5a61e970d7ccfee1bbc4474bc35b293d03668d69f2cdd8cb52" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "8922f38557b13e63081af8ad2e1f5d53dd24815fd77e03ed18c545705f2011e0" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "283aeea6b8d4f80ec0318795370ffe5ca0442a0b06a2db503966f047be4a97ff" + } + ], + "legacy_fields_sha256": "e40d33239479867e21c60adc63e8cf7cc9dd6442156a18636d5b17ee0861c0ea", + "metadata": { + "all_fields_sha256": "9053de08fc8276573f02c05ae93f169890dca40186ccc7f8bc1040e804cfe5e1", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "7f7b35ab9f60899a4895784b170f69bc7c7b14d2b98aaff8f0c61f6294d0069c", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_basic:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "662b3431e849bc479fca53a0ffa18d7a68f0c302afbb985b2b203fea292c931c" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "fa424a1e384540b53b891555e615617f01572e76e085fa728606f0482c7088fd" + } + ], + "legacy_fields_sha256": "c49ee316d1be3399281662997c51ea33492ffcd54c9978584e84c354a82b61d7", + "metadata": { + "all_fields_sha256": "aec46efb5ffe181ddd303780f62ffb6c2eba69c396988fdd42e88311961f7826", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "7f7b35ab9f60899a4895784b170f69bc7c7b14d2b98aaff8f0c61f6294d0069c", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_format_24:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "9fb71e375836469f583fa86cffd87582d50dcf74a45fe9f522aaaba7aedf3422" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "2107680ea5124cceda8bfd998b0ab10c075c64bad3056546ddc17562267e5bab" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "cbfdbbd49f90a6cd9a7fe666a8362e9cbe16d22528517b2087788eb663f89479" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "324fbdc12cc3ee91db3674f2230fe1df26b9e4c5f88a507071c0da58b18c6f71" + } + ], + "legacy_fields_sha256": "c807867f0154ccb9e001774533ae38ca04bdbf9fc15f07ef913338d3acdc46f0", + "metadata": { + "all_fields_sha256": "42a7062e37da7ad9b1b29a6b3d161dccf16a6601ba74cb5507650d8714b31c0e", + "channel_names": [ + null, + null + ], + "fs": 48000, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "n8_evoked_raw_95_F1_R9" + }, + "provenance": { + "all_fields_sha256": "e468b5d6c0b2632536ecfdc1ad5538fae96b1c96e16e379584ad2d8a54010065", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "n8_evoked_raw_95_F1_R9", + "source_signal_record_name": "n8_evoked_raw_95_F1_R9" + }, + "stdout": "" + }, + "single_format_24:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "f66eb6050d8b43b2c0be8fc427abede3c9284431971463fc40188e71c10c4922" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "717b5bdd8ed8d1055c573bfe27ce2d90f001e895714479705d9ed193ab4887ff" + } + ], + "legacy_fields_sha256": "0047f1068c9bfb5aa3b6c7e1bd241ac22df3c3fc24a327dd42a3bc0866b84948", + "metadata": { + "all_fields_sha256": "dee87535d56af411c481fd31748440b3b344223d58697ac8e5c081bc4f0d6bfd", + "channel_names": [ + null, + null + ], + "fs": 48000, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "n8_evoked_raw_95_F1_R9" + }, + "provenance": { + "all_fields_sha256": "e468b5d6c0b2632536ecfdc1ad5538fae96b1c96e16e379584ad2d8a54010065", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "n8_evoked_raw_95_F1_R9", + "source_signal_record_name": "n8_evoked_raw_95_F1_R9" + }, + "stdout": "" + }, + "single_format_24:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "cbfdbbd49f90a6cd9a7fe666a8362e9cbe16d22528517b2087788eb663f89479" + }, + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "324fbdc12cc3ee91db3674f2230fe1df26b9e4c5f88a507071c0da58b18c6f71" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "9fb71e375836469f583fa86cffd87582d50dcf74a45fe9f522aaaba7aedf3422" + }, + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "2107680ea5124cceda8bfd998b0ab10c075c64bad3056546ddc17562267e5bab" + } + ], + "legacy_fields_sha256": "fe4c0f25e660384b43713e83ea52ca2ec787ba6b6381b09d3284f557f429e047", + "metadata": { + "all_fields_sha256": "f850642b8778c531e5893f43ecdabfaff2396562cfaf95d7a6aa29d188930581", + "channel_names": [ + null, + null + ], + "fs": 48000, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "n8_evoked_raw_95_F1_R9" + }, + "provenance": { + "all_fields_sha256": "e468b5d6c0b2632536ecfdc1ad5538fae96b1c96e16e379584ad2d8a54010065", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "n8_evoked_raw_95_F1_R9", + "source_signal_record_name": "n8_evoked_raw_95_F1_R9" + }, + "stdout": "" + }, + "single_format_24:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "717b5bdd8ed8d1055c573bfe27ce2d90f001e895714479705d9ed193ab4887ff" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "c6973f90586724ce8989c7fde51224d88489bd5b6b5898f398f5c22e3990fbc4", + "shape": [ + 8, + 2 + ], + "values_sha256": "f66eb6050d8b43b2c0be8fc427abede3c9284431971463fc40188e71c10c4922" + } + ], + "legacy_fields_sha256": "f79d16bf627bde426e6adc5a4a3c49d5525af7715a35806807e6cda7127ec535", + "metadata": { + "all_fields_sha256": "73329d593349c8da7fd22c2ddf4f9360755f0e420aeb6a0ba15b3a52090a9c35", + "channel_names": [ + null, + null + ], + "fs": 48000, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 2, + "record_name": "n8_evoked_raw_95_F1_R9" + }, + "provenance": { + "all_fields_sha256": "e468b5d6c0b2632536ecfdc1ad5538fae96b1c96e16e379584ad2d8a54010065", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "n8_evoked_raw_95_F1_R9", + "source_signal_record_name": "n8_evoked_raw_95_F1_R9" + }, + "stdout": "" + }, + "single_format_8:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "0b88fe727df6606696b8ad899d6507b68563500cb0459fd1488f2a6c0e8335e3" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "80b4189f9df11ec09881ab7c094d7c20a9e525106c0b618a4e4f764ba0643ed0" + } + ], + "legacy_fields_sha256": "5121d40bd0bfa01ed24cc9faad6d109e438551917006a5183ca619e2672b9b9d", + "metadata": { + "all_fields_sha256": "1fe1b6e7e8afd4e1f2637b1af61c74eb3efdaced2c129fb499486737a927914b", + "channel_names": [ + "sig 0, fmt 8" + ], + "fs": 200, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "binformats" + }, + "provenance": { + "all_fields_sha256": "fc81cfaa267eb21f2a919e56a178c6e8e8badb7338d5ff4de93a26d065c7d22b", + "segments": [], + "selection": { + "channels": [ + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "binformats", + "source_signal_record_name": "binformats" + }, + "stdout": "" + }, + "single_format_8:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "8f1aa32f34cd3ef3691134ee7ed3e8e20f2df69878158068f3250aadffc5a812" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "6353786707d5739899ae911643c0d266330a7e4899b3808e194e3deef218a9e7" + } + ], + "legacy_fields_sha256": "fd8fd835e36714fca65960fe4e3db44943056a2f21a50f6a467276f9f008b824", + "metadata": { + "all_fields_sha256": "609847b3457995c03bf1c3d79172daf638e9d6f902daacb08dc8d5eea84f0226", + "channel_names": [ + "sig 0, fmt 8" + ], + "fs": 200, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "binformats" + }, + "provenance": { + "all_fields_sha256": "fc81cfaa267eb21f2a919e56a178c6e8e8badb7338d5ff4de93a26d065c7d22b", + "segments": [], + "selection": { + "channels": [ + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "binformats", + "source_signal_record_name": "binformats" + }, + "stdout": "" + }, + "single_format_8:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "80b4189f9df11ec09881ab7c094d7c20a9e525106c0b618a4e4f764ba0643ed0" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "0b88fe727df6606696b8ad899d6507b68563500cb0459fd1488f2a6c0e8335e3" + } + ], + "legacy_fields_sha256": "7c8904fd807bc1f5ec1632f17bbac1fa7af1a67ba753f9a0b7c20bc7a8a6e385", + "metadata": { + "all_fields_sha256": "0574bb92564a3678b835100f42e7e59495a9ef4742067cb2a4cd32bf16eb9587", + "channel_names": [ + "sig 0, fmt 8" + ], + "fs": 200, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "binformats" + }, + "provenance": { + "all_fields_sha256": "fc81cfaa267eb21f2a919e56a178c6e8e8badb7338d5ff4de93a26d065c7d22b", + "segments": [], + "selection": { + "channels": [ + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "binformats", + "source_signal_record_name": "binformats" + }, + "stdout": "" + }, + "single_format_8:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "6353786707d5739899ae911643c0d266330a7e4899b3808e194e3deef218a9e7" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "8f1aa32f34cd3ef3691134ee7ed3e8e20f2df69878158068f3250aadffc5a812" + } + ], + "legacy_fields_sha256": "f78dacb6ab323f3d07bc2ded340bdfcf82ce642c79171638a0e801e095f57050", + "metadata": { + "all_fields_sha256": "fb0e1aa6355e1c12f29bcc71957bdaedfff4d0854e3738c3f57708da647b799d", + "channel_names": [ + "sig 0, fmt 8" + ], + "fs": 200, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "binformats" + }, + "provenance": { + "all_fields_sha256": "fc81cfaa267eb21f2a919e56a178c6e8e8badb7338d5ff4de93a26d065c7d22b", + "segments": [], + "selection": { + "channels": [ + 0 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "binformats", + "source_signal_record_name": "binformats" + }, + "stdout": "" + }, + "single_frame:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "7302eac0a8325b333cd0b8fb27ce3d70e8cadfab92a8b19d03ddefd18fe329cc" + }, + { + "dtype": "int64", + "mask_sha256": "6ee51d51f823835e17d2ea4ea2617ba98fa28d3a1b8137da86f8427abbb5f94c", + "shape": [ + 6 + ], + "values_sha256": "e916cb1b6619e194fff92afe50a5adcf81b2f9c95679c556c1144f9c7c853a15" + }, + { + "dtype": "int64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "e6fffb0730a5d1cec8bb3cf8017ee8d1727951ece6740b75c3edce2000435b1f" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "a3fc64c8897450b97e767c5bc5cdfeede89a165bed3ac08c2701d7bf87c08cb8" + }, + { + "dtype": "float64", + "mask_sha256": "6ee51d51f823835e17d2ea4ea2617ba98fa28d3a1b8137da86f8427abbb5f94c", + "shape": [ + 6 + ], + "values_sha256": "f77524ea123558538e6d1b9af0a2b897ba20b81dc8f72a496519d17eee2d39c5" + }, + { + "dtype": "float64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "50b5aed702c96bb375b58ef6e245741636b17d6dd273959feaac1466bd6e32fa" + } + ], + "legacy_fields_sha256": "3f8f718fa160db28cc78543967c38913bcd839e1a6e22836b000fb259e607a20", + "metadata": { + "all_fields_sha256": "9fd4087e167877b0686b43150e33e0ef8d5e10b8ddaa31bbb449bcf947c38d2f", + "channel_names": [ + "ECG_1", + "ECG_2", + "ECG_3" + ], + "fs": 500, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 3, + "n_signals": 3, + "record_name": "test01_00s_frame" + }, + "provenance": { + "all_fields_sha256": "d5cb3fb524fdffc704caecb9a1dfe3729c93b37496522323d9b69ecf7fbc6f0e", + "segments": [], + "selection": { + "channels": [ + 0, + 1, + 2 + ], + "start": 0, + "stop": 3 + }, + "source_record_name": "test01_00s_frame", + "source_signal_record_name": "test01_00s_frame" + }, + "stdout": "" + }, + "single_frame:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "53ae88fd5d5f14d9b1061e44eae5b34d6724334fa82205efbe5bfe3c42114658", + "shape": [ + 3, + 3 + ], + "values_sha256": "96e43014193f763aaaf5dfc200bdb09042fc0949176ff2d29b4a974621e8c5b0" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "53ae88fd5d5f14d9b1061e44eae5b34d6724334fa82205efbe5bfe3c42114658", + "shape": [ + 3, + 3 + ], + "values_sha256": "fb76bc0b7290d01ab351dcaafe7883a4dbeeec3e459863eb5043c71fc184fe52" + } + ], + "legacy_fields_sha256": "dbf312cb2709204665dcd27f321f51615e6804b1111184227c0a7b4e73598796", + "metadata": { + "all_fields_sha256": "988c0c2747fdae180ba9f35894d4df6c8f061a2321e49f098684be11c2737903", + "channel_names": [ + "ECG_1", + "ECG_2", + "ECG_3" + ], + "fs": 500, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 3, + "n_signals": 3, + "record_name": "test01_00s_frame" + }, + "provenance": { + "all_fields_sha256": "d5cb3fb524fdffc704caecb9a1dfe3729c93b37496522323d9b69ecf7fbc6f0e", + "segments": [], + "selection": { + "channels": [ + 0, + 1, + 2 + ], + "start": 0, + "stop": 3 + }, + "source_record_name": "test01_00s_frame", + "source_signal_record_name": "test01_00s_frame" + }, + "stdout": "" + }, + "single_frame:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "a3fc64c8897450b97e767c5bc5cdfeede89a165bed3ac08c2701d7bf87c08cb8" + }, + { + "dtype": "float64", + "mask_sha256": "6ee51d51f823835e17d2ea4ea2617ba98fa28d3a1b8137da86f8427abbb5f94c", + "shape": [ + 6 + ], + "values_sha256": "f77524ea123558538e6d1b9af0a2b897ba20b81dc8f72a496519d17eee2d39c5" + }, + { + "dtype": "float64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "50b5aed702c96bb375b58ef6e245741636b17d6dd273959feaac1466bd6e32fa" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "7302eac0a8325b333cd0b8fb27ce3d70e8cadfab92a8b19d03ddefd18fe329cc" + }, + { + "dtype": "int64", + "mask_sha256": "6ee51d51f823835e17d2ea4ea2617ba98fa28d3a1b8137da86f8427abbb5f94c", + "shape": [ + 6 + ], + "values_sha256": "e916cb1b6619e194fff92afe50a5adcf81b2f9c95679c556c1144f9c7c853a15" + }, + { + "dtype": "int64", + "mask_sha256": "1b2008461df8f2170b3ceeeaf888c58a3c9bdcdd803c96b42cbfa16ee61801c6", + "shape": [ + 3 + ], + "values_sha256": "e6fffb0730a5d1cec8bb3cf8017ee8d1727951ece6740b75c3edce2000435b1f" + } + ], + "legacy_fields_sha256": "1d24a2edee1f99325780e422df81874e51bafad0c3631e0b9ffe8e7e48b2ab5b", + "metadata": { + "all_fields_sha256": "4e4307836f36b6021a0d5b53192a3bab07c3b93e002bb3e6c44dfef5a9ed84a5", + "channel_names": [ + "ECG_1", + "ECG_2", + "ECG_3" + ], + "fs": 500, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 3, + "n_signals": 3, + "record_name": "test01_00s_frame" + }, + "provenance": { + "all_fields_sha256": "d5cb3fb524fdffc704caecb9a1dfe3729c93b37496522323d9b69ecf7fbc6f0e", + "segments": [], + "selection": { + "channels": [ + 0, + 1, + 2 + ], + "start": 0, + "stop": 3 + }, + "source_record_name": "test01_00s_frame", + "source_signal_record_name": "test01_00s_frame" + }, + "stdout": "" + }, + "single_frame:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "53ae88fd5d5f14d9b1061e44eae5b34d6724334fa82205efbe5bfe3c42114658", + "shape": [ + 3, + 3 + ], + "values_sha256": "fb76bc0b7290d01ab351dcaafe7883a4dbeeec3e459863eb5043c71fc184fe52" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "53ae88fd5d5f14d9b1061e44eae5b34d6724334fa82205efbe5bfe3c42114658", + "shape": [ + 3, + 3 + ], + "values_sha256": "96e43014193f763aaaf5dfc200bdb09042fc0949176ff2d29b4a974621e8c5b0" + } + ], + "legacy_fields_sha256": "a8b325b21200e0c6fec5a35b604d5ca9dffcb316701150ffb926870c94ac5d0c", + "metadata": { + "all_fields_sha256": "5bb5591556472da089175bc7641171250c5fd714a67d4ab1433e1a65e3f43ff3", + "channel_names": [ + "ECG_1", + "ECG_2", + "ECG_3" + ], + "fs": 500, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 3, + "n_signals": 3, + "record_name": "test01_00s_frame" + }, + "provenance": { + "all_fields_sha256": "d5cb3fb524fdffc704caecb9a1dfe3729c93b37496522323d9b69ecf7fbc6f0e", + "segments": [], + "selection": { + "channels": [ + 0, + 1, + 2 + ], + "start": 0, + "stop": 3 + }, + "source_record_name": "test01_00s_frame", + "source_signal_record_name": "test01_00s_frame" + }, + "stdout": "" + }, + "single_mixed:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "3127846da4f110e2f61253080069a0c5ea25dcfa69d1307a92b0a3431707beae", + "shape": [ + 20 + ], + "values_sha256": "7e012a64e556fd94d792437d7ea03fceeebb09b9b38ac7c86b4f6d6739d50114" + }, + { + "dtype": "int64", + "mask_sha256": "6e2915d2b6560644779e1c7f3234a3991c81c442949a9610cc553e453f5df0b2", + "shape": [ + 40 + ], + "values_sha256": "2945af90149b5e78a3574ae23a571cd554997904159a53492bd45e357140fe4e" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "fad05e8d0b9781c6310af4e6feb950ca04d6de9b24459179291887b22a5356c2", + "shape": [ + 20 + ], + "values_sha256": "bdc96260119b7e12cd1e4a956d27d70c723ed00d177bae6b2d6c3b8c399fbee6" + }, + { + "dtype": "float64", + "mask_sha256": "8093c43d402d4954265f5ce67657343fac60a226ca40a9330e5fbae97a9e3ea9", + "shape": [ + 40 + ], + "values_sha256": "288b3056dcc5ddec68f327709ba6ad7a50e3eee059aa85b670d5284cc5be57e7" + } + ], + "legacy_fields_sha256": "8f863eef995548910e34515e12988bf62dc9f50c3da1cbaf9f09653330f0428d", + "metadata": { + "all_fields_sha256": "0b72e4c13dd0ffac1e5b2451d74bf65b24fb6075591bd62b897eb464742b728e", + "channel_names": [ + "ABP", + "II" + ], + "fs": 62.4725, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "mixedsignals" + }, + "provenance": { + "all_fields_sha256": "c87faa22a9f8401dc3b5e6fb8aa6e6e754c5848af3202870ca53f497aebe06a3", + "segments": [], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "mixedsignals", + "source_signal_record_name": "mixedsignals" + }, + "stdout": "" + }, + "single_mixed:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "77b77814cbd0886d2c631f2f97c4e60969a67b108d415add204a61c4f7ee0939", + "shape": [ + 10, + 2 + ], + "values_sha256": "1d9513f728b9fd1f746fb0ad375dbd4ed4172e07800327d61be323dfdf4b9be1" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "2f34078456d805a0fc9c7b80124ffab175f0e2e90707890a8c6d60d62b2b796b" + } + ], + "legacy_fields_sha256": "838099ed3b5bfae85a773eb67ec114da9b73110dc1f8d293e78a27960ae5f279", + "metadata": { + "all_fields_sha256": "abcca1b8f88eb58aab4486885c6edc54ffda4dbb2a95aed2af96b23c70df2050", + "channel_names": [ + "ABP", + "II" + ], + "fs": 62.4725, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "mixedsignals" + }, + "provenance": { + "all_fields_sha256": "c87faa22a9f8401dc3b5e6fb8aa6e6e754c5848af3202870ca53f497aebe06a3", + "segments": [], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "mixedsignals", + "source_signal_record_name": "mixedsignals" + }, + "stdout": "" + }, + "single_mixed:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "fad05e8d0b9781c6310af4e6feb950ca04d6de9b24459179291887b22a5356c2", + "shape": [ + 20 + ], + "values_sha256": "bdc96260119b7e12cd1e4a956d27d70c723ed00d177bae6b2d6c3b8c399fbee6" + }, + { + "dtype": "float64", + "mask_sha256": "8093c43d402d4954265f5ce67657343fac60a226ca40a9330e5fbae97a9e3ea9", + "shape": [ + 40 + ], + "values_sha256": "288b3056dcc5ddec68f327709ba6ad7a50e3eee059aa85b670d5284cc5be57e7" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "3127846da4f110e2f61253080069a0c5ea25dcfa69d1307a92b0a3431707beae", + "shape": [ + 20 + ], + "values_sha256": "7e012a64e556fd94d792437d7ea03fceeebb09b9b38ac7c86b4f6d6739d50114" + }, + { + "dtype": "int64", + "mask_sha256": "6e2915d2b6560644779e1c7f3234a3991c81c442949a9610cc553e453f5df0b2", + "shape": [ + 40 + ], + "values_sha256": "2945af90149b5e78a3574ae23a571cd554997904159a53492bd45e357140fe4e" + } + ], + "legacy_fields_sha256": "d42a13d60529b877cfb67dc6084687e016552617110e9688c3f3778d25041e4a", + "metadata": { + "all_fields_sha256": "5d4a2187c85903fe5bcc2f04f227a2c069cf49da949b9130c6345db928cf5871", + "channel_names": [ + "ABP", + "II" + ], + "fs": 62.4725, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "mixedsignals" + }, + "provenance": { + "all_fields_sha256": "c87faa22a9f8401dc3b5e6fb8aa6e6e754c5848af3202870ca53f497aebe06a3", + "segments": [], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "mixedsignals", + "source_signal_record_name": "mixedsignals" + }, + "stdout": "" + }, + "single_mixed:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "2f34078456d805a0fc9c7b80124ffab175f0e2e90707890a8c6d60d62b2b796b" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "77b77814cbd0886d2c631f2f97c4e60969a67b108d415add204a61c4f7ee0939", + "shape": [ + 10, + 2 + ], + "values_sha256": "1d9513f728b9fd1f746fb0ad375dbd4ed4172e07800327d61be323dfdf4b9be1" + } + ], + "legacy_fields_sha256": "53d9dea2883c548317dc3b7678ffdec903d9d8f5b2a0979825dc7958dac4c73b", + "metadata": { + "all_fields_sha256": "ee14c72d099e29c7ce1c160edfc073da8e9c58abf30ba2d853a21359b6816036", + "channel_names": [ + "ABP", + "II" + ], + "fs": 62.4725, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "mixedsignals" + }, + "provenance": { + "all_fields_sha256": "c87faa22a9f8401dc3b5e6fb8aa6e6e754c5848af3202870ca53f497aebe06a3", + "segments": [], + "selection": { + "channels": [ + 3, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "mixedsignals", + "source_signal_record_name": "mixedsignals" + }, + "stdout": "" + }, + "single_name_ignore:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "283aeea6b8d4f80ec0318795370ffe5ca0442a0b06a2db503966f047be4a97ff" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "c9f3c9fa238e7b5a61e970d7ccfee1bbc4474bc35b293d03668d69f2cdd8cb52" + } + ], + "legacy_fields_sha256": "904a00dd4c25d6caa5b530dfd481f487e496b76e767cc3297e90383480f9d7e9", + "metadata": { + "all_fields_sha256": "210acae7ba30a2cdde0f80e6f94cd26eddad6689f39aa804ea136ca03b20286d", + "channel_names": [ + "V5" + ], + "fs": 360, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "289dc929092b90712a1d4518437f16dd9c15544ed86e121dbeb3b5e107d3aa08", + "segments": [], + "selection": { + "channels": [ + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_name_ignore:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "2e43da4adede732533b4bced744920d2b8684601d166901fe02832605ae85afb" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "3f4d70fc6d001cd7dc9e8e1fc1a6f05cfece65f5326cedc1c78f81da4004d72a" + } + ], + "legacy_fields_sha256": "ef3fedd3ce4ad4b03f3c95e327c74926a1693533013eee78eff8b1376e47361d", + "metadata": { + "all_fields_sha256": "3750c8943a056254ceb5ee5849a7d044843af2171f134bc50738b27df8361eb8", + "channel_names": [ + "V5" + ], + "fs": 360, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "289dc929092b90712a1d4518437f16dd9c15544ed86e121dbeb3b5e107d3aa08", + "segments": [], + "selection": { + "channels": [ + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_name_ignore:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "c9f3c9fa238e7b5a61e970d7ccfee1bbc4474bc35b293d03668d69f2cdd8cb52" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "7fe209e574482ef4592b6473712609057c29dc3e5abea3d89698865e32580b92", + "shape": [ + 8 + ], + "values_sha256": "283aeea6b8d4f80ec0318795370ffe5ca0442a0b06a2db503966f047be4a97ff" + } + ], + "legacy_fields_sha256": "950dbb51d9db1716b2c5fe4798934431e4f0762d09c7c191e34ead37e32259e0", + "metadata": { + "all_fields_sha256": "209c18afb9930d37a66c3d61b99f37d17ac2b64e42d70b88259e9492326cd5aa", + "channel_names": [ + "V5" + ], + "fs": 360, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "289dc929092b90712a1d4518437f16dd9c15544ed86e121dbeb3b5e107d3aa08", + "segments": [], + "selection": { + "channels": [ + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_name_ignore:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "3f4d70fc6d001cd7dc9e8e1fc1a6f05cfece65f5326cedc1c78f81da4004d72a" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "cfcb69713fbcb862e9607600587f5aac68bb1dc08513d8b4dd7e41241d6bd8bf", + "shape": [ + 8, + 1 + ], + "values_sha256": "2e43da4adede732533b4bced744920d2b8684601d166901fe02832605ae85afb" + } + ], + "legacy_fields_sha256": "3d7fa9b7717f606a1d7049a2160e39b076517cc7c1f76636567ac26b16470af3", + "metadata": { + "all_fields_sha256": "5db2dcc0fa9910395a723de1a1b85538355de25e342d0b969383c64acb79f476", + "channel_names": [ + "V5" + ], + "fs": 360, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 8, + "n_signals": 1, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "289dc929092b90712a1d4518437f16dd9c15544ed86e121dbeb3b5e107d3aa08", + "segments": [], + "selection": { + "channels": [ + 1 + ], + "start": 0, + "stop": 8 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_selected:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "da12ca1b014355e0a32f8f9507c81d5fa8cab99902b0f538a8eeb34a4a87cc7d" + }, + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "4df48a27efb76e2b4dd9cb2a96aef22b8bbce407db7bc7b85d161fa318230614" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "25b209b5d4fdd169b305aeeca6a31cd18ed77911b00d82bc247cc19dfeab540f" + }, + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "7b322fdafca27d9cb7e66c2c5df7c326cde1eca560a2288da166c9a65c5d31d1" + } + ], + "legacy_fields_sha256": "070a160119c05b023a7c468efcd92f079813cf3e63a57854de2e8c7de74ce68f", + "metadata": { + "all_fields_sha256": "0efa92c19763c1f4106f75c5179f7e3a1eceb4d774473e96df0a520a8f409e57", + "channel_names": [ + "V5", + "MLII" + ], + "fs": 360, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "a29fb9c25046b4b2eb6ba3d792e09cd5d3ea4c1f5dba57d722eaeb86adc42c08", + "segments": [], + "selection": { + "channels": [ + 1, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_selected:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "38726035f64d91dc330cbfe08a8068c6dd0aad321258e2fe479743eb0956b73e" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "02c8341b4b7cdd388f54a2da245e09d601502fef91309fc0161ab6b406b5568c" + } + ], + "legacy_fields_sha256": "cb97b0e24779e73059ce2ccdd9983ebd1d3ae8e764701c685900e551a8f1c6be", + "metadata": { + "all_fields_sha256": "95e9fb2148c1a4bdf7874a0d48d0dea17c2d9e8d76f973d76e33c53fd6cc947e", + "channel_names": [ + "V5", + "MLII" + ], + "fs": 360, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "a29fb9c25046b4b2eb6ba3d792e09cd5d3ea4c1f5dba57d722eaeb86adc42c08", + "segments": [], + "selection": { + "channels": [ + 1, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_selected:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "25b209b5d4fdd169b305aeeca6a31cd18ed77911b00d82bc247cc19dfeab540f" + }, + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "7b322fdafca27d9cb7e66c2c5df7c326cde1eca560a2288da166c9a65c5d31d1" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "da12ca1b014355e0a32f8f9507c81d5fa8cab99902b0f538a8eeb34a4a87cc7d" + }, + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "4df48a27efb76e2b4dd9cb2a96aef22b8bbce407db7bc7b85d161fa318230614" + } + ], + "legacy_fields_sha256": "5fe0a2505b4b93d4a5fdad78475b7fddf0967aafaf4eff573621933a4c8e7223", + "metadata": { + "all_fields_sha256": "24db777e237f25343e65040c2317e5a9649664a2738a4d1f832a57cc4135f9a5", + "channel_names": [ + "V5", + "MLII" + ], + "fs": 360, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "a29fb9c25046b4b2eb6ba3d792e09cd5d3ea4c1f5dba57d722eaeb86adc42c08", + "segments": [], + "selection": { + "channels": [ + 1, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_selected:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "02c8341b4b7cdd388f54a2da245e09d601502fef91309fc0161ab6b406b5568c" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "38726035f64d91dc330cbfe08a8068c6dd0aad321258e2fe479743eb0956b73e" + } + ], + "legacy_fields_sha256": "73eacf84faf892904cded5a6e3da4a1687954c94f6d16f10ebe907064f5d5724", + "metadata": { + "all_fields_sha256": "61e39c351a4c8ec86d924be1b03986d038a1785f9879b7dc5f4ef896e7699f79", + "channel_names": [ + "V5", + "MLII" + ], + "fs": 360, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100" + }, + "provenance": { + "all_fields_sha256": "a29fb9c25046b4b2eb6ba3d792e09cd5d3ea4c1f5dba57d722eaeb86adc42c08", + "segments": [], + "selection": { + "channels": [ + 1, + 0 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100", + "source_signal_record_name": "100" + }, + "stdout": "" + }, + "single_skew_raw:digital:expanded": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "4df48a27efb76e2b4dd9cb2a96aef22b8bbce407db7bc7b85d161fa318230614" + }, + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "da12ca1b014355e0a32f8f9507c81d5fa8cab99902b0f538a8eeb34a4a87cc7d" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "7b322fdafca27d9cb7e66c2c5df7c326cde1eca560a2288da166c9a65c5d31d1" + }, + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "25b209b5d4fdd169b305aeeca6a31cd18ed77911b00d82bc247cc19dfeab540f" + } + ], + "legacy_fields_sha256": "f125b75e3b4386f0ea2360f8b5d9b3daea20318a40e11d6e511a19b349ce6bb4", + "metadata": { + "all_fields_sha256": "b896357d050e6bb74da3ca856e4e5cc87475cfc182c69f1be806889594f47edf", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "digital_expanded" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100skew" + }, + "provenance": { + "all_fields_sha256": "9bd62a760db5ef54df745a9fc810828ceb2a40fd8e6d6ed2ce7f502c7da4b243", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100skew", + "source_signal_record_name": "100skew" + }, + "stdout": "" + }, + "single_skew_raw:digital:uniform": { + "arrays": [ + { + "dtype": "int64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "53a08a6d5861da925184a795b398878404d60ab80f0ccbb53827608396d45f1f" + } + ], + "conversion": [ + { + "dtype": "float64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "d969a480991d3b23031fd6bcf6d77c73749d6f06778ba9caab2acd1db76c99bd" + } + ], + "legacy_fields_sha256": "8e4097ab587fa591df25647725398bdbdf63b6c9c3b0119827e5dfd4b69ccb5d", + "metadata": { + "all_fields_sha256": "cc338f9c13df561ba7841f2e613c5b3652e9336ff183c60e51f0abdf1fce6d0d", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "digital_uniform" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100skew" + }, + "provenance": { + "all_fields_sha256": "9bd62a760db5ef54df745a9fc810828ceb2a40fd8e6d6ed2ce7f502c7da4b243", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100skew", + "source_signal_record_name": "100skew" + }, + "stdout": "" + }, + "single_skew_raw:physical:expanded": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "7b322fdafca27d9cb7e66c2c5df7c326cde1eca560a2288da166c9a65c5d31d1" + }, + { + "dtype": "float64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "25b209b5d4fdd169b305aeeca6a31cd18ed77911b00d82bc247cc19dfeab540f" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "4df48a27efb76e2b4dd9cb2a96aef22b8bbce407db7bc7b85d161fa318230614" + }, + { + "dtype": "int64", + "mask_sha256": "59e9c864fe39bbe02c80c1c8e24a486d97e96749e208a20917380b0412dd646c", + "shape": [ + 10 + ], + "values_sha256": "da12ca1b014355e0a32f8f9507c81d5fa8cab99902b0f538a8eeb34a4a87cc7d" + } + ], + "legacy_fields_sha256": "4320d1634ea78e3e66eaff9f52a2f1f107fb179496bc2a9a0255991777b9e41a", + "metadata": { + "all_fields_sha256": "e3c290398777988f742a7d4763568e74319351fd7996de7028c67a2de71d64ee", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "physical_expanded" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100skew" + }, + "provenance": { + "all_fields_sha256": "9bd62a760db5ef54df745a9fc810828ceb2a40fd8e6d6ed2ce7f502c7da4b243", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100skew", + "source_signal_record_name": "100skew" + }, + "stdout": "" + }, + "single_skew_raw:physical:uniform": { + "arrays": [ + { + "dtype": "float64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "d969a480991d3b23031fd6bcf6d77c73749d6f06778ba9caab2acd1db76c99bd" + } + ], + "conversion": [ + { + "dtype": "int64", + "mask_sha256": "9d1a99e4ebeebc7ad7b92b9530d5547267e28ec0ab44882b8b715e4eea1bf51f", + "shape": [ + 10, + 2 + ], + "values_sha256": "53a08a6d5861da925184a795b398878404d60ab80f0ccbb53827608396d45f1f" + } + ], + "legacy_fields_sha256": "c3e0e7344e8d62754316f41d5d8d7a7de96480d2620a93430654f04f7fe806bb", + "metadata": { + "all_fields_sha256": "145577ded682a3da2309445344d2a92afba5ebecc5196a9a1206a8c74e26a08e", + "channel_names": [ + "MLII", + "V5" + ], + "fs": 360, + "loaded_forms": [ + "physical_uniform" + ], + "n_frames": 10, + "n_signals": 2, + "record_name": "100skew" + }, + "provenance": { + "all_fields_sha256": "9bd62a760db5ef54df745a9fc810828ceb2a40fd8e6d6ed2ce7f502c7da4b243", + "segments": [], + "selection": { + "channels": [ + 0, + 1 + ], + "start": 10, + "stop": 20 + }, + "source_record_name": "100skew", + "source_signal_record_name": "100skew" + }, + "stdout": "" + } +} diff --git a/tests/test_dataframe_chunks.py b/tests/test_dataframe_chunks.py index 608924c8..6a69d2de 100644 --- a/tests/test_dataframe_chunks.py +++ b/tests/test_dataframe_chunks.py @@ -8,6 +8,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io.archive import create_archive @@ -58,7 +59,7 @@ def test_uniform_table_averages_multi_frequency_channels(): """The DataFrame contract states the smoothing it performs.""" path = "sample-data/test01_00s_frame" chunks = list(wfdb.iter_dataframes(path, 2, stop=4)) - expected = wfdb.read_record(path, layout="uniform", stop=4).to_dataframe() + expected = read_mutable_record(path, layout="uniform", stop=4).to_dataframe() pd.testing.assert_frame_equal(pd.concat(chunks), expected) @@ -71,7 +72,7 @@ def test_chunked_skew_selection_matches_read_record(alignment): "channels": [1], } chunks = list(wfdb.iter_dataframes(path, 7, stop=20, **options)) - expected = wfdb.read_record( + expected = read_mutable_record( path, layout="uniform", stop=20, **options ).to_dataframe() pd.testing.assert_frame_equal(pd.concat(chunks), expected.astype("Int64")) @@ -131,7 +132,7 @@ def test_digital_chunks_with_absent_variable_layout_channels(return_res): assert len(chunks) == 8 actual = pd.concat(chunks) - expected = wfdb.read_signals( + expected = wfdb.read_record( path, stop=7500, kind="digital", layout="uniform", resolution=return_res ).signals.values mask = np.ma.getmaskarray(expected) diff --git a/tests/test_declared_signal_alignment.py b/tests/test_declared_signal_alignment.py index d693531e..9d230514 100644 --- a/tests/test_declared_signal_alignment.py +++ b/tests/test_declared_signal_alignment.py @@ -6,14 +6,15 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("writer", ["write", "write_record"]) def test_replacing_aligned_values_with_raw_values(tmp_path, writer): """The declaration preserves source skew and the aligned signal.""" path = "sample-data/100skew" - aligned = wfdb.read_record(path, layout="uniform", start=649000, kind="digital") - raw = wfdb.read_record( + aligned = read_mutable_record(path, layout="uniform", start=649000, kind="digital") + raw = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment="raw" ) aligned.d_signal = raw.d_signal @@ -27,10 +28,12 @@ def test_replacing_aligned_values_with_raw_values(tmp_path, writer): assert (aligned._applied_skew, aligned._read_skew) == previous - written = wfdb.read_record(output, layout="uniform", kind="digital") + written = read_mutable_record(output, layout="uniform", kind="digital") np.testing.assert_array_equal( written.d_signal, - wfdb.read_record(path, layout="uniform", start=649000, kind="digital").d_signal, + read_mutable_record( + path, layout="uniform", start=649000, kind="digital" + ).d_signal, ) assert wfdb.read_header(output).signals[1].skew == 3 @@ -38,24 +41,24 @@ def test_replacing_aligned_values_with_raw_values(tmp_path, writer): def test_replacing_raw_values_with_aligned_values(tmp_path): """The declaration prevents applying source skew a second time.""" path = "sample-data/100skew" - raw = wfdb.read_record( + raw = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment="raw" ) - aligned = wfdb.read_record(path, layout="uniform", start=649000, kind="digital") + aligned = read_mutable_record(path, layout="uniform", start=649000, kind="digital") raw.d_signal = aligned.d_signal raw.write(tmp_path / "copy", signal_alignment="aligned") - written = wfdb.read_record(tmp_path / "copy", layout="uniform", kind="digital") + written = read_mutable_record(tmp_path / "copy", layout="uniform", kind="digital") np.testing.assert_array_equal(written.d_signal, aligned.d_signal) assert wfdb.read_header(tmp_path / "copy").signals[1].skew in (None, 0) def test_short_selection_declared_raw_still_rejects_missing_tail(tmp_path): """A declaration cannot invent samples beyond a selected view.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100skew", layout="uniform", stop=100, kind="digital" ) - raw = wfdb.read_record( + raw = read_mutable_record( "sample-data/100skew", layout="uniform", stop=100, @@ -72,10 +75,10 @@ def test_short_selection_declared_raw_still_rejects_missing_tail(tmp_path): def test_raw_declaration_does_not_accept_changed_source_skew(tmp_path, alignment): """The read's skew remains authoritative after a declaration.""" path = "sample-data/100skew" - record = wfdb.read_record( + record = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment=alignment ) - raw = wfdb.read_record( + raw = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment="raw" ) record.d_signal = raw.d_signal @@ -88,10 +91,10 @@ def test_raw_declaration_does_not_accept_changed_source_skew(tmp_path, alignment def test_aligned_declaration_does_not_accept_changed_source_skew(tmp_path): """Switching to aligned values does not reset the original skew.""" path = "sample-data/100skew" - record = wfdb.read_record( + record = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment="raw" ) - aligned = wfdb.read_record(path, layout="uniform", start=649000, kind="digital") + aligned = read_mutable_record(path, layout="uniform", start=649000, kind="digital") record.d_signal = aligned.d_signal record.skew = [0, 7] with pytest.raises(ValueError, match="Cannot write new skew"): @@ -102,8 +105,8 @@ def test_aligned_declaration_does_not_accept_changed_source_skew(tmp_path): def test_raw_declaration_checks_replacement_frame_count(tmp_path, layout): """A short replacement remains unsafe even if the original read was full.""" path = "sample-data/100skew" - record = wfdb.read_record(path, start=649000, kind="digital", layout=layout) - raw = wfdb.read_record( + record = read_mutable_record(path, start=649000, kind="digital", layout=layout) + raw = read_mutable_record( path, start=649000, stop=649500, @@ -125,11 +128,11 @@ def test_raw_declaration_checks_replacement_frame_count(tmp_path, layout): def test_pickled_read_cannot_write_raw_without_source_details(tmp_path, alignment): """A pickle cannot silently drop the information needed for the tail check.""" path = "sample-data/100skew" - record = wfdb.read_record( + record = read_mutable_record( path, layout="uniform", stop=100, kind="digital", signal_alignment=alignment ) record = pickle.loads(pickle.dumps(record)) - raw = wfdb.read_record( + raw = read_mutable_record( path, layout="uniform", stop=100, kind="digital", signal_alignment="raw" ) record.d_signal = raw.d_signal @@ -142,31 +145,31 @@ def test_pickled_read_cannot_write_raw_without_source_details(tmp_path, alignmen def test_write_alignment_option_selects_one_of_multiple_loaded_forms(tmp_path): """The option applies to the chosen array for this write only.""" path = "sample-data/100skew" - record = wfdb.read_record(path, layout="uniform", start=649000, kind="digital") + record = read_mutable_record(path, layout="uniform", start=649000, kind="digital") record.p_signal = record.dac() - raw = wfdb.read_record( + raw = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment="raw" ) record.d_signal = raw.d_signal record.write(tmp_path / "copy", kind="digital", signal_alignment="raw") - written = wfdb.read_record(tmp_path / "copy", layout="uniform", kind="digital") - expected = wfdb.read_record(path, layout="uniform", start=649000, kind="digital") + written = read_mutable_record(tmp_path / "copy", layout="uniform", kind="digital") + expected = read_mutable_record(path, layout="uniform", start=649000, kind="digital") np.testing.assert_array_equal(written.d_signal, expected.d_signal) def test_write_alignment_option_does_not_outlive_a_write(tmp_path): """A later write needs its own alignment declaration.""" path = "sample-data/100skew" - record = wfdb.read_record(path, layout="uniform", start=649000, kind="digital") - raw = wfdb.read_record( + record = read_mutable_record(path, layout="uniform", start=649000, kind="digital") + raw = read_mutable_record( path, layout="uniform", start=649000, kind="digital", signal_alignment="raw" ) record.d_signal = raw.d_signal record.write(tmp_path / "raw", signal_alignment="raw") - record.d_signal = wfdb.read_record( + record.d_signal = read_mutable_record( path, layout="uniform", start=649000, kind="digital" ).d_signal record.write(tmp_path / "aligned", signal_alignment="aligned") @@ -178,19 +181,19 @@ def test_write_alignment_option_does_not_outlive_a_write(tmp_path): @pytest.mark.parametrize("alignment", ["aligned", "raw"]) def test_alignment_option_is_harmless_without_skew(tmp_path, alignment): """Batch writers need not special-case records with no skew.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=8, kind="digital" ) record.write(tmp_path / "copy", signal_alignment=alignment) - written = wfdb.read_record(tmp_path / "copy", layout="uniform", kind="digital") + written = read_mutable_record(tmp_path / "copy", layout="uniform", kind="digital") np.testing.assert_array_equal(written.d_signal, record.d_signal) def test_invalid_alignment_option_rejected_without_skew(tmp_path): """A no-skew record still validates the new option's value.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=8, kind="digital" ) diff --git a/tests/test_digital_frame_rounding.py b/tests/test_digital_frame_rounding.py index 3c9843e5..9104f875 100644 --- a/tests/test_digital_frame_rounding.py +++ b/tests/test_digital_frame_rounding.py @@ -48,7 +48,7 @@ def test_rdrecord_smooths_digital_frames_like_wfdb_c(tmp_path): raw = wfdb.rdrecord(path, physical=False, smooth_frames=False) smoothed = wfdb.rdrecord(path, physical=False) physical = wfdb.rdrecord(path) - selected = wfdb.read_signals(path, kind="digital", layout="uniform") + selected = wfdb.read_record(path, kind="digital", layout="uniform") np.testing.assert_array_equal(raw.e_d_signal[0], expanded) np.testing.assert_array_equal(smoothed.d_signal[:, 0], [1, 0, 2, -1]) diff --git a/tests/test_digital_missing_mask.py b/tests/test_digital_missing_mask.py index b2416da2..9c8c943e 100644 --- a/tests/test_digital_missing_mask.py +++ b/tests/test_digital_missing_mask.py @@ -9,6 +9,7 @@ from scipy.signal import filtfilt import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("copy_method", [copy.copy, copy.deepcopy, pickle.loads]) @@ -60,7 +61,7 @@ def test_pandas_nullable_integer_preserves_a_mask(): def test_digital_read_without_gaps_has_no_mask_or_data_copy(): """The usual read keeps its array storage and np.ma.nomask.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100skew", stop=20, kind="digital", layout="uniform" ) assert isinstance(read.signals.values, np.ma.MaskedArray) @@ -89,16 +90,16 @@ def test_mixed_formats_with_repeated_or_blank_channel_names(tmp_path, name): header = tmp_path / "source.hea" header.write_text(header.read_text().replace("ECGA", name).replace("ECGB", name)) - read = wfdb.read_signals(tmp_path / "source", kind="digital", layout="uniform") + read = wfdb.read_record(tmp_path / "source", kind="digital", layout="uniform") assert read.signals.values.mask[:, 0].tolist() == [False] * 4 assert read.signals.values.mask[:, 1].tolist() == [False, True, False, False] - selected = wfdb.read_signals( + selected = wfdb.read_record( tmp_path / "source", channels=[1], kind="digital", layout="uniform" ) assert selected.signals.values.mask[:, 0].tolist() == [False, True, False, False] (tmp_path / "fixed.hea").write_text("fixed/2 2 100 8\nsource 4\nsource 4\n") - combined = wfdb.read_signals(tmp_path / "fixed", kind="digital", layout="uniform") + combined = wfdb.read_record(tmp_path / "fixed", kind="digital", layout="uniform") assert combined.signals.values.mask[:, 0].tolist() == [False] * 8 assert ( combined.signals.values.mask[:, 1].tolist() @@ -110,7 +111,7 @@ def test_mixed_formats_with_repeated_or_blank_channel_names(tmp_path, name): ] * 2 ) - selected_combined = wfdb.read_signals( + selected_combined = wfdb.read_record( tmp_path / "fixed", channels=[1], kind="digital", layout="uniform" ) assert ( @@ -123,7 +124,7 @@ def test_mixed_formats_with_repeated_or_blank_channel_names(tmp_path, name): ] * 2 ) - reordered = wfdb.read_signals( + reordered = wfdb.read_record( tmp_path / "fixed", channels=[1, 0], kind="digital", layout="uniform" ) assert ( @@ -141,7 +142,7 @@ def test_mixed_formats_with_repeated_or_blank_channel_names(tmp_path, name): writable = combined.to_legacy_record() writable.sig_name = ["FIRST", "SECOND"] wfdb.write_record(tmp_path / "renamed", writable) - written = wfdb.read_signals(tmp_path / "renamed", kind="digital", layout="uniform") + written = wfdb.read_record(tmp_path / "renamed", kind="digital", layout="uniform") np.testing.assert_array_equal( np.ma.getmaskarray(written.signals.values), np.ma.getmaskarray(combined.signals.values), @@ -164,10 +165,10 @@ def test_multiframe_partial_gap_masks_the_uniform_frame(tmp_path): e_d_signal=[np.array([1, -32768, 3, 5], dtype="int16")], ) wfdb.write_record(tmp_path / "multiframe", record, layout="expanded") - uniform = wfdb.read_signals( + uniform = wfdb.read_record( tmp_path / "multiframe", kind="digital", layout="uniform" ) - expanded = wfdb.read_signals( + expanded = wfdb.read_record( tmp_path / "multiframe", kind="digital", layout="expanded" ) assert uniform.signals.values.mask[:, 0].tolist() == [True, False] @@ -215,7 +216,7 @@ def test_mixed_segment_formats_need_segment_scoped_missing_masks(tmp_path): """The same logical gap has different digital markers in each segment.""" path = _write_mixed_segments(tmp_path) - segmented = wfdb.read_record( + segmented = read_mutable_record( path, combine_segments=False, kind="digital", @@ -229,14 +230,14 @@ def test_mixed_segment_formats_need_segment_scoped_missing_masks(tmp_path): ) assert mask.tolist() == [False, True, False, False, True, False] - flattened = wfdb.read_record(path, kind="digital", layout="uniform") + flattened = read_mutable_record(path, kind="digital", layout="uniform") assert flattened.d_signal.shape == (6, 1) assert flattened.source_segments is not None assert flattened.fmt == ["16"] assert flattened.d_signal[4, 0] == -2048 # Looking for the flattened format's marker misses the second gap. assert (flattened.d_signal[:, 0] == -32768).tolist() != mask.tolist() - masked = wfdb.read_signals(path, kind="digital", layout="uniform") + masked = wfdb.read_record(path, kind="digital", layout="uniform") np.testing.assert_array_equal(masked.signals.values.mask[:, 0], mask) @@ -244,13 +245,13 @@ def test_mixed_segment_formats_need_segment_scoped_missing_masks(tmp_path): def test_mixed_segment_masked_read_writes_with_same_gaps(tmp_path, layout): """A flattened read preserves gaps from both source formats on write.""" source = _write_mixed_segments(tmp_path) - read = wfdb.read_signals(source, kind="digital", layout=layout) + read = wfdb.read_record(source, kind="digital", layout=layout) destination = tmp_path / f"copy_{layout}" with pytest.raises(ValueError, match="formats for channel.*0"): read.write(destination) assert not list(tmp_path.glob(f"copy_{layout}*")) read.write(destination, formats="16") - written = wfdb.read_signals(destination, kind="digital", layout=layout) + written = wfdb.read_record(destination, kind="digital", layout=layout) source_values = ( read.signals.values[:, 0] if layout == "uniform" else read.signals.values[0] ) @@ -276,7 +277,7 @@ def test_variable_layout_uses_agreed_format_with_or_without_gaps( ): """A channel's target format does not depend on its missing-sample mask.""" source = "sample-data/multi-segment/s00001/s00001-2896-10-10-00-31" - read = wfdb.read_signals( + read = wfdb.read_record( source, start=start, stop=stop, @@ -290,7 +291,7 @@ def test_variable_layout_uses_agreed_format_with_or_without_gaps( written_header = wfdb.read_header(destination) assert [signal.format for signal in written_header.signals] == ["80", "80"] assert (tmp_path / "copy.dat").stat().st_size == (stop - start) * 2 - written = wfdb.read_signals(destination, kind="digital", layout="uniform") + written = wfdb.read_record(destination, kind="digital", layout="uniform") np.testing.assert_array_equal( np.ma.getmaskarray(read.signals.values), np.ma.getmaskarray(written.signals.values), @@ -300,7 +301,7 @@ def test_variable_layout_uses_agreed_format_with_or_without_gaps( def test_variable_layout_requires_format_for_absent_channels(tmp_path): """A short selection cannot infer formats for never-present channels.""" source = "sample-data/multi-segment/s00001/s00001-2896-10-10-00-31" - read = wfdb.read_signals(source, stop=10000, kind="digital", layout="uniform") + read = wfdb.read_record(source, stop=10000, kind="digital", layout="uniform") with pytest.raises(ValueError, match=r"formats for channel\(s\) 2, 3"): read.write(tmp_path / "copy") assert not list(tmp_path.iterdir()) @@ -313,7 +314,7 @@ def test_variable_layout_requires_format_for_absent_channels(tmp_path): def test_signal_read_write_groups_explicit_channel_formats(tmp_path): """Different requested formats need separate output signal files.""" source = "sample-data/multi-segment/s00001/s00001-2896-10-10-00-31" - read = wfdb.read_signals( + read = wfdb.read_record( source, start=4000, stop=4500, @@ -339,7 +340,7 @@ def test_signal_read_write_rejects_unknown_target_format( tmp_path, formats, channels, bad_value ): """An invalid format is reported before any output file is created.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", stop=10, channels=channels, @@ -354,8 +355,8 @@ def test_signal_read_write_rejects_unknown_target_format( def test_digital_conversion_keeps_mixed_segment_missing(tmp_path): """Digital-to-physical conversion should retain every segment's gaps.""" path = _write_mixed_segments(tmp_path) - physical = wfdb.read_signals(path, kind="physical", layout="uniform") - converted = wfdb.read_signals(path, kind="digital", layout="uniform").to_physical() + physical = wfdb.read_record(path, kind="physical", layout="uniform") + converted = wfdb.read_record(path, kind="digital", layout="uniform").to_physical() assert np.isnan(physical.signals.values[4, 0]) assert np.isnan(converted.signals.values[4, 0]) digital_again = converted.to_digital() @@ -373,9 +374,9 @@ def test_digital_conversion_keeps_mixed_segment_missing(tmp_path): def test_mixed_format_mask_roundtrip_in_both_layouts(tmp_path, layout): """Writing a flattened view preserves masks across source formats.""" path = _write_mixed_segments(tmp_path) - source = wfdb.read_signals(path, kind="digital", layout=layout) + source = wfdb.read_record(path, kind="digital", layout=layout) source.write(tmp_path / "copy", formats="16") - written = wfdb.read_signals(tmp_path / "copy", kind="digital", layout=layout) + written = wfdb.read_record(tmp_path / "copy", kind="digital", layout=layout) originals = ( source.signals.values if layout == "expanded" else (source.signals.values,) ) @@ -394,7 +395,7 @@ def test_mixed_format_mask_roundtrip_in_both_layouts(tmp_path, layout): def test_masked_read_survives_copy_and_write(tmp_path, mode): """A copied read retains the mask used by its writer.""" path = _write_mixed_segments(tmp_path) - source = wfdb.read_signals(path, kind="digital", layout="uniform") + source = wfdb.read_record(path, kind="digital", layout="uniform") copied = { "copy": lambda: copy.copy(source), "deepcopy": lambda: copy.deepcopy(source), @@ -409,7 +410,7 @@ def test_masked_read_survives_copy_and_write(tmp_path, mode): False, ] copied.write(tmp_path / f"copy_{mode}", formats="16") - written = wfdb.read_signals( + written = wfdb.read_record( tmp_path / f"copy_{mode}", kind="digital", layout="uniform" ) assert written.signals.values.mask[:, 0].tolist() == [ @@ -426,8 +427,8 @@ def test_masked_read_survives_copy_and_write(tmp_path, mode): def test_variable_layout_masks_absent_channels_and_segment_gaps(tmp_path, layout): """Each channel uses the marker from the segment that contains it.""" _write_mixed_segments(tmp_path) - first = wfdb.read_record(tmp_path / "part16", kind="digital", layout="uniform") - second = wfdb.read_record(tmp_path / "part212", kind="digital", layout="uniform") + first = read_mutable_record(tmp_path / "part16", kind="digital", layout="uniform") + second = read_mutable_record(tmp_path / "part212", kind="digital", layout="uniform") second.sig_name = ["II"] header = wfdb.Record( record_name="var_layout", @@ -457,7 +458,7 @@ def test_variable_layout_masks_absent_channels_and_segment_gaps(tmp_path, layout ) source.wrsamp(write_dir=str(tmp_path)) - read = wfdb.read_signals(tmp_path / "var", kind="digital", layout=layout) + read = wfdb.read_record(tmp_path / "var", kind="digital", layout=layout) expected = ( [False, True, False, True, True, True], [True, True, True, False, True, False], @@ -468,7 +469,7 @@ def test_variable_layout_masks_absent_channels_and_segment_gaps(tmp_path, layout actual = tuple(values.mask.tolist() for values in read.signals.values) assert actual == expected - selected = wfdb.read_signals( + selected = wfdb.read_record( tmp_path / "var", channels=[1], kind="digital", layout=layout ) selected_mask = ( @@ -480,7 +481,7 @@ def test_variable_layout_masks_absent_channels_and_segment_gaps(tmp_path, layout destination = tmp_path / f"var_copy_{layout}" read.write(destination) - written = wfdb.read_signals(destination, kind="digital", layout=layout) + written = wfdb.read_record(destination, kind="digital", layout=layout) source_arrays = ( [read.signals.values[:, channel] for channel in range(2)] if layout == "uniform" @@ -511,7 +512,7 @@ def test_variable_layout_masks_absent_channels_and_segment_gaps(tmp_path, layout ) def test_unmasked_invalid_value_fails_before_files(tmp_path, fmt, value, message): """A valid sample cannot become a gap or overflow the target format.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", stop=10, kind="digital", layout="uniform" ) read.signals.values[0, 0] = value @@ -525,7 +526,7 @@ def test_unmasked_invalid_value_fails_before_files(tmp_path, fmt, value, message def test_masked_write_does_not_edit_read_values(tmp_path): """Encoding a masked gap leaves the caller's samples and mask intact.""" source = _write_mixed_segments(tmp_path) - read = wfdb.read_signals(source, kind="digital", layout="uniform") + read = wfdb.read_record(source, kind="digital", layout="uniform") original = read.signals.values.copy() read.write(tmp_path / "copy", formats="16") @@ -538,7 +539,7 @@ def test_masked_write_does_not_edit_read_values(tmp_path): def test_same_kind_conversion_keeps_mask(tmp_path, layout): """Copying a digital view retains gaps and independent sample arrays.""" source = _write_mixed_segments(tmp_path) - read = wfdb.read_signals(source, kind="digital", layout=layout) + read = wfdb.read_record(source, kind="digital", layout=layout) converted = read.to_digital() original = (read.signals.values,) if layout == "uniform" else read.signals.values copied = ( @@ -551,9 +552,7 @@ def test_same_kind_conversion_keeps_mask(tmp_path, layout): def test_to_physical_keeps_unmasked_format_marker_as_value(tmp_path): """An edited unmasked marker is a number until legacy conversion.""" - read = wfdb.read_signals( - "sample-data/100", stop=4, kind="digital", layout="uniform" - ) + read = wfdb.read_record("sample-data/100", stop=4, kind="digital", layout="uniform") marker = wfdb.io._signal._digi_nan(read._record.fmt[0]) read.signals.values[0, 0] = marker assert not np.ma.getmaskarray(read.signals.values)[0, 0] @@ -574,7 +573,7 @@ def test_to_physical_keeps_unmasked_format_marker_as_value(tmp_path): def test_to_physical_uses_mask_for_mixed_segment_marker(tmp_path, layout): """Flattened segment gaps stay missing, while an edited marker is valid.""" source = _write_mixed_segments(tmp_path) - read = wfdb.read_signals(source, kind="digital", layout=layout) + read = wfdb.read_record(source, kind="digital", layout=layout) values = read.signals.values if layout == "uniform" else read.signals.values[0] if layout == "uniform": values[2, 0] = -32768 diff --git a/tests/test_find_record.py b/tests/test_find_record.py index b29666fd..948af4b6 100644 --- a/tests/test_find_record.py +++ b/tests/test_find_record.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def test_find_record_uses_first_directory_and_is_readable(tmp_path): @@ -14,7 +15,7 @@ def test_find_record_uses_first_directory_and_is_readable(tmp_path): found = wfdb.find_record("100", search_path=[missing, "sample-data"]) assert found == Path("sample-data/100").absolute() - assert wfdb.read_record(found, layout="uniform", stop=5).n_frames == 5 + assert read_mutable_record(found, layout="uniform", stop=5).n_frames == 5 def test_find_record_preserves_search_order_and_dotted_stems(tmp_path): diff --git a/tests/test_flattened_write_preparation.py b/tests/test_flattened_write_preparation.py index 73cd3782..f2e199f7 100644 --- a/tests/test_flattened_write_preparation.py +++ b/tests/test_flattened_write_preparation.py @@ -4,6 +4,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io.record import Record, _flattened_write_fields @@ -56,7 +57,7 @@ def unexpected_preparation(*_args, **_kwargs): pytest.fail("called Record._prepare_flattened_write") monkeypatch.setattr(Record, "_prepare_flattened_write", unexpected_preparation) - record = wfdb.read_record( + record = read_mutable_record( "sample-data/multi-segment/041s/041s", kind="digital", layout="uniform", diff --git a/tests/test_format8_skew_tail.py b/tests/test_format8_skew_tail.py index f802672c..a151af5d 100644 --- a/tests/test_format8_skew_tail.py +++ b/tests/test_format8_skew_tail.py @@ -27,7 +27,7 @@ def _channel(read, layout): def test_modern_skew_tail_has_mask_and_nan(tmp_path, samples_per_frame, layout): """Aligned format-8 tails remain missing through read and conversion.""" path = _record(tmp_path, samples_per_frame) - digital = wfdb.read_signals(path, kind="digital", layout=layout) + digital = wfdb.read_record(path, kind="digital", layout=layout) values = _channel(digital, layout) factor = 1 if layout == "uniform" else samples_per_frame expected_mask = [False] * (6 * factor) + [True] * (2 * factor) @@ -39,7 +39,7 @@ def test_modern_skew_tail_has_mask_and_nan(tmp_path, samples_per_frame, layout): ) np.testing.assert_array_equal(values.compressed(), expected_values) - physical = wfdb.read_signals(path, kind="physical", layout=layout) + physical = wfdb.read_record(path, kind="physical", layout=layout) np.testing.assert_array_equal(np.isnan(_channel(physical, layout)), expected_mask) np.testing.assert_array_equal( np.isnan(_channel(digital.to_physical(), layout)), expected_mask @@ -50,9 +50,9 @@ def test_modern_skew_tail_has_mask_and_nan(tmp_path, samples_per_frame, layout): with pytest.raises(ValueError, match="format 8.*no missing-sample marker"): digital.to_legacy_record() - raw = wfdb.read_signals(path, kind="digital", layout=layout, signal_alignment="raw") + raw = wfdb.read_record(path, kind="digital", layout=layout, signal_alignment="raw") assert not np.ma.getmaskarray(_channel(raw, layout)).any() - unskewed = wfdb.read_signals(path, kind="digital", layout=layout, stop=6) + unskewed = wfdb.read_record(path, kind="digital", layout=layout, stop=6) assert not np.ma.getmaskarray(_channel(unskewed, layout)).any() @@ -60,7 +60,7 @@ def test_modern_skew_tail_has_mask_and_nan(tmp_path, samples_per_frame, layout): def test_windowed_tail_marks_only_missing_frames(tmp_path, kind): """A window that partly overlaps the tail retains valid samples.""" path = _record(tmp_path, 1) - read = wfdb.read_signals(path, kind=kind, layout="uniform", start=4, stop=7) + read = wfdb.read_record(path, kind=kind, layout="uniform", start=4, stop=7) if kind == "digital": np.testing.assert_array_equal(read.signals.values.mask[:, 0], [0, 0, 1]) np.testing.assert_array_equal(read.signals.values[:2, 0], [7, 8]) @@ -72,9 +72,9 @@ def test_windowed_tail_marks_only_missing_frames(tmp_path, kind): def test_skewed_format8_can_write_with_missing_marker(tmp_path): """A masked skew tail can be stored using a format with a marker.""" path = _record(tmp_path, 1) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") read.write(tmp_path / "copy", formats="16", signal_alignment="aligned") - reread = wfdb.read_signals(tmp_path / "copy", kind="digital", layout="uniform") + reread = wfdb.read_record(tmp_path / "copy", kind="digital", layout="uniform") np.testing.assert_array_equal(reread.signals.values.mask, read.signals.values.mask) np.testing.assert_array_equal( reread.signals.values.compressed(), read.signals.values.compressed() @@ -112,7 +112,7 @@ def test_multisegment_read_keeps_each_skewed_tail(tmp_path): """Flattening and segment reads preserve the per-segment masks.""" _record(tmp_path, 1) (tmp_path / "multi.hea").write_text("multi/2 1 125 16\nskew1 8\nskew1 8\n") - combined = wfdb.read_signals(tmp_path / "multi", kind="digital", layout="uniform") + combined = wfdb.read_record(tmp_path / "multi", kind="digital", layout="uniform") np.testing.assert_array_equal( combined.signals.values.mask[:, 0], [False] * 6 + [True] * 2 + [False] * 6 + [True] * 2, @@ -142,7 +142,7 @@ def test_expanded_skew_marks_every_sample_in_missing_frames(tmp_path): (tmp_path / "other.hea").write_text( "other 1 125 8\nother.dat 16x2:2 200/mV 16 0 0 0 0 I\n" ) - read = wfdb.read_signals(tmp_path / "other", kind="digital", layout="expanded") + read = wfdb.read_record(tmp_path / "other", kind="digital", layout="expanded") np.testing.assert_array_equal( read.signals.values[0].mask, [False] * 12 + [True] * 4, @@ -158,7 +158,7 @@ def test_selected_channels_keep_their_own_tail_masks(tmp_path): "skew1.dat 8:2 200/mV 12 0 0 0 0 I\n" "plain.dat 16 200/mV 16 0 0 0 0 II\n" ) - read = wfdb.read_signals( + read = wfdb.read_record( tmp_path / "mixed", kind="digital", layout="uniform", diff --git a/tests/test_format8_window.py b/tests/test_format8_window.py index 5ae35276..d31acf6d 100644 --- a/tests/test_format8_window.py +++ b/tests/test_format8_window.py @@ -15,8 +15,8 @@ def test_window_matches_full_format8_read(start, kind, layout): """A window uses all earlier stored differences in its first value.""" path = "sample-data/binformats" - full = wfdb.read_signals(path, kind=kind, layout=layout, channels=[0]) - window = wfdb.read_signals( + full = wfdb.read_record(path, kind=kind, layout=layout, channels=[0]) + window = wfdb.read_record( path, kind=kind, layout=layout, @@ -76,8 +76,8 @@ def test_format8_segment_window_matches_full_multi_read(tmp_path, kind, layout): "part 1 200 499\npart.dat 8 200/mV 12 0 -2047 -31143 0 sig 0, fmt 8\n" ) (tmp_path / "multi.hea").write_text("multi/2 1 200 998\npart 499\npart 499\n") - full = wfdb.read_signals(tmp_path / "multi", kind=kind, layout=layout) - window = wfdb.read_signals( + full = wfdb.read_record(tmp_path / "multi", kind=kind, layout=layout) + window = wfdb.read_record( tmp_path / "multi", kind=kind, layout=layout, @@ -110,10 +110,10 @@ def test_interleaved_format8_window_with_multiple_samples_per_frame( f"interleaved.dat 8{offset} 200/mV 12 0 -50 0 0 B\n" ) monkeypatch.setattr(_signal, "_FORMAT8_PREFIX_CHUNK_BYTES", 7) - full = wfdb.read_signals( + full = wfdb.read_record( tmp_path / "interleaved", kind="digital", layout=layout, stop=8 ) - window = wfdb.read_signals( + window = wfdb.read_record( tmp_path / "interleaved", kind="digital", layout=layout, diff --git a/tests/test_header_text_roundtrip.py b/tests/test_header_text_roundtrip.py index e9607938..f2db358e 100644 --- a/tests/test_header_text_roundtrip.py +++ b/tests/test_header_text_roundtrip.py @@ -15,7 +15,7 @@ @pytest.mark.parametrize("source", ["local", "cloud", "archive"]) def test_unicode_header_round_trip(tmp_path, source): """UTF-8 labels and comments survive every supported destination.""" - data = wfdb.read_signals( + data = wfdb.read_record( "sample-data/100", kind="physical", layout="uniform", stop=4 ) data = data.with_channels(names=["ÉCG lead II", "V5"], units=["µV", "mV"]) @@ -34,7 +34,7 @@ def test_unicode_header_round_trip(tmp_path, source): assert header.signals[0].units == "µV" assert header.comments == comments assert ( - wfdb.read_signals(path, kind="physical", layout="uniform").metadata.comments + wfdb.read_record(path, kind="physical", layout="uniform").metadata.comments == comments ) @@ -63,7 +63,7 @@ def test_latin1_header_preserves_degree_units(tmp_path, source): def test_rewriting_latin1_header_uses_utf8(tmp_path): """A legacy header is rewritten with UTF-8 text and the same units.""" - data = wfdb.read_signals( + data = wfdb.read_record( "sample-data/test_generator_2", kind="digital", layout="expanded", stop=1 ) destination = tmp_path / "copy" @@ -75,7 +75,7 @@ def test_rewriting_latin1_header_uses_utf8(tmp_path): def test_archive_add_file_keeps_unicode_header(tmp_path): """Adding an existing UTF-8 header to an archive keeps its labels.""" - data = wfdb.read_signals("sample-data/100", layout="uniform", stop=4) + data = wfdb.read_record("sample-data/100", layout="uniform", stop=4) data.with_channels(names=["ÉCG II", "V5"]).write(tmp_path / "copy") path = tmp_path / "copy.wfdb" with WFDBArchive(path, mode="w") as archive: diff --git a/tests/test_http_record_paths.py b/tests/test_http_record_paths.py index 74b85678..fdbb99a5 100644 --- a/tests/test_http_record_paths.py +++ b/tests/test_http_record_paths.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("scheme", ["https", "http"]) @@ -26,10 +27,12 @@ def open_mirror(path, *args, **kwargs): monkeypatch.setattr(fsspec, "open", open_mirror) header = wfdb.read_header(base + "/100") - record = wfdb.read_record(base + "/100", layout="uniform", stop=4, kind="digital") - signal_read = wfdb.read_signals(base + "/100", stop=4, layout="uniform") + record = read_mutable_record( + base + "/100", layout="uniform", stop=4, kind="digital" + ) + signal_read = wfdb.read_record(base + "/100", stop=4, layout="uniform") annotation = wfdb.read_annotations(base + "/100.atr", stop=100) - local = wfdb.read_record( + local = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) diff --git a/tests/test_legacy_deprecations.py b/tests/test_legacy_deprecations.py index 0cd99262..f60ae2f7 100644 --- a/tests/test_legacy_deprecations.py +++ b/tests/test_legacy_deprecations.py @@ -15,11 +15,11 @@ def legacy_calls(tmp_path): """Each legacy name, the name it points to, and a call that uses it.""" - record = wfdb.read_record(SAMPLE, layout="uniform", stop=10) + record = wfdb.rdrecord(SAMPLE, sampto=10) annotation = wfdb.read_annotations(SAMPLE + ".atr", stop=2000) return [ ("rdrecord", "read_record", lambda: wfdb.rdrecord(SAMPLE, sampto=10)), - ("rdsamp", "read_signals", lambda: wfdb.rdsamp(SAMPLE, sampto=10)), + ("rdsamp", "read_record", lambda: wfdb.rdsamp(SAMPLE, sampto=10)), ("rdann", "read_annotations", lambda: wfdb.rdann(SAMPLE, "atr", sampto=10)), ("Record.wrsamp", "Record.write", lambda: record.wrsamp(write_dir=tmp_path)), ( @@ -65,10 +65,11 @@ def test_download_names_are_deprecated(name, call): def test_newer_api_and_internal_legacy_calls_do_not_warn(tmp_path): """The package's own use of legacy implementations stays silent.""" + multi = wfdb.rdrecord("sample-data/multi-segment/041s/041s", sampto=10, m2s=False) with warnings.catch_warnings(): warnings.simplefilter("error", DeprecationWarning) record = wfdb.read_record(SAMPLE, layout="uniform", stop=10) - wfdb.read_signals(SAMPLE, layout="uniform", stop=10) + wfdb.read_record(SAMPLE, layout="uniform", stop=10) wfdb.read_header(SAMPLE) annotation = wfdb.read_annotations(SAMPLE + ".atr", stop=2000) wfdb.write_record(tmp_path / "record", record) @@ -80,12 +81,7 @@ def test_newer_api_and_internal_legacy_calls_do_not_warn(tmp_path): processing.ann2rr(SAMPLE, "atr") processing.bxb_record(SAMPLE, "atr", "qrs") processing.compare_annotations(np.array([10, 20]), np.array([11, 19]), 2) - wfdb.read_record( - "sample-data/multi-segment/041s/041s", - layout="uniform", - stop=10, - combine_segments=False, - ).wrsamp(write_dir=tmp_path) + multi.wrsamp(write_dir=tmp_path) def test_names_without_a_complete_replacement_do_not_warn(tmp_path): @@ -101,7 +97,7 @@ def test_names_without_a_complete_replacement_do_not_warn(tmp_path): fs=360, units=["mV"], sig_name=["MLII"], - p_signal=record.p_signal[:, :1], + p_signal=record.signals.values[:, :1], fmt=["16"], write_dir=str(tmp_path), ) diff --git a/tests/test_legacy_write_validation.py b/tests/test_legacy_write_validation.py index 4c1f985b..0bd28463 100644 --- a/tests/test_legacy_write_validation.py +++ b/tests/test_legacy_write_validation.py @@ -4,6 +4,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize( @@ -18,7 +19,7 @@ def test_wrsamp_rejects_sliced_signal_before_writing(tmp_path, expanded, kind, field): """A channel slice needs matching metadata even on the legacy path.""" name = "sample-data/test01_00s_frame" if expanded else "sample-data/100" - record = wfdb.read_record( + record = read_mutable_record( name, stop=4, kind=kind, layout="expanded" if expanded else "uniform" ) values = getattr(record, field) @@ -37,7 +38,7 @@ def test_wrsamp_rejects_sliced_signal_before_writing(tmp_path, expanded, kind, f def test_wrsamp_checks_only_the_selected_signal_form(tmp_path): """An unrelated physical array does not override loaded digital values.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) expected = record.d_signal.copy() @@ -45,13 +46,13 @@ def test_wrsamp_checks_only_the_selected_signal_form(tmp_path): record.wrsamp(write_dir=str(tmp_path)) - written = wfdb.read_record(tmp_path / "100", layout="uniform", kind="digital") + written = read_mutable_record(tmp_path / "100", layout="uniform", kind="digital") np.testing.assert_array_equal(written.d_signal, expected) def test_wrsamp_checks_retained_channel_fields_but_recalculates_checksum(tmp_path): """Legacy writes retain byte offsets but replace outdated checksums.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) record.byte_offset = [0] diff --git a/tests/test_markerless_missing.py b/tests/test_markerless_missing.py index 53afa84e..9b154bf0 100644 --- a/tests/test_markerless_missing.py +++ b/tests/test_markerless_missing.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def _format8_gap(tmp_path, gap_first): @@ -28,7 +29,7 @@ def _channel_values(read, layout): def test_format8_gap_is_masked_and_converts(tmp_path, gap_first, layout): """Modern arrays carry gaps without inventing a format 8 marker.""" path = _format8_gap(tmp_path, gap_first) - digital = wfdb.read_signals(path, kind="digital", layout=layout) + digital = wfdb.read_record(path, kind="digital", layout=layout) values = _channel_values(digital, layout) original_data = np.asarray(values).copy() expected_mask = [True] * 4 + [False] * 8 if gap_first else [False] * 8 + [True] * 4 @@ -39,7 +40,7 @@ def test_format8_gap_is_masked_and_converts(tmp_path, gap_first, layout): np.testing.assert_array_equal( np.isnan(_channel_values(physical, layout)), expected_mask ) - direct_physical = wfdb.read_signals(path, kind="physical", layout=layout) + direct_physical = wfdb.read_record(path, kind="physical", layout=layout) original_physical = np.asarray(_channel_values(direct_physical, layout)).copy() np.testing.assert_array_equal( np.isnan(_channel_values(direct_physical, layout)), expected_mask @@ -74,7 +75,7 @@ def test_format8_gap_is_masked_and_converts(tmp_path, gap_first, layout): assert not destination.with_suffix(".dat").exists() digital.write(tmp_path / "copy", formats="16") - reread = wfdb.read_signals(tmp_path / "copy", kind="digital", layout=layout) + reread = wfdb.read_record(tmp_path / "copy", kind="digital", layout=layout) np.testing.assert_array_equal( np.ma.getmaskarray(_channel_values(reread, layout)), expected_mask ) @@ -84,7 +85,7 @@ def test_format8_gap_is_masked_and_converts(tmp_path, gap_first, layout): np.testing.assert_array_equal(np.asarray(values), original_data) direct_physical.write(tmp_path / "physical_copy", formats="16") - physical_reread = wfdb.read_signals( + physical_reread = wfdb.read_record( tmp_path / "physical_copy", kind="physical", layout=layout ) np.testing.assert_array_equal( @@ -96,7 +97,7 @@ def test_format8_gap_is_masked_and_converts(tmp_path, gap_first, layout): def test_all_gap_format8_window_and_legacy_error(tmp_path, layout): """A gap-only window has a mask and no fabricated legacy sample value.""" path = _format8_gap(tmp_path, gap_first=False) - read = wfdb.read_signals(path, kind="digital", layout=layout, start=9, stop=11) + read = wfdb.read_record(path, kind="digital", layout=layout, start=9, stop=11) assert np.ma.getmaskarray(_channel_values(read, layout)).all() with pytest.raises(ValueError, match="format 8.*no missing-sample marker"): read.to_legacy_record() @@ -104,7 +105,7 @@ def test_all_gap_format8_window_and_legacy_error(tmp_path, layout): def test_unmasked_format8_legacy_projection_stays_valid(): """A format 8 read with no gap still projects to a legacy Record.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/binformats", kind="digital", layout="expanded", @@ -114,7 +115,7 @@ def test_unmasked_format8_legacy_projection_stays_valid(): legacy = read.to_legacy_record() np.testing.assert_array_equal(legacy.e_d_signal[0], read.signals.values[0]) - physical = wfdb.read_signals( + physical = wfdb.read_record( "sample-data/binformats", kind="physical", layout="expanded", @@ -138,10 +139,10 @@ def test_format8_and_16_gap_convert_together(tmp_path, layout): ) (tmp_path / "multi.hea").write_text("multi/2 2 200 12\npart 8\n~ 4\n") path = tmp_path / "multi" - digital = wfdb.read_signals(path, kind="digital", layout=layout) + digital = wfdb.read_record(path, kind="digital", layout=layout) physical = digital.to_physical() restored = physical.to_digital() - direct = wfdb.read_signals(path, kind="physical", layout=layout).to_digital() + direct = wfdb.read_record(path, kind="physical", layout=layout).to_digital() for original, converted, from_physical in zip( digital.signals.values if layout == "expanded" else digital.signals.values.T, restored.signals.values if layout == "expanded" else restored.signals.values.T, @@ -154,7 +155,7 @@ def test_format8_and_16_gap_convert_together(tmp_path, layout): def test_legacy_adc_rejects_format8_nan_clearly(): """The shared ADC helper rejects a NaN with no digital marker.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/binformats", kind="physical", layout="uniform", diff --git a/tests/test_memory.py b/tests/test_memory.py index f1a305da..fb2f79ce 100644 --- a/tests/test_memory.py +++ b/tests/test_memory.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from tests.test_url import DummyHTTPServer from wfdb.io import _cloud from wfdb.io.archive import WFDBArchive, create_archive @@ -46,9 +47,9 @@ def test_read_remote_archive(memory_fs, tmp_path): np.testing.assert_array_equal(record.p_signal, expected.p_signal) assert wfdb.read_header(uri) == wfdb.read_header(archive_path) - signals = wfdb.read_signals(uri, start=100, stop=200, layout="uniform") + signals = wfdb.read_record(uri, start=100, stop=200, layout="uniform") np.testing.assert_array_equal(signals.signals.values, expected.p_signal) - modern_record = wfdb.read_record(uri, layout="uniform", start=100, stop=200) + modern_record = read_mutable_record(uri, layout="uniform", start=100, stop=200) np.testing.assert_array_equal(modern_record.p_signal, expected.p_signal) annotation = wfdb.read_annotations(uri, annotator="atr", stop=1000) @@ -110,10 +111,10 @@ def test_read_http_archive_with_ranges(tmp_path): {remote_path: archive_path.read_bytes()}, allow_gzip=False ) as server: uri = server.url(remote_path) - record = wfdb.read_record(uri, layout="uniform", start=100, stop=200) + record = read_mutable_record(uri, layout="uniform", start=100, stop=200) assert wfdb.read_header(uri).record_name == "100" - expected = wfdb.read_record(archive_path, layout="uniform", start=100, stop=200) + expected = read_mutable_record(archive_path, layout="uniform", start=100, stop=200) np.testing.assert_array_equal(record.p_signal, expected.p_signal) assert server.ranges assert all(request is not None for request in server.ranges) @@ -131,7 +132,7 @@ def test_http_archive_requires_ranges(tmp_path): allow_range=False, ) as server: with pytest.raises(ValueError, match="range requests"): - wfdb.read_record(server.url("100.wfdb"), layout="uniform", stop=100) + read_mutable_record(server.url("100.wfdb"), layout="uniform", stop=100) def test_read_remote_multi_segment_archive(memory_fs, tmp_path): @@ -142,8 +143,8 @@ def test_read_remote_multi_segment_archive(memory_fs, tmp_path): memory_fs.pipe("/wfdb-test/v102s.wfdb", archive_path.read_bytes()) uri = "memory://wfdb-test/v102s.wfdb" - expected = wfdb.read_record(archive_path, layout="uniform", stop=100) - result = wfdb.read_record(uri, layout="uniform", stop=100) + expected = read_mutable_record(archive_path, layout="uniform", stop=100) + result = read_mutable_record(uri, layout="uniform", stop=100) np.testing.assert_array_equal(result.p_signal, expected.p_signal) headers = wfdb.read_multi_segment_headers(uri) assert headers.main_header.record_name == "v102s" diff --git a/tests/test_multi_read_model.py b/tests/test_multi_read_model.py index 57f2a256..e3c63712 100644 --- a/tests/test_multi_read_model.py +++ b/tests/test_multi_read_model.py @@ -8,6 +8,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import record as record_module from wfdb.io import signal_values from wfdb.io.archive import create_archive @@ -16,7 +17,7 @@ def _record_view(path, kind, layout, options): """Build a compatibility view for the legacy Record projection test.""" expanded = layout == "expanded" - record = wfdb.read_record( + record = read_mutable_record( path, kind=kind, layout=layout, @@ -54,7 +55,7 @@ def fail(*_args, **_kwargs): raise AssertionError("Record adapter created during read") monkeypatch.setattr(record_module, "_record_from_header_fields", fail) - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/fixed1/v102s", kind="digital", layout="uniform", @@ -66,7 +67,7 @@ def fail(*_args, **_kwargs): def test_multi_read_copy_and_pickle_preserve_provenance(): """Copies keep decoded values and the selected source description.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/fixed1/v102s", kind="digital", layout="uniform", @@ -96,8 +97,8 @@ def test_multi_segment_archive_uses_direct_reader(tmp_path): archive = tmp_path / "v102s.wfdb" create_archive(files, archive) options = {"kind": "digital", "layout": "uniform", "stop": 8} - expected = wfdb.read_signals(f"{root}/v102s", **options) - actual = wfdb.read_signals(archive, **options) + expected = wfdb.read_record(f"{root}/v102s", **options) + actual = wfdb.read_record(archive, **options) _assert_same_values(actual, expected) assert actual.metadata == expected.metadata @@ -115,9 +116,7 @@ def test_skewed_segment_matches_record_path(tmp_path, alignment, layout): ) options = {"stop": 8, "signal_alignment": alignment} old = _record_view(tmp_path / "multi", "digital", layout, options) - new = wfdb.read_signals( - tmp_path / "multi", kind="digital", layout=layout, **options - ) + new = wfdb.read_record(tmp_path / "multi", kind="digital", layout=layout, **options) _assert_same_values(new, old) assert new.source_selection == old.source_selection @@ -146,7 +145,7 @@ def _fixed_record_with_gap(tmp_path, gap_first): def test_fixed_layout_gap_across_and_inside(tmp_path, gap_first, layout): """A fixed-layout gap stays missing with or without loaded data nearby.""" path = _fixed_record_with_gap(tmp_path, gap_first) - digital = wfdb.read_signals(path, kind="digital", layout=layout) + digital = wfdb.read_record(path, kind="digital", layout=layout) values = ( digital.signals.values if layout == "uniform" else digital.signals.values[0] ) @@ -160,7 +159,7 @@ def test_fixed_layout_gap_across_and_inside(tmp_path, gap_first, layout): physical.signals.values if layout == "uniform" else physical.signals.values[0] ) np.testing.assert_array_equal(np.isnan(physical_values).ravel(), expected_mask) - direct_physical = wfdb.read_signals(path, kind="physical", layout=layout) + direct_physical = wfdb.read_record(path, kind="physical", layout=layout) direct_values = ( direct_physical.signals.values if layout == "uniform" @@ -176,7 +175,7 @@ def test_fixed_layout_gap_across_and_inside(tmp_path, gap_first, layout): destination = tmp_path / "copy" digital.write(destination) - restored = wfdb.read_signals(destination, kind="digital", layout=layout) + restored = wfdb.read_record(destination, kind="digital", layout=layout) restored_values = ( restored.signals.values if layout == "uniform" else restored.signals.values[0] ) @@ -186,7 +185,7 @@ def test_fixed_layout_gap_across_and_inside(tmp_path, gap_first, layout): np.testing.assert_array_equal(restored_values.compressed(), values.compressed()) gap_start = 0 if gap_first else 4 - inside = wfdb.read_signals( + inside = wfdb.read_record( path, kind="digital", layout=layout, start=gap_start + 1, stop=gap_start + 3 ) inside_values = ( @@ -200,7 +199,7 @@ def test_fixed_layout_all_gap_has_clear_error(tmp_path): """A fixed-layout master with no signal header cannot define channels.""" (tmp_path / "empty.hea").write_text("empty/2 1 125 8\n~ 4\n~ 4\n") with pytest.raises(ValueError, match="no signal-bearing segment"): - wfdb.read_signals(tmp_path / "empty", kind="digital", layout="uniform") + wfdb.read_record(tmp_path / "empty", kind="digital", layout="uniform") @pytest.mark.parametrize("kind", ["physical", "digital"]) @@ -209,7 +208,7 @@ def test_empty_selection_has_clear_error(capsys, kind, layout): """A selection with no present channels fails without printing.""" path = "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57" with pytest.raises(ValueError, match="No selected channels are present"): - wfdb.read_signals( + wfdb.read_record( path, kind=kind, layout=layout, @@ -228,7 +227,7 @@ def test_mismatched_digital_calibration_names_channel_and_field(layout): match=r"channel 'MCL1' has different adc_gain across segments " r"\(26\.0 and 66\.0\)", ): - wfdb.read_signals( + wfdb.read_record( path, kind="digital", layout=layout, diff --git a/tests/test_nullable_dataframes.py b/tests/test_nullable_dataframes.py index bc4b0f83..143a5389 100644 --- a/tests/test_nullable_dataframes.py +++ b/tests/test_nullable_dataframes.py @@ -59,7 +59,7 @@ def test_digital_chunks_preserve_mixed_format_gaps(tmp_path): frame = pd.concat(chunks) assert str(frame["I"].dtype) == "Int64" _assert_nullable_values(frame["I"], [-2048, pd.NA, 3, 4, pd.NA, 6]) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") np.testing.assert_array_equal(frame["I"].isna(), read.signals.values.mask[:, 0]) @@ -82,7 +82,7 @@ def test_variable_layout_chunks_match_masked_signal_read(): options = {"kind": "digital", "channels": [1, 0], "stop": 7500} chunks = list(wfdb.iter_dataframes(path, chunk_size=700, **options)) frame = pd.concat(chunks) - read = wfdb.read_signals(path, layout="uniform", **options) + read = wfdb.read_record(path, layout="uniform", **options) values = read.signals.values assert list(frame.columns) == read._record.sig_name diff --git a/tests/test_physical_calibration.py b/tests/test_physical_calibration.py index 8406fee7..a8e14eb6 100644 --- a/tests/test_physical_calibration.py +++ b/tests/test_physical_calibration.py @@ -4,6 +4,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("writer", ["wrsamp", "write_record"]) @@ -35,7 +36,7 @@ def test_calibration_ignores_missing_samples(tmp_path, writer, layout): assert record.fmt is None assert record.adc_gain is None - written = wfdb.read_record(tmp_path / "x", layout=layout) + written = read_mutable_record(tmp_path / "x", layout=layout) actual = written.p_signal[:, 0] if layout == "uniform" else written.e_p_signal[0] expected = values[:, 0] if layout == "uniform" else values np.testing.assert_allclose(actual, expected, atol=0.01, rtol=0, equal_nan=True) @@ -57,7 +58,7 @@ def test_all_missing_channel_can_be_calibrated(tmp_path, layout): wfdb.wrsamp( "x", fs=100, units=["mV"], sig_name=["I"], write_dir=tmp_path, **signals ) - written = wfdb.read_record(tmp_path / "x", layout=layout) + written = read_mutable_record(tmp_path / "x", layout=layout) actual = written.p_signal if layout == "uniform" else written.e_p_signal[0] assert np.isnan(actual).all() diff --git a/tests/test_physical_recorddata_write_calibration.py b/tests/test_physical_recorddata_write_calibration.py index 7a7d84c5..67707f1a 100644 --- a/tests/test_physical_recorddata_write_calibration.py +++ b/tests/test_physical_recorddata_write_calibration.py @@ -24,7 +24,7 @@ def _physical_read(tmp_path): adc_gain=[2, 4], baseline=[0, 1], ) - return wfdb.read_signals(source, kind="physical", layout="uniform") + return wfdb.read_record(source, kind="physical", layout="uniform") def _same_written_bytes(tmp_path, data, **options): @@ -46,7 +46,7 @@ def test_physical_calibration_override_matches_explicit_adc(tmp_path): read = _physical_read(tmp_path) original = read.signals.values.copy() target = _same_written_bytes(tmp_path, read, adc_gain=[4, 8], baseline=[2, 3]) - digital = wfdb.read_signals(target, kind="digital", layout="uniform") + digital = wfdb.read_record(target, kind="digital", layout="uniform") expected = np.ma.array( [[2, 3], [4, 5], [6, 7], [0, 9]], mask=[[False, False], [False, False], [False, False], [True, False]], @@ -72,7 +72,7 @@ def test_same_calibration_agrees_with_to_digital(tmp_path): converted = read.to_digital() target = tmp_path / "same" read.write(target, adc_gain=[2, 4], baseline=[0, 1]) - written = wfdb.read_signals(target, kind="digital", layout="uniform") + written = wfdb.read_record(target, kind="digital", layout="uniform") np.testing.assert_array_equal(written.signals.values, converted.signals.values) np.testing.assert_array_equal( np.ma.getmaskarray(written.signals.values), @@ -87,7 +87,7 @@ def test_format_override_refreshes_sample_declarations(tmp_path, kind): read = physical if kind == "physical" else physical.to_digital() target = tmp_path / f"format_{kind}" read.write(target, formats="24") - written = wfdb.read_signals(target, kind="digital", layout="uniform") + written = wfdb.read_record(target, kind="digital", layout="uniform") for index, channel in enumerate(written.metadata.channels): values = written.signals.values[:, index] marker = -(2**23) @@ -99,13 +99,13 @@ def test_format_override_refreshes_sample_declarations(tmp_path, kind): def test_expanded_physical_calibration_override(tmp_path): """Expanded channels retain their sample counts and use new calibration.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/test01_00s_frame", kind="physical", layout="expanded", stop=5 ) gains = [item.adc_gain for item in read.metadata.signals] baselines = [item.baseline + 1 for item in read.metadata.signals] target = _same_written_bytes(tmp_path, read, adc_gain=gains, baseline=baselines) - written = wfdb.read_signals(target, kind="digital", layout="expanded") + written = wfdb.read_record(target, kind="digital", layout="expanded") for old, new, gain, baseline in zip( read.signals.values, written.signals.values, gains, baselines ): @@ -115,7 +115,7 @@ def test_expanded_physical_calibration_override(tmp_path): def test_flattened_physical_calibration_is_not_reinferred(tmp_path): """Explicit values survive the flattened-write preparation path.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/041s/041s", kind="physical", layout="uniform", @@ -126,14 +126,14 @@ def test_flattened_physical_calibration_is_not_reinferred(tmp_path): baselines = [item.baseline + 1 for item in read.metadata.signals] target = tmp_path / "flattened" read.write(target, adc_gain=gains, baseline=baselines) - written = wfdb.read_signals(target, kind="digital", layout="uniform") + written = wfdb.read_record(target, kind="digital", layout="uniform") assert [item.adc_gain for item in written.metadata.signals] == gains assert [item.baseline for item in written.metadata.signals] == baselines def test_ambiguous_flattened_formats_need_explicit_choice(tmp_path): """Calibration cannot be silently replaced by inferred storage fields.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/s00001/s00001-2896-10-10-00-31", kind="physical", layout="uniform", @@ -154,7 +154,7 @@ def test_ambiguous_flattened_formats_need_explicit_choice(tmp_path): adc_gain=[200] * read.metadata.n_signals, baseline=[0] * read.metadata.n_signals, ) - written = wfdb.read_signals(destination, kind="digital", layout="uniform") + written = wfdb.read_record(destination, kind="digital", layout="uniform") assert all(signal.adc_gain == 200 for signal in written.metadata.signals) @@ -226,7 +226,7 @@ def test_old_physical_pickle_accepts_write_calibration(tmp_path): baseline = [signal.baseline for signal in read.metadata.signals] target = tmp_path / "old_pickle" read.write(target, adc_gain=gain, baseline=baseline) - restored = wfdb.read_signals(target, kind="digital", layout="uniform") + restored = wfdb.read_record(target, kind="digital", layout="uniform") assert [signal.adc_gain for signal in restored.metadata.signals] == gain @@ -234,7 +234,7 @@ def test_old_physical_pickle_accepts_write_calibration(tmp_path): def test_missing_adc_fields_are_filled_for_derived_declarations(tmp_path, edit): """The n8 header can be written after selecting or editing its samples.""" source = "sample-data/n8_evoked_raw_95_F1_R9" - read = wfdb.read_signals(source, kind="physical", layout="uniform", stop=100) + read = wfdb.read_record(source, kind="physical", layout="uniform", stop=100) if edit == "select": read = read.select(start=1, stop=100) elif edit == "values": @@ -249,7 +249,7 @@ def test_missing_adc_fields_are_filled_for_derived_declarations(tmp_path, edit): def test_full_n8_write_accepts_explicit_format(tmp_path): """A full read with formats= can write a header lacking ADC declarations.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/n8_evoked_raw_95_F1_R9", kind="physical", layout="uniform" ) destination = tmp_path / "full" @@ -274,7 +274,7 @@ def test_legacy_partial_n8_write_fills_required_adc_fields(tmp_path): def test_explicit_source_formats_do_not_change_bytes(tmp_path): """Repeating the source formats does not refresh otherwise unchanged data.""" - read = wfdb.read_signals("sample-data/100", kind="digital", layout="uniform") + read = wfdb.read_record("sample-data/100", kind="digital", layout="uniform") implicit = tmp_path / "implicit" explicit = tmp_path / "explicit" implicit.mkdir() diff --git a/tests/test_physionet_uri.py b/tests/test_physionet_uri.py index 2cf2b9a8..c027994c 100644 --- a/tests/test_physionet_uri.py +++ b/tests/test_physionet_uri.py @@ -41,8 +41,7 @@ def test_uri_and_pn_dir_cannot_be_combined(reader, path, kwargs): [ (wfdb.read_header, {}), (wfdb.read_multi_segment_headers, {}), - (wfdb.read_record, {}), - (wfdb.read_signals, {"layout": "uniform"}), + (wfdb.read_record, {"layout": "uniform"}), (wfdb.iter_dataframes, {"chunk_size": 10}), (wfdb.read_annotations, {"annotator": "atr"}), ], diff --git a/tests/test_preflight_signal_writes.py b/tests/test_preflight_signal_writes.py index 53e4311a..94965fee 100644 --- a/tests/test_preflight_signal_writes.py +++ b/tests/test_preflight_signal_writes.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import _signal @@ -20,7 +21,7 @@ def test_out_of_range_sample_leaves_no_files(tmp_path, writer, kind, layout, arc value = 5000 if kind == "digital" else 1e6 if writer == "record": - record = wfdb.read_record(source, kind=kind, layout=layout, stop=5) + record = read_mutable_record(source, kind=kind, layout=layout, stop=5) values = getattr( record, ("e_" if layout == "expanded" else "") @@ -34,7 +35,7 @@ def test_out_of_range_sample_leaves_no_files(tmp_path, writer, kind, layout, arc def write(): wfdb.write_record(destination, record) else: - read = wfdb.read_signals(source, kind=kind, layout=layout, stop=5) + read = wfdb.read_record(source, kind=kind, layout=layout, stop=5) values = read.signals.values if layout == "expanded": values[0][0] = value @@ -71,7 +72,7 @@ def write(): def test_physical_marker_collision_leaves_no_files(tmp_path, writer): """A real physical sample cannot encode as format 212's missing marker.""" source = "sample-data/100" - record = wfdb.read_record(source, kind="physical", layout="uniform", stop=5) + record = read_mutable_record(source, kind="physical", layout="uniform", stop=5) record.p_signal[0, 0] = (-2048 - record.baseline[0]) / record.adc_gain[0] destination = tmp_path / "bad" if writer == "record": @@ -80,7 +81,7 @@ def write(): wfdb.write_record(destination, record) elif writer == "read": - read = wfdb.read_signals(source, kind="physical", layout="uniform", stop=5) + read = wfdb.read_record(source, kind="physical", layout="uniform", stop=5) read.signals.values[0, 0] = record.p_signal[0, 0] def write(): @@ -108,13 +109,13 @@ def write(): def test_record_digital_missing_marker_is_still_writable(tmp_path): """A digital Record uses the reserved value to represent a missing sample.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", kind="digital", layout="uniform", stop=5 ) record.d_signal[0, 0] = -2048 destination = tmp_path / "missing" wfdb.write_record(destination, record) - result = wfdb.read_record(destination, kind="physical", layout="uniform") + result = read_mutable_record(destination, kind="physical", layout="uniform") assert np.isnan(result.p_signal[0, 0]) @@ -131,7 +132,7 @@ def test_physical_preflight_uses_rounded_sample_bounds(tmp_path): ) good = tmp_path / "good" wfdb.write_signals(good, np.array([[2047.49], [-2047.49]]), **options) - result = wfdb.read_record(good, kind="digital", layout="uniform") + result = read_mutable_record(good, kind="digital", layout="uniform") np.testing.assert_array_equal(result.d_signal[:, 0], [2047, -2047]) for index, value in enumerate((2047.5, -2047.5)): @@ -154,14 +155,14 @@ def test_bad_physical_value_raises_without_numpy_warning(tmp_path, writer, value destination = tmp_path / "bad" source = "sample-data/100" if writer == "record": - record = wfdb.read_record(source, kind="physical", layout="uniform", stop=5) + record = read_mutable_record(source, kind="physical", layout="uniform", stop=5) record.p_signal[0, 0] = value def write(): wfdb.write_record(destination, record) elif writer == "read": - read = wfdb.read_signals(source, kind="physical", layout="uniform", stop=5) + read = wfdb.read_record(source, kind="physical", layout="uniform", stop=5) read.signals.values[0, 0] = value def write(): diff --git a/tests/test_processing_argument_names.py b/tests/test_processing_argument_names.py index 8acc1458..5ef5aeee 100644 --- a/tests/test_processing_argument_names.py +++ b/tests/test_processing_argument_names.py @@ -8,6 +8,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb import processing from wfdb.processing.basic import smooth from wfdb.processing.peaks import shift_peaks @@ -81,7 +82,7 @@ def test_positional_signal_and_signal_keyword_conflict_names_both_spellings(): def test_qrs_detectors_accept_signal_keyword(): - signal = wfdb.read_record( + signal = read_mutable_record( "sample-data/100", layout="uniform", stop=4000, channels=[0] ).p_signal[:, 0] xqrs = processing.XQRS(signal=signal, fs=360) @@ -112,7 +113,7 @@ def test_qrs_detectors_accept_signal_keyword(): def test_gqrs_accepts_digital_signal_keyword(): - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=4000, channels=[0], kind="digital" ) kwargs = { @@ -131,7 +132,7 @@ def test_gqrs_accepts_digital_signal_keyword(): def test_xqrs_qrs_indices_shares_legacy_array_after_detection(): - signal = wfdb.read_record( + signal = read_mutable_record( "sample-data/100", layout="uniform", stop=4000, channels=[0] ).p_signal[:, 0] detector = processing.XQRS(signal=signal, fs=360) diff --git a/tests/test_read_model_expected.py b/tests/test_read_model_expected.py index 49eeb217..50754269 100644 --- a/tests/test_read_model_expected.py +++ b/tests/test_read_model_expected.py @@ -8,7 +8,7 @@ def test_named_channel_selection_matches_known_samples(): """Name selection keeps its order and ignores only the requested unknown.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", kind="digital", layout="uniform", @@ -52,7 +52,7 @@ def test_named_channel_selection_matches_known_samples(): ) def test_multifrequency_selected_values(kind, layout, expected): """Uniform smoothing and expanded samples retain their known values.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/test01_00s_frame", kind=kind, layout=layout, stop=3 ) arrays = read.signals.values @@ -95,7 +95,7 @@ def test_skew_and_segment_boundary_values( path, options, expected, names, segments, layout ): """Skew and segment assembly retain their selected sample values.""" - read = wfdb.read_signals(path, kind="digital", layout=layout, **options) + read = wfdb.read_record(path, kind="digital", layout=layout, **options) if layout == "uniform": np.testing.assert_array_equal(read.signals.values, expected) else: @@ -112,7 +112,7 @@ def test_skew_and_segment_boundary_values( @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_variable_layout_missing_samples(layout): """A selected variable-layout window retains its missing-sample mask.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/s25047/s25047-2704-05-04-10-44", kind="digital", layout=layout, diff --git a/tests/test_read_model_snapshots.py b/tests/test_read_model_snapshots.py index 6d6d67cd..5a150625 100644 --- a/tests/test_read_model_snapshots.py +++ b/tests/test_read_model_snapshots.py @@ -76,6 +76,7 @@ for layout in ("uniform", "expanded") ) FIXTURE = Path(__file__).parent / "fixtures" / "read_model_v5_17.json" +V5_18_FIXTURE = Path(__file__).parent / "fixtures" / "read_record_v5_18.json" FORMAT8_CONVERSION = { "uniform": [ { @@ -225,7 +226,7 @@ def snapshot(case, kind, layout): output = io.StringIO() with contextlib.redirect_stdout(output): try: - read = wfdb.read_signals(path, kind=kind, layout=layout, **options) + read = wfdb.read_record(path, kind=kind, layout=layout, **options) except Exception as error: result = { "error_type": type(error).__name__, @@ -298,3 +299,17 @@ def test_read_matches_v5_17_snapshot(case, kind, layout): assert snapshot(case, kind, layout) == MISMATCHED_DIGITAL_ERROR return assert snapshot(case, kind, layout) == expected + + +@pytest.mark.parametrize(("case", "kind", "layout"), VARIANTS) +def test_read_record_matches_v5_18_read_signals(case, kind, layout): + """The 6.0 reader retains 5.18.0 values, masks, and metadata.""" + expected = json.loads(V5_18_FIXTURE.read_text())[f"{case}:{kind}:{layout}"] + if case == "single_format_24": + # #923 preserves the second # in this header's comment. The release + # snapshot predates that intended change to metadata and provenance. + metadata_hash, legacy_hash = FORMAT24_COMMENT_HASHES[kind, layout] + expected["metadata"]["all_fields_sha256"] = metadata_hash + expected["provenance"]["all_fields_sha256"] = FORMAT24_SOURCE_HASH + expected["legacy_fields_sha256"] = legacy_hash + assert snapshot(case, kind, layout) == expected diff --git a/tests/test_read_record.py b/tests/test_read_record.py index b30b95c1..c16f94f1 100644 --- a/tests/test_read_record.py +++ b/tests/test_read_record.py @@ -1,330 +1,116 @@ -"""Tests for the opt-in record reader with explicit argument names.""" +"""The 6.0 record reader returns one selected RecordData view.""" -import fsspec import numpy as np import pytest import wfdb -from wfdb.io import record as record_module -def test_uniform_selected_read_matches_rdrecord(): - """An explicit uniform layout retains the legacy selection semantics.""" - path = "sample-data/100" - actual = wfdb.read_record(path, layout="uniform", start=10, stop=20, channels=[1]) - expected = wfdb.rdrecord(path, sampfrom=10, sampto=20, channels=[1]) - - assert isinstance(actual, wfdb.Record) - assert actual.sig_len == 10 - assert actual.sig_name == ["V5"] - np.testing.assert_array_equal(actual.p_signal, expected.p_signal) - assert actual.metadata == expected.metadata - - -def test_read_record_requires_layout(): - """A caller must choose whether multi-frequency samples are smoothed.""" - with pytest.raises(TypeError, match="required keyword-only argument: 'layout'"): - wfdb.read_record("sample-data/100") - - -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -def test_signal_alignment_names_the_returned_view(reader): - """The modern choice maps to the established aligned and raw reads.""" - path = "sample-data/100skew" - options = {"kind": "digital", "layout": "uniform", "stop": 20} - - def values(result): - return ( - result.signals.values - if isinstance(result, wfdb.RecordData) - else result.d_signal - ) - - default = reader(path, **options) - aligned = reader(path, signal_alignment="aligned", **options) - raw = reader(path, signal_alignment="raw", **options) - legacy_raw = wfdb.rdrecord(path, physical=False, sampto=20, ignore_skew=True) - - np.testing.assert_array_equal(values(default), values(aligned)) - np.testing.assert_array_equal(values(raw), legacy_raw.d_signal) - assert not np.array_equal(values(aligned), values(raw)) - - with pytest.raises(ValueError, match="signal_alignment must be"): - reader(path, signal_alignment="shifted", **options) - with pytest.raises(TypeError, match="unexpected keyword argument 'ignore_skew'"): - reader(path, ignore_skew=True, **options) - - -def test_digital_expanded_read_matches_rdrecord(): - """Kind, layout, and resolution map to the existing digital read.""" +@pytest.mark.parametrize("kind", ["physical", "digital"]) +@pytest.mark.parametrize("layout", ["uniform", "expanded"]) +def test_read_record_matches_legacy_values(kind, layout): + """The new result keeps the values selected by the legacy reader.""" path = "sample-data/mixedsignals" - actual = wfdb.read_record( + data = wfdb.read_record( path, start=10, stop=20, - channels=[0, 3], - kind="digital", - layout="expanded", - resolution=32, + channels=[3, 0], + kind=kind, + layout=layout, ) - expected = wfdb.rdrecord( + old = wfdb.rdrecord( path, sampfrom=10, sampto=20, - channels=[0, 3], - physical=False, - smooth_frames=False, - return_res=32, - ) - - assert isinstance(actual, wfdb.Record) - assert actual.e_p_signal is None - assert actual.e_d_signal is not None - assert actual.sig_len == 10 - assert actual.samps_per_frame == [4, 2] - for values, old_values in zip(actual.e_d_signal, expected.e_d_signal): - np.testing.assert_array_equal(values, old_values) - - -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -@pytest.mark.parametrize("layout", ["uniform", "expanded"]) -def test_digital_resolution_too_narrow_raises_value_error(reader, layout): - """Callers can catch an unsupported digital resolution specifically.""" - with pytest.raises(ValueError, match="Cannot convert digital samples"): - reader( - "sample-data/100", - kind="digital", - layout=layout, - resolution=8, - stop=10, - ) - - -@pytest.mark.parametrize("combine_segments", [True, False]) -def test_multi_segment_return_type_and_selection(combine_segments): - """Combining produces a Record; preserving segments produces a MultiRecord.""" - path = "sample-data/multi-segment/041s/041s" - actual = wfdb.read_record( - path, - layout="uniform", - start=900, - stop=1100, - kind="digital", - combine_segments=combine_segments, + channels=[3, 0], + physical=kind == "physical", + smooth_frames=layout == "uniform", ) - expected = wfdb.rdrecord( - path, - sampfrom=900, - sampto=1100, - physical=False, - m2s=combine_segments, + assert type(data) is wfdb.RecordData + assert data.metadata.n_frames == 10 + assert [channel.logical.name for channel in data.metadata.channels] == [ + "ABP", + "II", + ] + field = ( + ("p_signal" if kind == "physical" else "d_signal") + if layout == "uniform" + else ("e_p_signal" if kind == "physical" else "e_d_signal") ) - - assert type(actual) is type(expected) - assert actual.sig_len == expected.sig_len == 200 - if combine_segments: - assert isinstance(actual, wfdb.Record) - np.testing.assert_array_equal(actual.d_signal, expected.d_signal) - assert actual.source_segments == expected.source_segments + expected = getattr(old, field) + values = data.signals.values + if layout == "uniform": + np.testing.assert_array_equal(values, expected) else: - assert isinstance(actual, wfdb.MultiRecord) - assert actual.seg_name == expected.seg_name - for segment, old_segment in zip(actual.segments, expected.segments): - np.testing.assert_array_equal(segment.d_signal, old_segment.d_signal) - - -def test_local_archive_path(tmp_path): - """A local archive path reads the same values as its source record.""" - from wfdb.io.archive import create_archive - - archive = tmp_path / "100.wfdb" - create_archive(["sample-data/100.hea", "sample-data/100.dat"], archive) - actual = wfdb.read_record(archive, layout="uniform", stop=10) - expected = wfdb.rdrecord("sample-data/100", sampto=10) - - np.testing.assert_array_equal(actual.p_signal, expected.p_signal) - - -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -def test_header_filename_is_accepted(reader): - """New readers accept a header filename as well as a record stem.""" - extra = {"layout": "uniform"} - actual = reader("sample-data/100.hea", stop=3, **extra) - expected = reader("sample-data/100", stop=3, **extra) - values = actual.signals.values if reader is wfdb.read_signals else actual.p_signal - expected_values = ( - expected.signals.values if reader is wfdb.read_signals else expected.p_signal - ) - np.testing.assert_array_equal(values, expected_values) - - -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -def test_conflicting_channel_selectors_fail(reader): - """Named selection must not silently discard index selection.""" - extra = {"layout": "uniform"} - with pytest.raises(ValueError, match="channels and channel_names"): - reader("sample-data/100", channels=[0], channel_names=["V5"], **extra) + for actual_channel, old_channel in zip(values, expected): + np.testing.assert_array_equal(actual_channel, old_channel) -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -@pytest.mark.parametrize( - ("path", "present", "missing"), - [ - ("sample-data/100", "MLII", "MISSING"), - ("sample-data/multi-segment/041s/041s", "I", "MISSING"), - ( - "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57", - "PLETH", - "MISSING", - ), - ], -) -def test_unknown_channel_names_are_explicit(reader, path, present, missing): - """A typo fails before samples are read unless skipping is requested.""" - extra = {"layout": "uniform"} - with pytest.raises(ValueError, match=f"Unknown channel name.*{missing}"): - reader(path, channel_names=[present, missing], stop=5, **extra) - - selected = reader( - path, - channel_names=[present, missing], - missing_channels="ignore", - stop=5, - **extra, +def test_read_record_always_returns_record_data_for_multi_segment(): + """The segment reader owns the uncombined result type.""" + path = "sample-data/multi-segment/041s/041s" + data = wfdb.read_record( + path, start=900, stop=1100, kind="digital", layout="uniform" ) - names = ( - [signal.name for signal in selected.metadata.signals] - if reader is wfdb.read_signals - else selected.sig_name + segments = wfdb.read_segments( + path, start=900, stop=1100, kind="digital", layout="uniform" ) - assert names == [present] + assert type(data) is wfdb.RecordData + assert type(segments) is wfdb.SegmentedRecordData + assert data.metadata.n_frames == 200 + assert data.source_segments -def test_layout_channel_absent_from_window_is_still_valid(): - """Strict names use the layout header, not selected segment contents.""" - record = wfdb.read_record( - "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57", - layout="uniform", - channel_names=["V"], - stop=10, - ) - assert record.sig_name == ["V"] - - -def test_unknown_name_fails_before_signal_file_is_opened(tmp_path): - """A missing data file cannot hide an unknown channel-name error.""" - (tmp_path / "r.hea").write_text("r 1 100 2\nmissing.dat 16 200/mV 16 0 0 0 0 I\n") - with pytest.raises(ValueError, match="Unknown channel name.*II"): - wfdb.read_record(tmp_path / "r", layout="uniform", channel_names=["II"]) - - -def test_missing_channel_policy_is_validated_before_reading(): - """An invalid policy or name list fails without opening the source.""" - with pytest.raises(ValueError, match="missing_channels"): - wfdb.read_record("missing", layout="uniform", missing_channels="maybe") - with pytest.raises(TypeError, match="channel_names"): - wfdb.read_record("missing", layout="uniform", channel_names="MLII") - - -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -@pytest.mark.parametrize( - ("selection", "message"), - [ - ({"channels": [0, 0]}, "channels must not contain duplicates"), - ( - {"channel_names": ["V5", "V5"]}, - "channel_names must not contain duplicates", - ), - ({"channel_names": "V5"}, "channel_names must be"), - ({"channel_names": []}, "channel_names must not be empty"), - ], -) -def test_invalid_channel_selection_has_clear_error(reader, selection, message): - """Bad selectors fail before reaching the legacy reader internals.""" - extra = {"layout": "uniform"} - with pytest.raises((TypeError, ValueError), match=message): - reader("sample-data/100", **selection, **extra) - +def test_read_record_requires_layout(): + """The caller must choose uniform or expanded samples.""" + with pytest.raises(TypeError, match="required keyword-only argument: 'layout'"): + wfdb.read_record("sample-data/100") -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -def test_data_filename_suggests_record_stem(reader): - """A .dat filename has a useful error before a .dat.hea lookup.""" - extra = {"layout": "uniform"} - with pytest.raises(ValueError, match="record stem or .hea file"): - reader("sample-data/100.dat", **extra) +@pytest.mark.parametrize("value", [False, None]) +def test_read_record_rejects_uncombined_segment_option(value): + """An old uncombined segment option names both replacements.""" + with pytest.raises(TypeError, match="read_segments.*rdrecord"): + wfdb.read_record("sample-data/100", layout="uniform", combine_segments=value) -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -def test_ignoring_all_missing_names_reports_empty_selection(reader): - """An optional channel policy cannot silently return no channels.""" - extra = {"layout": "uniform"} - with pytest.raises(ValueError, match="None of the requested channel names"): - reader( - "sample-data/100", - channel_names=["MISSING"], - missing_channels="ignore", - stop=5, - **extra, - ) +def test_read_record_rejects_combined_segment_option(): + """The old combined default tells callers to omit the argument.""" + with pytest.raises(TypeError, match="remove the argument.*always combines"): + wfdb.read_record("sample-data/100", layout="uniform", combine_segments=True) -def test_legacy_reader_still_skips_unknown_names(): - """The new default does not change rdrecord's selection behavior.""" - record = wfdb.rdrecord( - "sample-data/100", channel_names=["MLII", "MISSING"], sampto=5 - ) - assert record.sig_name == ["MLII"] +def test_read_record_removed_option_is_clear_in_signature(): + """The migration-only option does not look like a useful default.""" + import inspect -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -def test_warn_empty_is_removed_from_new_readers(reader): - """The unsupported keyword has the usual Python signature error.""" - extra = {"layout": "uniform"} - with pytest.raises(TypeError, match="unexpected keyword argument 'warn_empty'"): - reader("sample-data/100", stop=2, warn_empty=False, **extra) + signature = str(inspect.signature(wfdb.read_record)) + assert "combine_segments=" in signature -@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_signals]) -@pytest.mark.parametrize( - "selection", - [ - {"channels": range(2)}, - {"channels": np.array([0, 1])}, - {"channel_names": np.array(["MLII", "V5"])}, - ], -) -def test_channel_selection_accepts_sequences_and_numpy_arrays(reader, selection): - """Modern readers accept common array-like channel selectors.""" - extra = {"layout": "uniform"} - selected = reader("sample-data/100", stop=2, **selection, **extra) - names = ( - [signal.name for signal in selected.metadata.signals] - if reader is wfdb.read_signals - else selected.sig_name - ) - assert names == ["MLII", "V5"] +def test_signal_alignment_names_the_returned_view(): + """Aligned and raw reads retain their established sample positions.""" + path = "sample-data/100skew" + options = {"kind": "digital", "layout": "uniform", "stop": 20} + aligned = wfdb.read_record(path, signal_alignment="aligned", **options) + raw = wfdb.read_record(path, signal_alignment="raw", **options) + old_raw = wfdb.rdrecord(path, physical=False, sampto=20, ignore_skew=True) + np.testing.assert_array_equal(raw.signals.values, old_raw.d_signal) + assert not np.array_equal(aligned.signals.values, raw.signals.values) -def test_memory_uri_source(tmp_path): - """A cloud URI in path reads a record without pn_dir.""" - directory = f"memory://read-record-{tmp_path.name}" - wfdb.wrsamp( - "copy", - fs=100, - units=["mV"], - sig_name=["I"], - p_signal=np.array([[0.0], [0.1], [0.2]]), - fmt=["16"], - write_dir=directory, +def test_header_filename_and_named_selection(): + """Header paths and channel names use the modern selection rules.""" + data = wfdb.read_record( + "sample-data/100.hea", + layout="uniform", + stop=3, + channel_names=["V5", "MISSING"], + missing_channels="ignore", ) - path = f"{directory}/copy" - actual = wfdb.read_record(path, layout="uniform") - expected = wfdb.rdrecord(path) - - np.testing.assert_array_equal(actual.p_signal, expected.p_signal) - with pytest.raises(TypeError, match="unexpected keyword argument 'pn_dir'"): - wfdb.read_record(path, layout="uniform", pn_dir="mitdb") - fsspec.filesystem("memory").rm(directory, recursive=True) + assert [channel.logical.name for channel in data.metadata.channels] == ["V5"] + assert data.signals.values.shape == (3, 1) @pytest.mark.parametrize( @@ -334,81 +120,17 @@ def test_memory_uri_source(tmp_path): ({"layout": "flat"}, "layout must be"), ({"resolution": True}, "resolution must be"), ({"kind": "physical", "resolution": 8}, "physical values"), + ({"channel_names": "V5"}, "channel_names must be"), + ({"channels": [0, 0]}, "channels must not contain duplicates"), ], ) -def test_invalid_representation_options_fail_early(options, message): - """Invalid new options fail before the source is opened.""" - with pytest.raises(ValueError, match=message): +def test_invalid_options_fail_before_reading(options, message): + """Invalid modern options fail before any source is opened.""" + with pytest.raises((TypeError, ValueError), match=message): wfdb.read_record("missing", **({"layout": "uniform"} | options)) -@pytest.mark.parametrize( - ("reader", "extra"), - [ - (wfdb.read_record, {"layout": "uniform"}), - (wfdb.read_signals, {"layout": "uniform"}), - ], -) -def test_range_errors_use_new_argument_names(reader, extra): - """A caller of either new reader sees start and stop in range errors.""" - with pytest.raises(ValueError, match="stop must be greater than start"): - reader("missing", start=10, stop=5, **extra) - with pytest.raises(ValueError, match="start must be a non-negative integer"): - reader("missing", start=-1, **extra) - with pytest.raises(TypeError, match="stop must be an integer"): - reader("missing", stop="five", **extra) - with pytest.raises(ValueError, match="stop must not exceed the record length"): - reader("sample-data/100", stop=650001, **extra) - - -def test_all_arguments_forward_to_reader(monkeypatch): - """Every new keyword reaches the matching internal reader option.""" - calls = [] - result = object() - - def fake_reader(*args, **kwargs): - calls.append((args, kwargs)) - return result - - monkeypatch.setattr(record_module, "_read_record_with_channel_policy", fake_reader) - actual = wfdb.read_record( - "100", - start=1, - stop=3, - channels=None, - kind="digital", - layout="expanded", - combine_segments=False, - signal_alignment="raw", - resolution=32, - force_channels=False, - channel_names=["ECG"], - missing_channels="ignore", - ) - - assert actual is result - assert calls == [ - ( - (), - { - "record_name": "100", - "sampfrom": 1, - "sampto": 3, - "channels": None, - "physical": False, - "pn_dir": None, - "m2s": False, - "smooth_frames": False, - "ignore_skew": True, - "return_res": 32, - "force_channels": False, - "channel_names": ["ECG"], - "warn_empty": False, - "missing_channels": "ignore", - }, - ) - ] - - wfdb.read_record("100", layout="uniform", channels=[0], start=1, stop=3) - assert calls[-1][1]["channels"] == [0] - assert calls[-1][1]["channel_names"] is None +def test_read_record_rejects_pn_dir(): + """Modern reads require a complete path or URI.""" + with pytest.raises(TypeError, match="pn_dir"): + wfdb.read_record("sample-data/100", layout="uniform", pn_dir="mitdb") diff --git a/tests/test_read_signals_range_errors.py b/tests/test_read_record_range_errors.py similarity index 71% rename from tests/test_read_signals_range_errors.py rename to tests/test_read_record_range_errors.py index 9abe5e75..20f80fa6 100644 --- a/tests/test_read_signals_range_errors.py +++ b/tests/test_read_record_range_errors.py @@ -12,26 +12,23 @@ ("sample-data/multi-segment/fixed1/v102s", 225000), ], ) -@pytest.mark.parametrize("reader", [wfdb.read_signals, wfdb.read_record]) -def test_invalid_window_names_start_and_stop(path, length, reader): +def test_invalid_window_names_start_and_stop(path, length): """Single- and multi-segment errors use the same modern names.""" with pytest.raises( ValueError, match="start must be shorter than the record length" ) as error: - reader(path, layout="uniform", start=length) + wfdb.read_record(path, layout="uniform", start=length) assert "sampto" not in str(error.value) with pytest.raises( ValueError, match="stop must not exceed the record length" ) as error: - reader(path, layout="uniform", stop=length + 1) + wfdb.read_record(path, layout="uniform", stop=length + 1) assert "sampto" not in str(error.value) -@pytest.mark.parametrize( - "reader", [wfdb.read_signals, wfdb.read_record, wfdb.read_segments] -) +@pytest.mark.parametrize("reader", [wfdb.read_record, wfdb.read_segments]) def test_multi_segment_readers_share_range_wording(reader): - """All three modern multi-segment readers report the same bounds.""" + """Both modern multi-segment readers report the same bounds.""" path = "sample-data/multi-segment/fixed1/v102s" with pytest.raises( ValueError, match="start must be shorter than the record length" diff --git a/tests/test_read_signals.py b/tests/test_read_record_values.py similarity index 81% rename from tests/test_read_signals.py rename to tests/test_read_record_values.py index a8348fcc..dff6c650 100644 --- a/tests/test_read_signals.py +++ b/tests/test_read_record_values.py @@ -1,14 +1,15 @@ -"""Tests for the concise, structured signal reader.""" +"""Selected signal values returned by the record reader.""" import numpy as np import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("kind", ["physical", "digital"]) @pytest.mark.parametrize("layout", ["uniform", "expanded"]) -def test_read_signals_returns_selected_values(kind, layout): +def test_read_record_returns_selected_values(kind, layout): """The reader returns selected values and metadata in either layout.""" options = dict( layout=layout, @@ -18,8 +19,8 @@ def test_read_signals_returns_selected_values(kind, layout): channel_names=["II", "ABP"], ) path = "sample-data/mixedsignals" - actual = wfdb.read_signals(path, **options) - expected = wfdb.read_record(path, **options) + actual = wfdb.read_record(path, **options) + expected = read_mutable_record(path, **options) assert isinstance(actual, wfdb.RecordData) assert actual.metadata.n_frames == expected.sig_len @@ -46,12 +47,12 @@ def test_provisional_reader_name_is_removed(): assert not hasattr(wfdb.io, "read_signal_values") -def test_read_signals_requires_layout_and_keeps_rdsamp_result(): +def test_read_record_requires_layout_and_keeps_rdsamp_result(): """The new reader makes layout explicit without changing the legacy tuple.""" with pytest.raises(TypeError, match="required keyword-only argument: 'layout'"): - wfdb.read_signals("sample-data/100") + wfdb.read_record("sample-data/100") - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=3) old_values, old_fields = wfdb.rdsamp("sample-data/100", sampto=3) np.testing.assert_array_equal(read.signals.values, old_values) assert read.metadata.fs == old_fields["fs"] diff --git a/tests/test_read_segments.py b/tests/test_read_segments.py index bf99c5db..0756253f 100644 --- a/tests/test_read_segments.py +++ b/tests/test_read_segments.py @@ -87,7 +87,7 @@ def test_fixed_boundary_matches_combined_read(kind, layout): "channels": [3, 0], } read = wfdb.read_segments(FIXED, **options) - combined = wfdb.read_signals(FIXED, **options) + combined = wfdb.read_record(FIXED, **options) assert isinstance(read, wfdb.SegmentedRecordData) assert read.layout == "fixed" assert read.source_header.record_name == "v102s" @@ -127,7 +127,7 @@ def test_variable_layout_gap_and_absent_channel_match_combined(kind, layout): "channel_names": ["ABP", "II"], } read = wfdb.read_segments(VARIABLE, **options) - combined = wfdb.read_signals(VARIABLE, **options) + combined = wfdb.read_record(VARIABLE, **options) assert read.layout == "variable" assert read.channel_header.record_name == "3234460_layout" assert read.channel_header.n_frames == 0 @@ -209,7 +209,7 @@ def test_segment_can_be_written_on_its_own(tmp_path): part = read.segments[0].data destination = tmp_path / "part" part.write(destination) - restored = wfdb.read_signals(destination, kind="digital", layout="uniform") + restored = wfdb.read_record(destination, kind="digital", layout="uniform") np.testing.assert_array_equal(restored.signals.values, part.signals.values) @@ -236,7 +236,7 @@ def test_raw_alignment_is_applied_to_each_segment(tmp_path, layout): .segments[0] .data ) - direct = wfdb.read_signals( + direct = wfdb.read_record( tmp_path / "test01_00s_skew", signal_alignment="raw", **options ) arrays = raw.signals.values if layout == "expanded" else (raw.signals.values,) @@ -265,7 +265,7 @@ def test_mismatched_calibration_does_not_block_uncombined_digital_read(layout): "stop": 2225810, } with pytest.raises(ValueError, match="different adc_gain"): - wfdb.read_signals(path, **options) + wfdb.read_record(path, **options) read = wfdb.read_segments(path, **options) assert len(read.segments) == 2 assert all(part.data is not None for part in read.segments) diff --git a/tests/test_record.py b/tests/test_record.py index 1060d1e2..05b4b4b0 100644 --- a/tests/test_record.py +++ b/tests/test_record.py @@ -8,6 +8,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record class TestRecord: @@ -2254,12 +2255,12 @@ def test_assigned_skew_is_rejected(self, tmp_path): def test_processed_aligned_values_can_be_written(self, tmp_path): """A new array derived from aligned values retains their alignment.""" - record = wfdb.read_record("sample-data/100skew", layout="uniform", stop=100) + record = read_mutable_record("sample-data/100skew", layout="uniform", stop=100) record.p_signal = record.p_signal - record.p_signal.mean(axis=0) record.write(tmp_path / "copy", signal_alignment="aligned") - written = wfdb.read_record(tmp_path / "copy", layout="uniform") + written = read_mutable_record(tmp_path / "copy", layout="uniform") assert not any( signal.skew for signal in wfdb.read_header(tmp_path / "copy").signals ) @@ -2277,7 +2278,7 @@ def test_trimmed_aligned_values_can_be_written(self, tmp_path): def test_selected_signal_read_writes_without_double_skew(self, tmp_path): """A copied RecordData retains alignment through its write method.""" - selected = wfdb.read_signals( + selected = wfdb.read_record( "sample-data/100skew", stop=100, channels=[1], @@ -2285,16 +2286,14 @@ def test_selected_signal_read_writes_without_double_skew(self, tmp_path): layout="expanded", ) selected.write(tmp_path / "copy", signal_alignment="aligned") - expected = wfdb.read_signals( + expected = wfdb.read_record( "sample-data/100skew", stop=100, channels=[1], kind="digital", layout="expanded", ) - written = wfdb.read_signals( - tmp_path / "copy", kind="digital", layout="expanded" - ) + written = wfdb.read_record(tmp_path / "copy", kind="digital", layout="expanded") np.testing.assert_array_equal( written.signals.values[0], expected.signals.values[0] ) diff --git a/tests/test_record_channel_selection.py b/tests/test_record_channel_selection.py index 4dfff105..f71ad342 100644 --- a/tests/test_record_channel_selection.py +++ b/tests/test_record_channel_selection.py @@ -3,12 +3,13 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import _header def test_current_channel_view_reflects_in_place_edits(): """A later view sees a list edit without retaining an earlier copy.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100skew", layout="uniform", stop=8, kind="digital" ) before = _header._capture_signal_fields(record, _header.SIGNAL_SPECS.index) @@ -23,7 +24,7 @@ def test_current_channel_view_reflects_in_place_edits(): def test_current_channel_view_rejects_misaligned_fields(): """A channel view cannot silently drop a shortened parallel field.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=8, kind="digital" ) record.sig_name = record.sig_name[:1] @@ -34,7 +35,7 @@ def test_current_channel_view_rejects_misaligned_fields(): def test_selection_keeps_shared_file_and_skew_with_each_channel(): """Reordering channels carries their file references and skew together.""" - selected = wfdb.read_record( + selected = read_mutable_record( "sample-data/100skew", layout="uniform", stop=8, channels=[1, 0], kind="digital" ) @@ -46,7 +47,7 @@ def test_selection_keeps_shared_file_and_skew_with_each_channel(): def test_expanded_selection_keeps_samples_per_frame_with_each_channel(): """Reordering expanded channels preserves their different frame widths.""" - selected = wfdb.read_record( + selected = read_mutable_record( "sample-data/test01_00s_frame", stop=4, channels=[1, 0], @@ -61,7 +62,7 @@ def test_expanded_selection_keeps_samples_per_frame_with_each_channel(): def test_variable_layout_selection_projects_layout_header_channels(): """The selected layout segment retains aligned null-signal fields.""" - selected = wfdb.read_record( + selected = read_mutable_record( "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57", layout="uniform", stop=100, diff --git a/tests/test_record_data_calibration.py b/tests/test_record_data_calibration.py index db163503..b9a5c898 100644 --- a/tests/test_record_data_calibration.py +++ b/tests/test_record_data_calibration.py @@ -31,7 +31,7 @@ def _digital_read(tmp_path): adc_gain=[2, 4], baseline=[0, 1], ) - return wfdb.read_signals(source, kind="digital", layout="uniform") + return wfdb.read_record(source, kind="digital", layout="uniform") def test_reinterpret_keeps_digital_values_and_changes_physical_scale(tmp_path): @@ -54,7 +54,7 @@ def test_reinterpret_keeps_digital_values_and_changes_physical_scale(tmp_path): assert edited.to_physical().signals.values[0, 0] == -0.5 target = tmp_path / "reinterpret" edited.write(target) - restored = wfdb.read_signals(target, kind="digital", layout="uniform") + restored = wfdb.read_record(target, kind="digital", layout="uniform") assert restored.metadata.signals == edited.metadata.signals np.testing.assert_array_equal(restored.signals.values, edited.signals.values) @@ -74,7 +74,7 @@ def test_rescale_preserves_physical_values_up_to_adc_rounding(tmp_path): assert not np.shares_memory(edited.signals.values, original.signals.values) target = tmp_path / "rescale" wfdb.write_record(target, edited) - restored = wfdb.read_signals(target, kind="digital", layout="uniform") + restored = wfdb.read_record(target, kind="digital", layout="uniform") np.testing.assert_array_equal(restored.signals.values, edited.signals.values) np.testing.assert_array_equal(np.ma.getmaskarray(restored.signals.values), mask) np.testing.assert_array_equal( @@ -87,7 +87,7 @@ def test_rescale_preserves_physical_values_up_to_adc_rounding(tmp_path): def test_rescale_preserves_loaded_integer_resolution(tmp_path, layout): """A requested int16 read remains int16 after a valid calibration edit.""" _digital_read(tmp_path) - read = wfdb.read_signals( + read = wfdb.read_record( tmp_path / "source", kind="digital", layout=layout, resolution=16 ) gains = [signal.adc_gain for signal in read.metadata.signals] @@ -112,7 +112,7 @@ def test_rescale_rejects_samples_outside_loaded_resolution(tmp_path): baseline=[0], missing="none", ) - read = wfdb.read_signals(path, kind="digital", layout="uniform", resolution=32) + read = wfdb.read_record(path, kind="digital", layout="uniform", resolution=32) read = read.with_values(np.array([[0], [1000]], dtype=np.int16), missing="none") with pytest.raises(ValueError, match="loaded int16 resolution"): read.with_calibration(adc_gain=[100], baseline=[0], mode="rescale") @@ -120,7 +120,7 @@ def test_rescale_rejects_samples_outside_loaded_resolution(tmp_path): def test_expanded_rescale_keeps_lengths_and_source_provenance(): """Each expanded channel retains its own sample count.""" - original = wfdb.read_signals( + original = wfdb.read_record( "sample-data/test01_00s_frame", kind="digital", layout="expanded", stop=5 ) gain = [item.adc_gain for item in original.metadata.signals] diff --git a/tests/test_record_data_edits.py b/tests/test_record_data_edits.py index 03259d4a..6123a0d1 100644 --- a/tests/test_record_data_edits.py +++ b/tests/test_record_data_edits.py @@ -14,7 +14,7 @@ def test_select_uses_current_values_and_preserves_source(kind, layout): """A second selection copies edits and keeps source coordinates.""" path = "sample-data/mixedsignals" - read = wfdb.read_signals( + read = wfdb.read_record( path, layout=layout, kind=kind, @@ -36,7 +36,7 @@ def test_select_uses_current_values_and_preserves_source(kind, layout): read.metadata.signals[0].name, ] assert selected.metadata.channels[0].storage.checksum is not None - direct = wfdb.read_signals( + direct = wfdb.read_record( path, layout=layout, kind=kind, @@ -64,7 +64,7 @@ def test_select_uses_current_values_and_preserves_source(kind, layout): def test_select_rebases_flattened_segments(): """Combined segment offsets follow the newly selected view.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/fixed1/v102s", layout="uniform", kind="digital", @@ -80,7 +80,7 @@ def test_select_rebases_flattened_segments(): ("v102s_1", 0, 2), ("v102s_2", 2, 4), ] - direct = wfdb.read_signals( + direct = wfdb.read_record( "sample-data/multi-segment/fixed1/v102s", layout="uniform", kind="digital", @@ -95,10 +95,10 @@ def test_select_rebases_flattened_segments(): def test_flattened_physical_selection_keeps_absent_digital_declarations(): """Flattened physical metadata matches the direct multi-segment read.""" path = "sample-data/multi-segment/041s/041s" - selected = wfdb.read_signals( + selected = wfdb.read_record( path, layout="uniform", kind="physical", start=10, stop=20 ).select(start=2, stop=6) - direct = wfdb.read_signals( + direct = wfdb.read_record( path, layout="uniform", kind="physical", start=12, stop=16 ) assert selected.metadata == direct.metadata @@ -109,11 +109,11 @@ def test_flattened_physical_selection_keeps_absent_digital_declarations(): def test_fixed_layout_selection_updates_source_signal_header(): """A selection starting in a later segment names that segment's header.""" path = "sample-data/multi-segment/fixed1/v102s" - read = wfdb.read_signals( + read = wfdb.read_record( path, layout="uniform", kind="digital", start=74996, stop=75004 ) selected = read.select(start=5, stop=8) - direct = wfdb.read_signals( + direct = wfdb.read_record( path, layout="uniform", kind="digital", start=75001, stop=75004 ) assert selected.source_signal_header == direct.source_signal_header @@ -126,10 +126,10 @@ def test_fixed_layout_selection_updates_source_signal_header(): def test_select_matches_direct_read_metadata_and_values(tmp_path, kind, layout): """Selecting a read reproduces a directly selected source window.""" path = "sample-data/100" - selected = wfdb.read_signals( + selected = wfdb.read_record( path, kind=kind, layout=layout, start=10, stop=20 ).select(start=2, stop=6, channels=[1, 0]) - direct = wfdb.read_signals( + direct = wfdb.read_record( path, kind=kind, layout=layout, start=12, stop=16, channels=[1, 0] ) assert selected.metadata == direct.metadata @@ -164,7 +164,7 @@ def test_select_matches_direct_read_metadata_and_values(tmp_path, kind, layout): def test_select_by_name_and_invalid_selection(): """Names must identify one loaded channel; index and frame errors are clear.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=8) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=8) name = read.metadata.signals[1].name assert read.select(channel_names=[name]).metadata.n_signals == 1 for kwargs, message in ( @@ -183,7 +183,7 @@ def test_select_by_name_and_invalid_selection(): def test_raw_skew_selection_preserves_incomplete_tail_rule(tmp_path): """A trimmed raw view cannot silently write incomplete skewed data.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/test01_00s_skew", layout="uniform", kind="digital", @@ -200,7 +200,7 @@ def test_raw_skew_selection_preserves_incomplete_tail_rule(tmp_path): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_with_values_copies_and_keeps_metadata(kind, layout): """Replaced arrays have the same shape and independent storage.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/mixedsignals", layout=layout, kind=kind, stop=5 ) arrays = read.signals.values if layout == "expanded" else (read.signals.values,) @@ -221,9 +221,7 @@ def test_with_values_copies_and_keeps_metadata(kind, layout): def test_with_values_requires_explicit_digital_missing_policy(): """A stripped digital mask needs an explicit no-missing declaration.""" - read = wfdb.read_signals( - "sample-data/100", layout="uniform", kind="digital", stop=5 - ) + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital", stop=5) bare = np.asarray(read.signals.values) with pytest.raises(ValueError, match='missing="none"'): read.with_values(bare) @@ -236,9 +234,7 @@ def test_with_values_requires_explicit_digital_missing_policy(): def test_with_values_rejects_known_format_range_and_marker(): """Digital replacements are checked against the loaded channel format.""" - read = wfdb.read_signals( - "sample-data/100", layout="uniform", kind="digital", stop=5 - ) + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital", stop=5) values = read.signals.values.copy() values[0, 0] = -2048 with pytest.raises(ValueError, match="missing marker"): @@ -269,7 +265,7 @@ def test_masked_digital_edit_preserves_gaps_and_copies_mask(tmp_path): adc_gain=[200.0, 200.0], baseline=[0, 0], ) - read = wfdb.read_signals(source, kind="digital", layout="uniform") + read = wfdb.read_record(source, kind="digital", layout="uniform") selected = read.select(start=1, stop=4, channels=[1, 0]) np.testing.assert_array_equal(selected.signals.values.mask[0], [True, True]) edited = selected.with_values(selected.signals.values) @@ -277,7 +273,7 @@ def test_masked_digital_edit_preserves_gaps_and_copies_mask(tmp_path): assert not edited.signals.values.mask[0, 0] assert selected.signals.values.mask[0, 0] edited.write(tmp_path / "edited") - restored = wfdb.read_signals(tmp_path / "edited", kind="digital", layout="uniform") + restored = wfdb.read_record(tmp_path / "edited", kind="digital", layout="uniform") np.testing.assert_array_equal( restored.signals.values.mask, edited.signals.values.mask ) @@ -285,7 +281,7 @@ def test_masked_digital_edit_preserves_gaps_and_copies_mask(tmp_path): def test_with_values_rejects_wrong_kind_layout_and_shape(): """Replacement validation happens at the edit call.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=5) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=5) for values, message in ( (np.ones((5, 2), dtype="int16"), "wrong dtype"), (np.ones(5, dtype="float64"), "layout"), @@ -299,15 +295,13 @@ def test_with_values_rejects_wrong_kind_layout_and_shape(): def test_edited_digital_write_recomputes_header_features(tmp_path): """A changed value is written with its new initial value and checksum.""" - read = wfdb.read_signals( - "sample-data/100", layout="uniform", kind="digital", stop=8 - ) + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital", stop=8) values = read.signals.values.copy() values[0, 0] += 10 edited = read.with_values(values) destination = tmp_path / "edited" edited.write(destination) - reread = wfdb.read_signals(destination, layout="uniform", kind="digital") + reread = wfdb.read_record(destination, layout="uniform", kind="digital") np.testing.assert_array_equal(reread.signals.values, values) header = wfdb.read_header(destination) assert header.signals[0].init_value == int(values[0, 0]) @@ -316,11 +310,11 @@ def test_edited_digital_write_recomputes_header_features(tmp_path): def test_edited_physical_write_keeps_calibration(tmp_path): """A physical selection is writable with its original calibration.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=8) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=8) selected = read.select(start=2, stop=6, channels=[1]) destination = tmp_path / "selected" selected.write(destination) - restored = wfdb.read_signals(destination, layout="uniform") + restored = wfdb.read_record(destination, layout="uniform") assert restored.metadata.n_frames == 4 assert restored.metadata.n_signals == 1 assert ( @@ -334,7 +328,7 @@ def test_edited_physical_write_keeps_calibration(tmp_path): @pytest.mark.parametrize("kind", ["physical", "digital"]) def test_converted_result_can_be_selected_and_replaced(kind): """Conversions retain the model needed for later validated edits.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", kind=kind, stop=8) + read = wfdb.read_record("sample-data/100", layout="uniform", kind=kind, stop=8) converted = read.to_digital() if kind == "physical" else read.to_physical() selected = converted.select(start=2, stop=5, channels=[1]) assert selected.source_selection.start == 2 diff --git a/tests/test_record_data_metadata_edits.py b/tests/test_record_data_metadata_edits.py index 2bf50f6b..8251bab7 100644 --- a/tests/test_record_data_metadata_edits.py +++ b/tests/test_record_data_metadata_edits.py @@ -13,7 +13,7 @@ @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_channel_and_comment_edits_round_trip(tmp_path, kind, layout): """Edited text is written while values and source provenance are retained.""" - original = wfdb.read_signals("sample-data/100", kind=kind, layout=layout, stop=8) + original = wfdb.read_record("sample-data/100", kind=kind, layout=layout, stop=8) edited = original.with_channels( names=["ECG lead II", "ECG lead V5"], units=["uV", "uV"] ).with_comments(["Reviewed for release", "Units corrected"]) @@ -60,7 +60,7 @@ def test_channel_and_comment_edits_round_trip(tmp_path, kind, layout): assert converted.metadata.signals[0].units == "uV" edited.write(tmp_path / "edited") - restored = wfdb.read_signals(tmp_path / "edited", kind=kind, layout=layout) + restored = wfdb.read_record(tmp_path / "edited", kind=kind, layout=layout) assert [signal.name for signal in restored.metadata.signals] == [ "ECG lead II", "ECG lead V5", @@ -78,7 +78,7 @@ def test_units_can_be_fixed_when_source_names_are_duplicate(tmp_path): "duplicate.dat 16 200/mV 16 0 0 0 0 same\n" "duplicate.dat 16 200/mV 16 0 0 0 0 same\n" ) - read = wfdb.read_signals(tmp_path / "duplicate", kind="digital", layout="uniform") + read = wfdb.read_record(tmp_path / "duplicate", kind="digital", layout="uniform") corrected = read.with_channels(units=["uV", "mV"]) assert [signal.name for signal in corrected.metadata.signals] == ["same", "same"] assert [signal.units for signal in corrected.metadata.signals] == ["uV", "mV"] @@ -91,7 +91,7 @@ def test_units_can_be_fixed_when_source_names_are_duplicate(tmp_path): def test_invalid_metadata_edits_fail_when_called(): """Bad header text is rejected before any write is attempted.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=4) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=4) for kwargs, message in ( ({}, "Pass names or units"), ({"names": ["only one"]}, "one value per loaded channel"), @@ -131,11 +131,11 @@ def test_invalid_metadata_edits_fail_when_called(): ) def test_printable_header_text_round_trips(tmp_path, field, text): """Accepted punctuation and internal spaces survive writing and reading.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=4) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=4) other = "V5" if field == "names" else "mV" edited = read.with_channels(**{field: [text, other]}) edited.write(tmp_path / "edited") - restored = wfdb.read_signals(tmp_path / "edited", layout="uniform") + restored = wfdb.read_record(tmp_path / "edited", layout="uniform") actual = ( restored.metadata.signals[0].name if field == "names" @@ -146,9 +146,9 @@ def test_printable_header_text_round_trips(tmp_path, field, text): def test_comment_with_internal_hash_round_trips(tmp_path): """An internal hash is preserved even though edge hashes are stripped.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=4) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=4) read.with_comments(["Reviewed #1"]).write(tmp_path / "edited") - restored = wfdb.read_signals(tmp_path / "edited", layout="uniform") + restored = wfdb.read_record(tmp_path / "edited", layout="uniform") assert restored.metadata.comments == ("Reviewed #1",) @@ -162,7 +162,7 @@ def test_comment_with_internal_hash_round_trips(tmp_path): ) def test_nonprintable_header_text_is_rejected(method, value, message): """Validation rejects control characters and line separators.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=4) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=4) with pytest.raises(ValueError, match=message): if method == "comments": read.with_comments([value]) @@ -173,7 +173,7 @@ def test_nonprintable_header_text_is_rejected(method, value, message): def test_metadata_edits_keep_segment_provenance_and_prior_value_edits(tmp_path): """Metadata-only edits preserve segment mappings and edit state.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/fixed1/v102s", kind="digital", layout="uniform", @@ -191,7 +191,7 @@ def test_metadata_edits_keep_segment_provenance_and_prior_value_edits(tmp_path): selected.metadata.channels[0].storage.checksum ) edited.write(tmp_path / "flattened") - restored = wfdb.read_signals( + restored = wfdb.read_record( tmp_path / "flattened", kind="digital", layout="uniform" ) assert [signal.name for signal in restored.metadata.signals] == names diff --git a/tests/test_record_data_name.py b/tests/test_record_data_name.py index 97cc47cd..9bb82d8c 100644 --- a/tests/test_record_data_name.py +++ b/tests/test_record_data_name.py @@ -7,45 +7,93 @@ import wfdb import wfdb.io +from wfdb.io import record as record_module from wfdb.io import signal_values -def test_read_signals_returns_record_data_without_warning(): +def test_read_record_returns_record_data_without_warning(): """The result and its representation use the new class name.""" with warnings.catch_warnings(): warnings.simplefilter("error", DeprecationWarning) - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=3) assert isinstance(read, wfdb.RecordData) assert isinstance(read, wfdb.io.RecordData) assert repr(read).startswith("RecordData(") -def test_signal_read_aliases_refer_to_record_data(): - """Both public import paths warn, while the pickle path stays quiet.""" - with pytest.warns( - DeprecationWarning, - match=r"wfdb\.SignalRead is deprecated; use wfdb\.RecordData instead " - r"\(see the migration guide\)", - ): - public_alias = wfdb.SignalRead - with pytest.warns( - DeprecationWarning, - match=r"wfdb\.io\.SignalRead is deprecated; use " - r"wfdb\.io\.RecordData instead \(see the migration guide\)", - ): - io_alias = wfdb.io.SignalRead +def test_signal_read_public_aliases_are_removed(): + """Only the historical pickle path retains the old class name.""" + assert not hasattr(wfdb, "SignalRead") + assert not hasattr(wfdb.io, "SignalRead") with warnings.catch_warnings(): warnings.simplefilter("error", DeprecationWarning) pickle_alias = signal_values.SignalRead - assert public_alias is io_alias is pickle_alias is wfdb.RecordData - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) - assert isinstance(read, public_alias) - assert isinstance(read, io_alias) + assert pickle_alias is wfdb.RecordData + + +def test_read_signals_is_removed_from_public_modules(): + """The 6.0 API has one combined selected-record reader.""" + for module, old_name, replacement in ( + (wfdb, "read_signals", "wfdb.read_record"), + (wfdb.io, "read_signals", "wfdb.io.read_record"), + ): + assert not hasattr(module, old_name) + with pytest.raises(AttributeError, match=replacement): + getattr(module, old_name) + assert not hasattr(record_module, "read_signals") + + +def test_removed_class_aliases_name_record_data(): + """Importing the removed alias gives a useful replacement.""" + for module, old_name, replacement in ( + (wfdb, "SignalRead", "wfdb.RecordData"), + (wfdb.io, "SignalRead", "wfdb.io.RecordData"), + ): + with pytest.raises(AttributeError, match=replacement): + getattr(module, old_name) + + +@pytest.mark.parametrize( + ("old_name", "replacement"), + [ + ("p_signal", "signals.values"), + ("d_signal", "signals.values"), + ("e_p_signal", "signals.values"), + ("e_d_signal", "signals.values"), + ("fs", "metadata.fs"), + ("sig_name", "metadata.signals"), + ("n_sig", "metadata.n_signals"), + ("sig_len", "metadata.n_frames"), + ("units", "metadata.signals"), + ("adc_gain", "metadata.signals"), + ("baseline", "metadata.signals"), + ("fmt", "metadata.channels"), + ("comments", "metadata.comments"), + ("base_date", "metadata.base_date"), + ("base_time", "metadata.base_time"), + ("wrsamp", "write_record"), + ("adc", "to_digital"), + ("dac", "to_physical"), + ], +) +def test_old_record_fields_name_the_modern_equivalent(old_name, replacement): + """Old Record attribute access points to the RecordData shape.""" + data = wfdb.read_record("sample-data/100", layout="uniform", stop=3) + assert not hasattr(data, old_name) + with pytest.raises(AttributeError, match=replacement): + getattr(data, old_name) + + +def test_unrelated_missing_field_has_plain_attribute_error(): + """Unknown names retain ordinary Python attribute behavior.""" + data = wfdb.read_record("sample-data/100", layout="uniform", stop=3) + with pytest.raises(AttributeError, match="no attribute 'not_a_record_field'"): + _ = data.not_a_record_field def test_new_pickle_records_record_data_class_name(): """New pickles do not depend on the public aliases removed in 6.0.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=3) payload = pickle.dumps(read, protocol=4) assert b"wfdb.io.signal_values" in payload assert b"RecordData" in payload diff --git a/tests/test_record_data_shift_time.py b/tests/test_record_data_shift_time.py index 4bb40ffc..433bf0cf 100644 --- a/tests/test_record_data_shift_time.py +++ b/tests/test_record_data_shift_time.py @@ -39,7 +39,7 @@ def test_complete_timestamp_shift_round_trips_and_keeps_source(tmp_path, kind, l source_date = datetime.date(2020, 5, 6) source_time = datetime.time(23, 59, 59, 123456) path = _timestamped_record(tmp_path, base_date=source_date, base_time=source_time) - read = wfdb.read_signals(path, kind=kind, layout=layout) + read = wfdb.read_record(path, kind=kind, layout=layout) delta = datetime.timedelta(days=3, seconds=2, microseconds=654321) shifted = read.shift_time(delta) expected = datetime.datetime.combine(source_date, source_time) + delta @@ -70,7 +70,7 @@ def test_complete_timestamp_shift_round_trips_and_keeps_source(tmp_path, kind, l header_text = destination.with_suffix(".hea").read_text() assert "06/05/2020" not in header_text assert "23:59:59.123456" not in header_text - restored = wfdb.read_signals(destination, kind=kind, layout=layout) + restored = wfdb.read_record(destination, kind=kind, layout=layout) assert restored.metadata.base_datetime == expected @@ -79,7 +79,7 @@ def test_time_only_shift_wraps_and_ignores_whole_days(tmp_path): path = _timestamped_record( tmp_path, base_date=None, base_time=datetime.time(23, 30, 0, 123456) ) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") shifted = read.shift_time(datetime.timedelta(days=-3, hours=2)) assert shifted.metadata.base_date is None assert shifted.metadata.base_time == datetime.time(1, 30, 0, 123456) @@ -88,7 +88,7 @@ def test_time_only_shift_wraps_and_ignores_whole_days(tmp_path): read.metadata.base_time ) shifted.write(tmp_path / "shifted") - restored = wfdb.read_signals(tmp_path / "shifted", kind="digital", layout="uniform") + restored = wfdb.read_record(tmp_path / "shifted", kind="digital", layout="uniform") assert restored.metadata.base_date is None assert restored.metadata.base_time == shifted.metadata.base_time @@ -98,7 +98,7 @@ def test_shift_copies_digital_missing_mask_and_prior_edits(tmp_path): path = _timestamped_record( tmp_path, base_date=datetime.date(2020, 5, 6), base_time=datetime.time(12) ) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") mask = np.zeros(read.signals.values.shape, dtype=bool) mask[1, 0] = True edited = read.with_values(np.ma.array(read.signals.values, mask=mask)) @@ -132,13 +132,13 @@ def test_date_only_accepts_whole_days_and_checks_range(tmp_path): path = _timestamped_record( tmp_path, base_date=datetime.date(2020, 5, 6), base_time=datetime.time(0) ) - read = wfdb.read_signals(path, kind="physical", layout="uniform") + read = wfdb.read_record(path, kind="physical", layout="uniform") date_only = _date_only_view(read, datetime.date(2020, 5, 6)) shifted = date_only.shift_time(datetime.timedelta(days=-3)) assert shifted.metadata.base_date == datetime.date(2020, 5, 3) assert shifted.metadata.base_time == datetime.time(0) shifted.write(tmp_path / "date_only") - restored = wfdb.read_signals( + restored = wfdb.read_record( tmp_path / "date_only", kind="physical", layout="uniform" ) assert restored.metadata.base_date == datetime.date(2020, 5, 3) @@ -152,7 +152,7 @@ def test_date_only_accepts_whole_days_and_checks_range(tmp_path): def test_missing_time_bad_delta_and_full_date_overflow(tmp_path): """Invalid shifts fail when called and leave the original unchanged.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", kind="physical", layout="uniform", stop=4 ) with pytest.raises(ValueError, match="without a base date or time"): @@ -164,7 +164,7 @@ def test_missing_time_bad_delta_and_full_date_overflow(tmp_path): base_date=datetime.date(9999, 12, 31), base_time=datetime.time(23, 59, 59), ) - dated = wfdb.read_signals(path, kind="physical", layout="uniform") + dated = wfdb.read_record(path, kind="physical", layout="uniform") with pytest.raises(ValueError, match="outside years 1 to 9999"): dated.shift_time(datetime.timedelta(seconds=2)) assert dated.metadata.base_date == datetime.date(9999, 12, 31) @@ -179,11 +179,11 @@ def test_shifted_distant_dates_write_and_make_dataframe_indexes(tmp_path, target path = _timestamped_record( tmp_path, base_date=source.date(), base_time=source.time() ) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") delta = datetime.datetime.combine(target, source.time()) - source shifted = read.shift_time(delta) shifted.write(tmp_path / "shifted") - restored = wfdb.read_signals(tmp_path / "shifted", kind="digital", layout="uniform") + restored = wfdb.read_record(tmp_path / "shifted", kind="digital", layout="uniform") assert restored.metadata.base_date == target chunks = list(wfdb.iter_dataframes(tmp_path / "shifted", 2)) assert chunks[0].index[0].to_pydatetime() == datetime.datetime.combine( @@ -199,7 +199,7 @@ def test_legacy_backed_record_data_can_shift_time(tmp_path): path = _timestamped_record( tmp_path, base_date=datetime.date(2020, 5, 6), base_time=datetime.time(12) ) - modern = wfdb.read_signals(path, kind="digital", layout="uniform") + modern = wfdb.read_record(path, kind="digital", layout="uniform") legacy = _from_record(modern.to_legacy_record(), "digital", False) assert legacy._model is None shifted = legacy.shift_time(datetime.timedelta(days=1)) diff --git a/tests/test_record_formats.py b/tests/test_record_formats.py index ac80e777..c8fc4f21 100644 --- a/tests/test_record_formats.py +++ b/tests/test_record_formats.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def test_formats_constructor_and_alias_share_one_list(): @@ -69,7 +70,9 @@ def test_formats_alias_survives_copy_and_pickle(): def test_selected_read_and_write_use_formats_alias(tmp_path): - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4, channels=[1]) + record = read_mutable_record( + "sample-data/100", layout="uniform", stop=4, channels=[1] + ) assert record.formats == record.fmt == ["212"] assert record.source_header.signals[1].format == "212" @@ -80,7 +83,7 @@ def test_selected_read_and_write_use_formats_alias(tmp_path): def test_multirecord_has_no_top_level_formats(): - multi = wfdb.read_record( + multi = read_mutable_record( "sample-data/multi-segment/041s/041s", layout="uniform", stop=10, diff --git a/tests/test_record_frame_count.py b/tests/test_record_frame_count.py index be0e9b61..96428c5e 100644 --- a/tests/test_record_frame_count.py +++ b/tests/test_record_frame_count.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("record_type", [wfdb.Record, wfdb.MultiRecord]) @@ -72,7 +73,9 @@ def test_frame_count_accepts_numpy_integer_and_survives_copy(record_type): def test_expanded_record_counts_base_frames_not_channel_samples(): """A channel with two samples per frame has twice as many values.""" - record = wfdb.read_record("sample-data/test01_00s_frame", stop=4, layout="expanded") + record = read_mutable_record( + "sample-data/test01_00s_frame", stop=4, layout="expanded" + ) assert record.n_frames == record.sig_len == record.metadata.n_frames == 4 assert record.samps_per_frame == [1, 2, 1] @@ -89,10 +92,10 @@ def test_frame_count_on_header_only_and_segmented_reads(): assert header.p_signal is None path = "sample-data/multi-segment/041s/041s" - multi = wfdb.read_record( + multi = read_mutable_record( path, layout="uniform", start=900, stop=1100, combine_segments=False ) - combined = wfdb.read_record(path, layout="uniform", start=900, stop=1100) + combined = read_mutable_record(path, layout="uniform", start=900, stop=1100) assert multi.n_frames == combined.n_frames == 200 assert multi.n_frames == sum(multi.seg_len) assert combined.metadata.n_frames == 200 @@ -100,7 +103,7 @@ def test_frame_count_on_header_only_and_segmented_reads(): def test_record_writer_uses_frame_count_alias(tmp_path): """An edited frame count cannot silently produce an inconsistent header.""" - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + record = read_mutable_record("sample-data/100", layout="uniform", stop=4) record.n_frames = 5 with pytest.raises(ValueError): @@ -114,7 +117,9 @@ def test_record_writer_uses_frame_count_alias(tmp_path): def test_expanded_writer_checks_each_channel_length(tmp_path): """A shortened high-frequency channel cannot hide behind the first one.""" - record = wfdb.read_record("sample-data/test01_00s_frame", stop=4, layout="expanded") + record = read_mutable_record( + "sample-data/test01_00s_frame", stop=4, layout="expanded" + ) record.e_p_signal[1] = record.e_p_signal[1][:4] with pytest.raises(ValueError, match=r"e_p_signal\[1\] has 4 samples; expected 8"): @@ -125,7 +130,7 @@ def test_expanded_writer_checks_each_channel_length(tmp_path): def test_writer_infers_unset_frame_count_on_copy(tmp_path): """An absent declaration is filled from the selected values on output.""" - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + record = read_mutable_record("sample-data/100", layout="uniform", stop=4) record.n_frames = None record.write(tmp_path / "copy") @@ -136,7 +141,7 @@ def test_writer_infers_unset_frame_count_on_copy(tmp_path): def test_multi_record_writer_uses_frame_count_alias(tmp_path): """The master frame count must match the total segment lengths.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/multi-segment/041s/041s", layout="uniform", stop=10, diff --git a/tests/test_record_metadata.py b/tests/test_record_metadata.py index f9a196ca..d3dbd06d 100644 --- a/tests/test_record_metadata.py +++ b/tests/test_record_metadata.py @@ -10,6 +10,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def test_selected_record_metadata_is_a_fresh_immutable_snapshot(): @@ -49,7 +50,9 @@ def test_selected_record_metadata_is_a_fresh_immutable_snapshot(): def test_grouped_channel_metadata_tracks_current_fields_not_source(): """A grouped snapshot follows edits while source provenance stays fixed.""" - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4, channels=[1]) + record = read_mutable_record( + "sample-data/100", layout="uniform", stop=4, channels=[1] + ) first = record.metadata assert len(first.channels) == 1 @@ -88,7 +91,7 @@ def test_grouped_channels_are_unavailable_during_storage_list_edit(): @pytest.mark.parametrize("alignment", ["aligned", "raw"]) def test_grouped_storage_omits_ambiguous_skew(alignment): """The source skew is not misrepresented as loaded-value alignment.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100skew", layout="uniform", stop=10, signal_alignment=alignment ) @@ -114,7 +117,7 @@ def test_grouped_storage_has_plain_integers_after_flattening(): def test_grouped_storage_frame_size_is_declaration_not_array_shape(): """A uniform array can represent a higher-rate stored channel.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/multi-segment/041s/041s01", stop=4, layout="uniform" ) diff --git a/tests/test_record_samples_per_frame.py b/tests/test_record_samples_per_frame.py index 1241d495..52acb02e 100644 --- a/tests/test_record_samples_per_frame.py +++ b/tests/test_record_samples_per_frame.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def test_samples_per_frame_constructor_and_alias_share_one_list(): @@ -72,7 +73,7 @@ def test_samples_per_frame_alias_survives_copy_and_pickle(): def test_selected_expanded_read_reports_per_channel_samples(): """A selected channel keeps its samples-per-frame count.""" path = "sample-data/test01_00s_frame" - record = wfdb.read_record(path, stop=4, channels=[1], layout="expanded") + record = read_mutable_record(path, stop=4, channels=[1], layout="expanded") assert record.n_frames == 4 assert record.samples_per_frame == [2] assert [len(values) for values in record.e_p_signal] == [8] @@ -81,7 +82,9 @@ def test_selected_expanded_read_reports_per_channel_samples(): def test_samples_per_frame_alias_is_checked_when_writing(tmp_path): """A changed frame multiplier must agree with expanded values.""" - record = wfdb.read_record("sample-data/test01_00s_frame", stop=4, layout="expanded") + record = read_mutable_record( + "sample-data/test01_00s_frame", stop=4, layout="expanded" + ) record.samples_per_frame = [1, 3, 1] with pytest.raises(ValueError, match="expected 12"): @@ -96,7 +99,9 @@ def test_samples_per_frame_alias_is_checked_when_writing(tmp_path): def test_expanded_write_rejects_in_place_invalid_multiplier(tmp_path): """Editing the shared list cannot bypass write-time validation.""" - record = wfdb.read_record("sample-data/test01_00s_frame", stop=4, layout="expanded") + record = read_mutable_record( + "sample-data/test01_00s_frame", stop=4, layout="expanded" + ) record.n_frames = None record.samples_per_frame[1] = 0 @@ -110,7 +115,9 @@ def test_expanded_write_rejects_in_place_invalid_multiplier(tmp_path): def test_uniform_read_retains_source_layout_but_uniform_write_uses_one(tmp_path): """The header field can differ from the loaded uniform array layout.""" - record = wfdb.read_record("sample-data/test01_00s_frame", layout="uniform", stop=4) + record = read_mutable_record( + "sample-data/test01_00s_frame", layout="uniform", stop=4 + ) assert record.samples_per_frame == [1, 2, 1] assert record.p_signal.shape == (4, 3) @@ -123,7 +130,7 @@ def test_uniform_read_retains_source_layout_but_uniform_write_uses_one(tmp_path) def test_multi_record_has_no_top_level_samples_per_frame_alias(): """Segment metadata remains on its segment records.""" - multi = wfdb.read_record( + multi = read_mutable_record( "sample-data/multi-segment/041s/041s", layout="uniform", stop=10, diff --git a/tests/test_record_signal_count.py b/tests/test_record_signal_count.py index 82b33157..612928b5 100644 --- a/tests/test_record_signal_count.py +++ b/tests/test_record_signal_count.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("record_type", [wfdb.Record, wfdb.MultiRecord]) @@ -79,7 +80,7 @@ def test_count_alias_survives_copy_and_pickle(record_type): def test_count_alias_describes_declared_view_not_array_shape(): """Loaded forms and array edits do not implicitly change the count.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) record.p_signal = record.dac() @@ -110,7 +111,7 @@ def test_count_alias_on_header_only_and_segmented_records(): def test_writer_rejects_count_changed_through_alias(tmp_path): """The alias does not bypass write validation of loaded values.""" - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + record = read_mutable_record("sample-data/100", layout="uniform", stop=4) record.n_signals = 3 with pytest.raises(ValueError, match="n_sig=3"): @@ -134,7 +135,9 @@ def test_writer_rejects_count_changed_through_alias(tmp_path): ) def test_multi_record_writer_rejects_master_count_mismatch(tmp_path, path, expected): """A master header cannot declare more channels than its layout defines.""" - record = wfdb.read_record(path, layout="uniform", stop=10, combine_segments=False) + record = read_mutable_record( + path, layout="uniform", stop=10, combine_segments=False + ) record.n_signals += 1 with pytest.raises(ValueError, match=expected) as error: diff --git a/tests/test_record_signal_names.py b/tests/test_record_signal_names.py index aa69f984..2ef60e42 100644 --- a/tests/test_record_signal_names.py +++ b/tests/test_record_signal_names.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize("record_type", [wfdb.Record, wfdb.MultiRecord]) @@ -46,7 +47,9 @@ def test_alias_survives_copy_and_pickle(record_type): def test_alias_reflects_selected_reads_and_record_metadata(): """Selection and later edits remain visible through both public views.""" - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4, channels=[1]) + record = read_mutable_record( + "sample-data/100", layout="uniform", stop=4, channels=[1] + ) assert record.n_sig == record.metadata.n_signals == 1 assert record.signal_names == ["V5"] record.signal_names = ["ECG"] @@ -57,7 +60,7 @@ def test_alias_reflects_selected_reads_and_record_metadata(): def test_signal_names_alias_is_used_when_writing(tmp_path): """Changing the readable name changes the signal line written to disk.""" - record = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + record = read_mutable_record("sample-data/100", layout="uniform", stop=4) record.signal_names = ["ECG", "V5"] path = tmp_path / "renamed" record.write(path) diff --git a/tests/test_record_signal_value_names.py b/tests/test_record_signal_value_names.py index 0ed6f972..6b2ac760 100644 --- a/tests/test_record_signal_value_names.py +++ b/tests/test_record_signal_value_names.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize( @@ -19,7 +20,7 @@ ], ) def test_read_signal_aliases_share_the_loaded_values(old_name, new_name, kind, layout): - record = wfdb.read_record( + record = read_mutable_record( "sample-data/mixedsignals", stop=4, kind=kind, layout=layout ) values = getattr(record, old_name) @@ -86,7 +87,7 @@ def test_legacy_signal_names_keep_their_assignment_behavior(): def test_expanded_tuple_is_stored_as_a_writable_list(tmp_path): - record = wfdb.read_record( + record = read_mutable_record( "sample-data/mixedsignals", stop=4, kind="digital", layout="expanded" ) values = tuple(record.expanded_digital_signals) @@ -122,7 +123,7 @@ def test_all_signal_forms_can_coexist_and_remain_independent(): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_digital_signal_alias_can_be_written(tmp_path, layout): - record = wfdb.read_record( + record = read_mutable_record( "sample-data/mixedsignals", stop=4, kind="digital", layout=layout ) values = ( @@ -131,7 +132,7 @@ def test_digital_signal_alias_can_be_written(tmp_path, layout): else record.expanded_digital_signals ) record.write(tmp_path / "copy", kind="digital", layout=layout) - reread = wfdb.read_record(tmp_path / "copy", kind="digital", layout=layout) + reread = read_mutable_record(tmp_path / "copy", kind="digital", layout=layout) actual = ( reread.digital_signals if layout == "uniform" diff --git a/tests/test_record_storage_fields.py b/tests/test_record_storage_fields.py index c089c2f4..2c80fbb1 100644 --- a/tests/test_record_storage_fields.py +++ b/tests/test_record_storage_fields.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import _header @@ -16,7 +17,7 @@ def _storage(record): def test_selected_record_storage_keeps_source_skew_separate(): """Current declarations and source header stay separate after selection.""" - record = wfdb.read_record( + record = read_mutable_record( "sample-data/100skew", layout="uniform", stop=8, channels=[1], kind="digital" ) storage = _storage(record) @@ -82,7 +83,7 @@ def test_invalid_skew_does_not_break_logical_metadata(): def test_variable_layout_storage_keeps_null_signal_fields(): """Layout channels can describe storage without loaded samples.""" - selected = wfdb.read_record( + selected = read_mutable_record( "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57", layout="uniform", stop=100, diff --git a/tests/test_recorddata_written_declarations.py b/tests/test_recorddata_written_declarations.py index 729ff548..c9a28022 100644 --- a/tests/test_recorddata_written_declarations.py +++ b/tests/test_recorddata_written_declarations.py @@ -16,7 +16,7 @@ def _encoded_channels(path): def test_derived_checksums_use_signed_wfdb_form(tmp_path): """An unedited full write retains the signed checksums of record 100.""" - read = wfdb.read_signals("sample-data/100", kind="digital", layout="uniform") + read = wfdb.read_record("sample-data/100", kind="digital", layout="uniform") destination = tmp_path / "copy" read.write(destination) header = wfdb.rdheader(str(destination)) @@ -27,7 +27,7 @@ def test_derived_checksums_use_signed_wfdb_form(tmp_path): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_full_skewed_multifrequency_write_uses_written_samples(tmp_path, kind, layout): """Initial values and checksums describe smoothed or aligned output.""" - read = wfdb.read_signals("sample-data/03700181", kind=kind, layout=layout) + read = wfdb.read_record("sample-data/03700181", kind=kind, layout=layout) destination = tmp_path / "copy" read.write(destination, signal_alignment="aligned") header = wfdb.rdheader(str(destination)) @@ -57,7 +57,7 @@ def test_full_skewed_multifrequency_write_uses_written_samples(tmp_path, kind, l @pytest.mark.parametrize("kind", ["physical", "digital"]) def test_explicit_source_formats_match_implicit_write(tmp_path, kind): """Repeating the source format cannot change modern write declarations.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/03700181", kind=kind, layout="uniform", stop=40 ) implicit_dir = tmp_path / "implicit" @@ -80,7 +80,7 @@ def test_explicit_source_formats_match_implicit_write(tmp_path, kind): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_selected_window_and_mask_declarations(tmp_path, kind, layout): """Windowed and masked reads declare their first encoded sample and sum.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/test01_00s_frame", kind=kind, layout=layout, @@ -101,7 +101,7 @@ def test_selected_window_and_mask_declarations(tmp_path, kind, layout): def test_header_without_adc_fields_still_writes(tmp_path): """Derived declarations can add their required ADC fields.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/n8_evoked_raw_95_F1_R9", kind="physical", layout="uniform", @@ -118,7 +118,7 @@ def test_header_without_adc_fields_still_writes(tmp_path): def test_full_n8_write_adds_derived_declarations(tmp_path): """A full read also gets truthful declarations without changing its data.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/n8_evoked_raw_95_F1_R9", kind="digital", layout="uniform" ) destination = tmp_path / "n8_full" diff --git a/tests/test_required_signal_alignment.py b/tests/test_required_signal_alignment.py index f631c8f7..f5fcf759 100644 --- a/tests/test_required_signal_alignment.py +++ b/tests/test_required_signal_alignment.py @@ -7,6 +7,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def _write(writer, source, path, alignment=None): @@ -22,11 +23,11 @@ def _write(writer, source, path, alignment=None): def test_skew_requires_choice_before_writing(tmp_path, writer, layout, kind): """All modern writers reject an omitted choice without making files.""" if writer == "signal_read": - source = wfdb.read_signals( + source = wfdb.read_record( "sample-data/100skew", stop=20, kind=kind, layout=layout ) else: - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", stop=20, kind=kind, layout=layout ) path = tmp_path / "copy" @@ -46,7 +47,7 @@ def test_skew_requires_choice_before_writing(tmp_path, writer, layout, kind): def test_unskewed_values_do_not_need_choice(tmp_path, writer): """An explicit choice is optional when no selected channel has skew.""" if writer == "signal_read": - source = wfdb.read_signals( + source = wfdb.read_record( "sample-data/100skew", stop=20, channels=[0], @@ -54,7 +55,7 @@ def test_unskewed_values_do_not_need_choice(tmp_path, writer): layout="uniform", ) else: - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=20, @@ -69,14 +70,14 @@ def test_unskewed_values_do_not_need_choice(tmp_path, writer): def test_raw_full_read_retains_skew(tmp_path, writer): """A raw declaration preserves source skew and aligned samples.""" if writer == "signal_read": - source = wfdb.read_signals( + source = wfdb.read_record( "sample-data/100skew", kind="digital", layout="uniform", signal_alignment="raw", ) else: - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", kind="digital", @@ -85,17 +86,19 @@ def test_raw_full_read_retains_skew(tmp_path, writer): path = tmp_path / "copy" _write(writer, source, path, "raw") assert wfdb.read_header(path).signals[1].skew == 3 - expected = wfdb.read_record("sample-data/100skew", layout="uniform", kind="digital") - actual = wfdb.read_record(path, layout="uniform", kind="digital") + expected = read_mutable_record( + "sample-data/100skew", layout="uniform", kind="digital" + ) + actual = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(actual.d_signal, expected.d_signal) def test_signal_read_in_place_replacement_requires_choice(tmp_path): """A frozen wrapper does not make its NumPy arrays immutable.""" - aligned = wfdb.read_signals( + aligned = wfdb.read_record( "sample-data/100skew", stop=20, kind="digital", layout="uniform" ) - raw = wfdb.read_signals( + raw = wfdb.read_record( "sample-data/100skew", stop=20, kind="digital", @@ -111,7 +114,7 @@ def test_signal_read_in_place_replacement_requires_choice(tmp_path): @pytest.mark.parametrize("copy_mode", ["copy", "deepcopy", "pickle"]) def test_copied_skewed_records_still_require_choice(tmp_path, copy_mode): """Copying an aligned read cannot erase the explicit write contract.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=20, kind="digital" ) copied = { @@ -149,7 +152,7 @@ def test_hand_built_skewed_record_requires_choice(tmp_path): @pytest.mark.parametrize("copy_mode", ["copy", "deepcopy", "pickle"]) def test_converted_signal_read_keeps_skew_contract(tmp_path, layout, copy_mode): """Conversion and copying preserve the requirement for mutable values.""" - source = wfdb.read_signals( + source = wfdb.read_record( "sample-data/100skew", stop=20, kind="digital", layout=layout ).to_physical() source = { diff --git a/tests/test_segment_views.py b/tests/test_segment_views.py index c3f53554..503eb397 100644 --- a/tests/test_segment_views.py +++ b/tests/test_segment_views.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record VARIABLE = "sample-data/multi-segment/s25047/s25047-2704-05-04-10-44" @@ -31,10 +32,10 @@ def test_selected_variable_layout_distinguishes_layout_gap_and_data(): """Offsets in both result forms refer to the returned frame selection.""" header = wfdb.read_header(VARIABLE) bundle = wfdb.read_multi_segment_headers(VARIABLE) - multi = wfdb.read_record( + multi = read_mutable_record( VARIABLE, layout="uniform", start=25735, stop=25750, combine_segments=False ) - combined = wfdb.read_record(VARIABLE, layout="uniform", start=25735, stop=25750) + combined = read_mutable_record(VARIABLE, layout="uniform", start=25735, stop=25750) assert [(ref.name, ref.n_frames) for ref in header.segments[:3]] == [ ("3234460_layout", 0), @@ -71,11 +72,11 @@ def test_fixed_layout_descriptors_relate_source_and_selected_frames(): path = "sample-data/multi-segment/041s/041s" header = wfdb.read_header(path) bundle = wfdb.read_multi_segment_headers(path) - preserved = wfdb.read_record( + preserved = read_mutable_record( path, layout="uniform", start=900, stop=1100, combine_segments=False ) - combined = wfdb.read_record(path, layout="uniform", start=900, stop=1100) - signals = wfdb.read_signals(path, start=900, stop=1100, layout="uniform") + combined = read_mutable_record(path, layout="uniform", start=900, stop=1100) + signals = wfdb.read_record(path, start=900, stop=1100, layout="uniform") assert [(ref.name, ref.n_frames) for ref in header.segments] == [ ("041s01", 1000), @@ -104,7 +105,7 @@ def test_fixed_layout_descriptors_relate_source_and_selected_frames(): def test_unloaded_data_segment_is_not_called_a_gap(): """A missing selected channel can leave a data segment's Record absent.""" - multi = wfdb.read_record( + multi = read_mutable_record( VARIABLE, layout="uniform", start=25740, diff --git a/tests/test_signal_read_old_pickles.py b/tests/test_signal_read_old_pickles.py index 0baae08b..ba8a18fd 100644 --- a/tests/test_signal_read_old_pickles.py +++ b/tests/test_signal_read_old_pickles.py @@ -60,7 +60,7 @@ def test_v5_17_signal_read_pickle_remains_usable(tmp_path, name, kind, layout): destination = tmp_path / name read.write(destination) - restored = wfdb.read_signals(destination, kind=kind, layout=layout) + restored = wfdb.read_record(destination, kind=kind, layout=layout) assert restored.metadata.n_frames == read.metadata.n_frames original_values = read.signals.values restored_values = restored.signals.values @@ -79,9 +79,7 @@ def test_v5_17_signal_read_pickle_remains_usable(tmp_path, name, kind, layout): def test_current_signal_read_pickle_keeps_model_and_source(): """The compatibility hook does not change newly saved reads.""" - read = wfdb.read_signals( - "sample-data/100", kind="digital", layout="uniform", stop=5 - ) + read = wfdb.read_record("sample-data/100", kind="digital", layout="uniform", stop=5) loaded = pickle.loads(pickle.dumps(read, protocol=4)) assert loaded._model is not None assert loaded.source_header == read.source_header diff --git a/tests/test_signal_roundtrip.py b/tests/test_signal_roundtrip.py index 8a1dd98a..2c285580 100644 --- a/tests/test_signal_roundtrip.py +++ b/tests/test_signal_roundtrip.py @@ -8,7 +8,7 @@ def test_write_selected_digital_view_under_new_name(tmp_path): """Writing preserves selected samples and logical channel metadata.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", layout="uniform", kind="digital", @@ -21,7 +21,7 @@ def test_write_selected_digital_view_under_new_name(tmp_path): destination = tmp_path / "selected" read.write(destination) - written = wfdb.read_signals(destination, layout="uniform", kind="digital") + written = wfdb.read_record(destination, layout="uniform", kind="digital") np.testing.assert_array_equal(written.signals.values, read.signals.values) assert written.metadata.n_frames == 10 assert written.metadata.n_signals == 1 @@ -35,14 +35,14 @@ def test_write_selected_digital_view_under_new_name(tmp_path): def test_write_edited_physical_values_with_encoding_precision(tmp_path): """A physical edit is encoded from the current values, within one step.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", layout="uniform", kind="physical", stop=4 ) read.signals.values[0, 0] = 0.123 destination = tmp_path / "edited" read.write(destination) - written = wfdb.read_signals(destination, layout="uniform", kind="physical") + written = wfdb.read_record(destination, layout="uniform", kind="physical") tolerance = 0.5 / read.metadata.signals[0].adc_gain + 1e-8 np.testing.assert_allclose( written.signals.values[0, 0], read.signals.values[0, 0], atol=tolerance @@ -51,13 +51,13 @@ def test_write_edited_physical_values_with_encoding_precision(tmp_path): def test_write_expanded_multifrequency_view(tmp_path): """The destination keeps every sample and each signal file group.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/mixedsignals", layout="expanded", kind="digital", stop=8 ) destination = tmp_path / "expanded" read.write(destination) - written = wfdb.read_signals(destination, layout="expanded", kind="digital") + written = wfdb.read_record(destination, layout="expanded", kind="digital") assert written.signals.samples_per_frame == read.signals.samples_per_frame for actual, expected in zip(written.signals.values, read.signals.values): np.testing.assert_array_equal(actual, expected) @@ -68,13 +68,13 @@ def test_write_expanded_multifrequency_view(tmp_path): def test_write_archive_under_new_name(tmp_path): """A local archive contains the selected view under its destination name.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", layout="uniform", kind="digital", stop=12 ) destination = tmp_path / "copy.wfdb" read.write(destination) - written = wfdb.read_signals(destination, layout="uniform", kind="digital") + written = wfdb.read_record(destination, layout="uniform", kind="digital") np.testing.assert_array_equal(written.signals.values, read.signals.values) assert written.metadata.record_name == "copy" assert read.metadata.record_name == "100" @@ -83,7 +83,7 @@ def test_write_archive_under_new_name(tmp_path): @pytest.mark.parametrize("alignment", ["aligned", "raw"]) def test_write_skew_view_without_changing_alignment(tmp_path, alignment): """A short aligned view writes; a short raw skewed view cannot.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100skew", layout="expanded", kind="digital", @@ -98,7 +98,7 @@ def test_write_skew_view_without_changing_alignment(tmp_path, alignment): return read.write(destination, signal_alignment="aligned") - written = wfdb.read_signals( + written = wfdb.read_record( destination, layout="expanded", kind="digital", @@ -113,7 +113,7 @@ def test_write_skew_view_without_changing_alignment(tmp_path, alignment): def test_write_full_raw_skew_view(tmp_path): """A full raw read retains the source skew when written.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100skew", layout="expanded", kind="digital", @@ -123,7 +123,7 @@ def test_write_full_raw_skew_view(tmp_path): read.write(destination, signal_alignment="raw") - written = wfdb.read_signals( + written = wfdb.read_record( destination, layout="expanded", kind="digital", signal_alignment="raw" ) for actual, expected in zip(written.signals.values, read.signals.values): @@ -133,7 +133,7 @@ def test_write_full_raw_skew_view(tmp_path): def test_write_flattened_multisegment_view(tmp_path): """The logical values survive writing as one destination record.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/041s/041s", layout="expanded", kind="physical", @@ -142,7 +142,7 @@ def test_write_flattened_multisegment_view(tmp_path): destination = tmp_path / "flat" read.write(destination) - written = wfdb.read_signals(destination, layout="expanded", kind="physical") + written = wfdb.read_record(destination, layout="expanded", kind="physical") assert written.metadata.n_frames == read.metadata.n_frames assert written.metadata.n_signals == read.metadata.n_signals assert written.metadata.base_datetime == read.metadata.base_datetime @@ -154,19 +154,17 @@ def test_write_flattened_multisegment_view(tmp_path): def test_write_memory_cloud_view(tmp_path): """A writable fsspec URI works without changing the source result.""" - read = wfdb.read_signals( - "sample-data/100", layout="uniform", kind="digital", stop=8 - ) + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital", stop=8) destination = f"memory://wfdb-roundtrip/{tmp_path.name}/cloud" read.write(destination) - written = wfdb.read_signals(destination, layout="uniform", kind="digital") + written = wfdb.read_record(destination, layout="uniform", kind="digital") np.testing.assert_array_equal(written.signals.values, read.signals.values) def test_write_drops_source_file_byte_offset(tmp_path): """A renamed record does not retain padding from a source .mat file.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/a103l", layout="uniform", kind="digital", @@ -177,7 +175,7 @@ def test_write_drops_source_file_byte_offset(tmp_path): destination = tmp_path / "without_offset" read.write(destination) - written = wfdb.read_signals(destination, layout="uniform", kind="digital") + written = wfdb.read_record(destination, layout="uniform", kind="digital") np.testing.assert_array_equal(written.signals.values, read.signals.values) assert wfdb.rdheader(str(destination)).byte_offset == [None] * 3 assert read.to_legacy_record().byte_offset == [24] * 3 @@ -186,9 +184,7 @@ def test_write_drops_source_file_byte_offset(tmp_path): @pytest.mark.parametrize("path", ["", "out.hea", "out.dat", "memory://out.wfdb"]) def test_write_rejects_ambiguous_or_unsupported_paths(path): """Invalid destinations fail before writing any files.""" - read = wfdb.read_signals( - "sample-data/100", layout="uniform", kind="digital", stop=2 - ) + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital", stop=2) with pytest.raises(ValueError, match="path|cloud storage"): read.write(path) @@ -196,9 +192,7 @@ def test_write_rejects_ambiguous_or_unsupported_paths(path): @pytest.mark.parametrize("name", ["x.v1", "my rec"]) def test_write_rejects_record_names_that_cannot_be_read_back(tmp_path, name): """The destination name must satisfy the WFDB header grammar.""" - read = wfdb.read_signals( - "sample-data/100", layout="uniform", kind="digital", stop=2 - ) + read = wfdb.read_record("sample-data/100", layout="uniform", kind="digital", stop=2) with pytest.raises(ValueError, match="record_name must only comprise"): read.write(tmp_path / name) @@ -229,7 +223,7 @@ def test_legacy_writer_rejects_invalid_names(tmp_path, record_name, file_name, m ) def test_write_reports_unsupported_signal_format(tmp_path, source, kind): """Unsupported encodings fail before conversion or writing files.""" - read = wfdb.read_signals(source, layout="uniform", kind=kind, stop=10) + read = wfdb.read_record(source, layout="uniform", kind=kind, stop=10) with pytest.raises(ValueError, match="following formats: .*212.*unsupported:.*310"): read.write(tmp_path / "unsupported") assert not any(tmp_path.iterdir()) diff --git a/tests/test_signal_values.py b/tests/test_signal_values.py index 057f567e..b2f7b0c8 100644 --- a/tests/test_signal_values.py +++ b/tests/test_signal_values.py @@ -12,9 +12,9 @@ @pytest.mark.parametrize("kind", ["physical", "digital"]) @pytest.mark.parametrize("layout", ["uniform", "expanded"]) -def test_read_signals_matches_legacy(kind, layout): +def test_read_record_matches_legacy(kind, layout): """The new representation preserves each existing read mode.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/mixedsignals", start=10, stop=20, @@ -57,7 +57,7 @@ def test_read_signals_matches_legacy(kind, layout): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_one_channel_keeps_layout_shape(path, samples_per_frame, layout): """Selecting one channel does not change the result container type.""" - read = wfdb.read_signals(path, stop=4, channels=[0], layout=layout) + read = wfdb.read_record(path, stop=4, channels=[0], layout=layout) if layout == "uniform": assert read.signals.values.shape == (4, 1) assert read.signals.values[:, 0].shape == (4,) @@ -70,7 +70,7 @@ def test_one_channel_keeps_layout_shape(path, samples_per_frame, layout): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_conversion_returns_another_view(layout): """A converted view has one form and does not alter the source.""" - digital = wfdb.read_signals( + digital = wfdb.read_record( "sample-data/mixedsignals", stop=8, kind="digital", @@ -102,7 +102,7 @@ def test_conversion_returns_another_view(layout): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_same_kind_conversion_copies_values(kind, layout): """Calling a converter twice never aliases the caller's signal arrays.""" - read = wfdb.read_signals("sample-data/100", stop=3, kind=kind, layout=layout) + read = wfdb.read_record("sample-data/100", stop=3, kind=kind, layout=layout) converted = read.to_physical() if kind == "physical" else read.to_digital() assert converted is not read assert converted.signals is not read.signals @@ -122,7 +122,7 @@ def test_same_kind_conversion_copies_values(kind, layout): def test_same_kind_physical_resolution(): """A physical-to-physical call validates and applies its float width.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3, resolution=64) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=3, resolution=64) converted = read.to_physical(resolution=32) assert converted.signals.values.dtype == np.float32 assert read.signals.values.dtype == np.float64 @@ -133,14 +133,14 @@ def test_same_kind_physical_resolution(): def test_expanded_digital_write_roundtrip(tmp_path): """The new view can use the existing writer without dropping samples.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/mixedsignals", stop=8, kind="digital", layout="expanded" ) writable = read.to_legacy_record() writable.record_name = "copied" writable.file_name = ["copy4.dat"] * 3 + ["copy2.dat"] * 2 + ["copy1.dat"] writable.wrsamp(expanded=True, write_dir=str(tmp_path)) - reread = wfdb.read_signals( + reread = wfdb.read_record( str(tmp_path / "copied"), kind="digital", layout="expanded" ) assert reread.signals.samples_per_frame == read.signals.samples_per_frame @@ -150,18 +150,18 @@ def test_expanded_digital_write_roundtrip(tmp_path): def test_archive_read_and_write_roundtrip(tmp_path): """The new view accepts an archive and writes through the legacy bridge.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", layout="uniform", stop=20, kind="digital" ) archive_path = tmp_path / "100.wfdb" read.to_legacy_record().wrsamp(wfdb_archive=str(archive_path)) - reread = wfdb.read_signals(str(archive_path), layout="uniform", kind="digital") + reread = wfdb.read_record(str(archive_path), layout="uniform", kind="digital") np.testing.assert_array_equal(reread.signals.values, read.signals.values) def test_flattened_multi_segment_source(): """A combined read keeps the selected view and its segment provenance.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/041s/041s", layout="uniform", stop=10, @@ -177,7 +177,7 @@ def test_flattened_multi_segment_source(): def test_missing_conversion_calibration_names_channels(): """A mixed-layout view explains why physical values cannot be encoded.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57", layout="uniform", stop=7500, @@ -189,27 +189,27 @@ def test_missing_conversion_calibration_names_channels(): def test_resolution_and_private_construction(): """The bit count has a clear name, and incomplete results cannot be made.""" - physical = wfdb.read_signals( + physical = wfdb.read_record( "sample-data/100", layout="uniform", stop=3, resolution=32 ) - digital = wfdb.read_signals( + digital = wfdb.read_record( "sample-data/100", layout="uniform", stop=3, kind="digital", resolution=16 ) assert physical.signals.values.dtype == np.float32 assert digital.signals.values.dtype == np.int16 assert digital.to_physical(resolution=32).signals.values.dtype == np.float32 with pytest.raises(ValueError, match="resolution"): - wfdb.read_signals("sample-data/100", layout="uniform", resolution="float32") - with pytest.raises(TypeError, match="returned by read_signals"): + wfdb.read_record("sample-data/100", layout="uniform", resolution="float32") + with pytest.raises(TypeError, match="returned by read_record"): wfdb.RecordData(physical.signals, physical.metadata) def test_hidden_record_is_not_a_dataclass_field(): """Introspection excludes the conversion record while copies keep it.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=3) assert "_record" not in {field.name for field in dataclasses.fields(read)} assert "_record" not in dataclasses.asdict(read) - with pytest.raises(TypeError, match="returned by read_signals"): + with pytest.raises(TypeError, match="returned by read_record"): dataclasses.replace(read, metadata=read.metadata) copied = copy.deepcopy(read) np.testing.assert_array_equal( @@ -223,7 +223,7 @@ def test_hidden_record_is_not_a_dataclass_field(): def test_conversion_does_not_share_record_lists(): """Changing converted calibration cannot affect the original conversion.""" - read = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) + read = wfdb.read_record("sample-data/100", layout="uniform", stop=3) converted = read.to_digital() original_gain = read._record.adc_gain[0] converted._record.adc_gain[0] *= 2 @@ -236,10 +236,10 @@ def test_conversion_does_not_share_record_lists(): def test_invalid_modes(): """Reject unsupported modes before opening a file.""" with pytest.raises(ValueError, match="kind"): - wfdb.read_signals("missing", layout="uniform", kind="other") + wfdb.read_record("missing", layout="uniform", kind="other") with pytest.raises(ValueError, match="layout"): - wfdb.read_signals("missing", layout="other") + wfdb.read_record("missing", layout="other") with pytest.raises(ValueError, match="channels must not be empty"): - wfdb.read_signals("sample-data/100", layout="uniform", channels=[]) + wfdb.read_record("sample-data/100", layout="uniform", channels=[]) with pytest.raises(TypeError, match="required keyword-only argument: 'layout'"): - wfdb.read_signals("sample-data/100") + wfdb.read_record("sample-data/100") diff --git a/tests/test_signal_write_preparation.py b/tests/test_signal_write_preparation.py index 81229a0a..a11b5303 100644 --- a/tests/test_signal_write_preparation.py +++ b/tests/test_signal_write_preparation.py @@ -13,7 +13,7 @@ def test_signal_read_write_shares_values_during_preparation( tmp_path, monkeypatch, kind, layout ): """Preparation can share arrays while writing leaves the view unchanged.""" - read = wfdb.read_signals("sample-data/100", stop=64, kind=kind, layout=layout) + read = wfdb.read_record("sample-data/100", stop=64, kind=kind, layout=layout) selected = read.signals.values if layout == "expanded" else (read.signals.values,) originals = [np.asarray(values).copy() for values in selected] field = ("e_" if layout == "expanded" else "") + ( @@ -39,7 +39,7 @@ def inspect_write(model, *args, **kwargs): assert calls == [True] for values, original in zip(selected, originals): np.testing.assert_array_equal(np.asarray(values), original) - reread = wfdb.read_signals(tmp_path / "copy", kind=kind, layout=layout) + reread = wfdb.read_record(tmp_path / "copy", kind=kind, layout=layout) actual = reread.signals.values if layout == "expanded" else (reread.signals.values,) for values, original in zip(actual, originals): np.testing.assert_array_equal(np.asarray(values), original) @@ -49,7 +49,7 @@ def inspect_write(model, *args, **kwargs): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_flattened_signal_write_leaves_source_unchanged(tmp_path, kind, layout): """Flattened write preparation cannot edit the retained read record.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/multi-segment/041s/041s", stop=20, kind=kind, diff --git a/tests/test_single_read_model.py b/tests/test_single_read_model.py index f2d384ce..8cbb072a 100644 --- a/tests/test_single_read_model.py +++ b/tests/test_single_read_model.py @@ -33,7 +33,7 @@ def fail(*_args, **_kwargs): raise AssertionError("Record adapter created during read") monkeypatch.setattr(record_module, "_record_from_header_fields", fail) - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", kind="digital", layout="expanded", stop=8 ) assert len(read.signals.values) == 2 @@ -70,7 +70,7 @@ def fail(*_args, **_kwargs): monkeypatch.setattr(record_module, "_record_from_header_fields", fail) with pytest.raises(ValueError, match=message): - wfdb.read_signals(tmp_path / "empty", kind=kind, layout=layout) + wfdb.read_record(tmp_path / "empty", kind=kind, layout=layout) @pytest.mark.parametrize("header", ["empty 0 125 0\n", "empty 0 125 5\n"]) @@ -83,7 +83,7 @@ def test_no_signal_header_named_channel_error(tmp_path, header, kind, layout): ValueError, match=r"Unknown channel name\(s\): \['I'\]; available channel names: \[\]", ): - wfdb.read_signals( + wfdb.read_record( tmp_path / "empty", kind=kind, layout=layout, channel_names=["I"] ) @@ -94,7 +94,7 @@ def test_no_signal_header_ignored_channel_error(tmp_path, kind, layout): """Ignoring a missing name still reports that no channel was selected.""" (tmp_path / "empty.hea").write_text("empty 0 125 5\n") with pytest.raises(ValueError, match="None of the requested channel names"): - wfdb.read_signals( + wfdb.read_record( tmp_path / "empty", kind=kind, layout=layout, @@ -105,7 +105,7 @@ def test_no_signal_header_ignored_channel_error(tmp_path, kind, layout): def test_direct_read_copy_and_pickle_keep_conversion(): """A copied result can create a Record adapter when conversion needs one.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", kind="digital", layout="expanded", stop=8 ) expected = read.to_physical() @@ -128,7 +128,7 @@ def capture(*args, **kwargs): return arrays monkeypatch.setattr(_signal, "_rd_segment", capture) - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", kind="digital", layout="expanded", @@ -142,7 +142,7 @@ def capture(*args, **kwargs): def test_direct_read_pickle_keeps_source_provenance(): """Pickling keeps the source header and selection of a direct read.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100", kind="digital", layout="uniform", start=5, stop=8 ) restored = pickle.loads(pickle.dumps(read)) @@ -155,7 +155,7 @@ def test_direct_read_pickle_keeps_source_provenance(): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_masked_sample_without_format_marker(tmp_path, layout): """A masked format 8 sample has no marker but still converts and validates.""" - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/binformats", kind="digital", layout=layout, channels=[0] ) values = read.signals.values @@ -202,7 +202,7 @@ def test_full_expanded_digital_write_updates_header_but_keeps_data_bytes( tmp_path, source, header, dat_sha256 ): """Full expanded reads update declarations and keep 5.17.0 data bytes.""" - read = wfdb.read_signals(source, kind="digital", layout="expanded") + read = wfdb.read_record(source, kind="digital", layout="expanded") read.write(tmp_path / "copy", signal_alignment="aligned") assert (tmp_path / "copy.hea").read_bytes() == header.encode() assert hashlib.sha256((tmp_path / "copy.dat").read_bytes()).hexdigest() == ( diff --git a/tests/test_source_provenance.py b/tests/test_source_provenance.py index d4825372..32e66c32 100644 --- a/tests/test_source_provenance.py +++ b/tests/test_source_provenance.py @@ -9,6 +9,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import record as record_module from wfdb.io.archive import create_archive @@ -16,7 +17,7 @@ def test_selected_record_exposes_original_header_and_source_coordinates(): """A selected view retains the full source header and original indices.""" path = "sample-data/100" - loaded = wfdb.read_record(path, layout="uniform", start=2, stop=6, channels=[1]) + loaded = read_mutable_record(path, layout="uniform", start=2, stop=6, channels=[1]) assert loaded.source_header == wfdb.read_header(path) assert loaded.source_signal_header == loaded.source_header @@ -37,19 +38,19 @@ def test_selected_record_exposes_original_header_and_source_coordinates(): def test_source_header_preserves_omitted_length_and_stored_skew(): """The source describes header values before inference and alignment.""" - no_length = wfdb.read_record( + no_length = read_mutable_record( "sample-data/100-no-len", layout="uniform", start=2, stop=6 ) assert no_length.source_header.n_frames is None assert no_length.metadata.n_frames == 4 - skewed = wfdb.read_record("sample-data/100skew", layout="uniform", stop=4) + skewed = read_mutable_record("sample-data/100skew", layout="uniform", stop=4) assert skewed.source_header.signals[1].skew == 3 def test_source_selection_preserves_channel_order(): """Source indices follow the selected output channel order.""" - loaded = wfdb.read_record( + loaded = read_mutable_record( "sample-data/100", layout="uniform", stop=2, channels=[1, 0] ) assert loaded.source_selection.channels == (1, 0) @@ -60,7 +61,7 @@ def test_source_selection_preserves_channel_order(): def test_multi_segment_source_coordinates(combine_segments): """Combined and preserved reads refer to the main source header.""" path = "sample-data/multi-segment/041s/041s" - loaded = wfdb.read_record( + loaded = read_mutable_record( path, layout="uniform", start=500, @@ -89,7 +90,7 @@ def test_multi_segment_source_coordinates(combine_segments): def test_variable_layout_source_signal_header(): """A variable-layout selection refers to the original layout header.""" path = "sample-data/multi-segment/p000878/p000878-2137-10-26-16-57" - loaded = wfdb.read_record(path, layout="uniform", stop=2, channels=[0]) + loaded = read_mutable_record(path, layout="uniform", stop=2, channels=[0]) bundle = wfdb.read_multi_segment_headers(path) assert loaded.source_signal_header == bundle.signal_header assert loaded.source_signal_header.signals[0].name == "PLETH" @@ -100,7 +101,7 @@ def test_multi_segment_archive_source_signal_header(tmp_path): directory = Path("sample-data/multi-segment/041s") archive = tmp_path / "041s.wfdb" create_archive(list(directory.glob("*")), archive) - loaded = wfdb.read_record(archive, layout="uniform", stop=2, channels=[1]) + loaded = read_mutable_record(archive, layout="uniform", stop=2, channels=[1]) assert ( loaded.source_signal_header == wfdb.read_multi_segment_headers(archive).signal_header @@ -124,7 +125,7 @@ def read_header_fields(path, *args, **kwargs): return original_read(path, *args, **kwargs) monkeypatch.setattr(record_module, "_read_header_fields", read_header_fields) - loaded = wfdb.read_record( + loaded = read_mutable_record( tmp_path / "041s", layout="uniform", start=1000, @@ -155,7 +156,7 @@ def test_header_only_record_has_no_read_selection(): def test_pickle_discards_read_time_provenance(): """A restored record remains usable without a retained source.""" - loaded = wfdb.read_record("sample-data/100", layout="uniform", stop=3) + loaded = read_mutable_record("sample-data/100", layout="uniform", stop=3) restored = pickle.loads(pickle.dumps(loaded)) assert restored.source_header is None assert restored.source_signal_header is None @@ -168,7 +169,7 @@ def test_pickle_discards_read_time_provenance(): def test_copy_retains_read_provenance(copy_function, combine_segments): """Copying a record keeps its immutable source views.""" path = "sample-data/multi-segment/041s/041s" - loaded = wfdb.read_record( + loaded = read_mutable_record( path, layout="uniform", stop=2, combine_segments=combine_segments ) copied = copy_function(loaded) @@ -180,7 +181,7 @@ def test_copy_retains_read_provenance(copy_function, combine_segments): def test_signal_read_exposes_source_views_after_conversion(): """The modern signal reader carries the same source coordinates.""" - loaded = wfdb.read_signals("sample-data/100", layout="uniform", stop=3) + loaded = wfdb.read_record("sample-data/100", layout="uniform", stop=3) assert loaded.source_header == wfdb.read_header("sample-data/100") assert loaded.source_signal_header == loaded.source_header assert loaded.source_selection == wfdb.SourceSelection(0, 3, (0, 1)) diff --git a/tests/test_url.py b/tests/test_url.py index c6c80ea6..539ef847 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -10,6 +10,7 @@ import wfdb import wfdb.io._url +from tests._legacy_reader import read_mutable_record class TestNetFiles: @@ -439,10 +440,10 @@ def test_explicit_http_record_path_reads_files_from_one_server(): } with DummyHTTPServer(files, allow_gzip=False) as server: stem = server.url("db/100") - record = wfdb.read_record(stem, layout="uniform", stop=4, kind="digital") + record = read_mutable_record(stem, layout="uniform", stop=4, kind="digital") annotation = wfdb.read_annotations(stem + ".atr", stop=100) - local = wfdb.read_record( + local = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) np.testing.assert_array_equal(record.digital_signals, local.digital_signals) @@ -457,7 +458,7 @@ def test_explicit_http_record_path_uses_uncompressed_byte_ranges(): for name in ("100-no-len.hea", "100.dat") } with DummyHTTPServer(files, allow_gzip=True) as server: - record = wfdb.read_record( + record = read_mutable_record( server.url("db/100-no-len"), layout="uniform", start=649990, @@ -465,7 +466,7 @@ def test_explicit_http_record_path_uses_uncompressed_byte_ranges(): kind="digital", ) - expected = wfdb.read_record( + expected = read_mutable_record( "sample-data/100-no-len", layout="uniform", start=649990, diff --git a/tests/test_write_model_boundaries.py b/tests/test_write_model_boundaries.py index 00c1fbac..e6164701 100644 --- a/tests/test_write_model_boundaries.py +++ b/tests/test_write_model_boundaries.py @@ -3,12 +3,13 @@ import numpy as np import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import record as record_module def test_modern_write_does_not_call_record_checksum_method(tmp_path, monkeypatch): """Checksum calculation uses explicit digital arrays.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", stop=8, kind="digital", layout="uniform" ) @@ -22,7 +23,7 @@ def fail_if_called(*_args, **_kwargs): def test_write_record_does_not_create_a_record_adapter(tmp_path, monkeypatch): """write_record converts current fields at the private write boundary.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", stop=8, kind="digital", layout="uniform" ) @@ -37,7 +38,7 @@ def fail_if_called(*_args, **_kwargs): def test_signal_read_write_does_not_call_record_writer(tmp_path, monkeypatch): """RecordData writes selected values through private state.""" - source = wfdb.read_signals( + source = wfdb.read_record( "sample-data/100", stop=8, kind="digital", layout="uniform" ) diff --git a/tests/test_write_record.py b/tests/test_write_record.py index ea43f01d..b65375ca 100644 --- a/tests/test_write_record.py +++ b/tests/test_write_record.py @@ -5,12 +5,13 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record from wfdb.io import _header def test_write_uses_current_in_place_channel_edits(tmp_path): """Each write sees the current legacy channel fields without cached state.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) source.signal_names[0] = "Edited" @@ -27,7 +28,7 @@ def test_write_uses_current_in_place_channel_edits(tmp_path): def test_write_accepts_numpy_and_tuple_channel_fields(tmp_path): """The write boundary accepts aligned sequences and keeps the source type.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) source.adc_gain = np.array(source.adc_gain) @@ -36,7 +37,7 @@ def test_write_accepts_numpy_and_tuple_channel_fields(tmp_path): path = tmp_path / "copy" source.write(path) - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(result.d_signal, source.d_signal) np.testing.assert_array_equal(result.adc_gain, source.adc_gain) assert result.sig_name == list(source.sig_name) @@ -62,7 +63,7 @@ def test_expanded_write_uses_default_one_sample_per_frame(tmp_path): wfdb.write_record(path, source) - result = wfdb.read_record(path, kind="digital", layout="expanded") + result = read_mutable_record(path, kind="digital", layout="expanded") for actual, expected in zip(result.e_d_signal, source.e_d_signal): np.testing.assert_array_equal(actual, expected) assert source.samps_per_frame == [None, 2] @@ -70,7 +71,7 @@ def test_expanded_write_uses_default_one_sample_per_frame(tmp_path): def test_digital_round_trip_renames_files_and_preserves_source(tmp_path): """A selected digital read writes under the destination stem.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=100, kind="digital" ) old_files = source.file_name.copy() @@ -80,7 +81,7 @@ def test_digital_round_trip_renames_files_and_preserves_source(tmp_path): assert wfdb.write_record(path, source) is None - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(result.d_signal, old_values) assert result.file_name == ["copy.dat", "copy.dat"] assert result.sig_name == source.sig_name @@ -93,7 +94,7 @@ def test_digital_round_trip_renames_files_and_preserves_source(tmp_path): def test_record_write_method_selects_loaded_form(tmp_path): """The method accepts a destination and writes the requested signal form.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=10, kind="digital" ) source.p_signal = source.dac() @@ -103,7 +104,7 @@ def test_record_write_method_selects_loaded_form(tmp_path): source.write(path) assert source.write(path, kind="digital") is None - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(result.d_signal, source.d_signal) assert source.record_name == "100" assert source.file_name == ["100.dat", "100.dat"] @@ -111,10 +112,10 @@ def test_record_write_method_selects_loaded_form(tmp_path): def test_physical_round_trip(tmp_path): """A physical read can be written and read within its quantization.""" - source = wfdb.read_record("sample-data/100", layout="uniform", stop=100) + source = read_mutable_record("sample-data/100", layout="uniform", stop=100) path = tmp_path / "copy" wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform") + result = read_mutable_record(path, layout="uniform") np.testing.assert_allclose( result.p_signal, source.p_signal, @@ -137,7 +138,7 @@ def test_physical_record_built_in_code(tmp_path): ) path = tmp_path / "x" wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform") + result = read_mutable_record(path, layout="uniform") np.testing.assert_allclose(result.p_signal, source.p_signal, atol=0.01, rtol=0) assert source.fmt is None assert source.adc_gain is None @@ -161,20 +162,20 @@ def test_physical_record_with_calibration_gets_header_defaults(tmp_path): ) path = tmp_path / "x" wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform") + result = read_mutable_record(path, layout="uniform") np.testing.assert_array_equal(result.p_signal, source.p_signal) assert source.block_size is None def test_source_byte_offset_is_not_written_to_new_file(tmp_path): """A copied signal file starts at byte zero regardless of its source offset.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/a103l", layout="uniform", kind="digital", stop=100 ) assert source.byte_offset is not None path = tmp_path / "copy" wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(result.d_signal, source.d_signal) assert result.byte_offset is None or all( offset in (None, 0) for offset in result.byte_offset @@ -184,12 +185,12 @@ def test_source_byte_offset_is_not_written_to_new_file(tmp_path): def test_expanded_digital_round_trip_preserves_file_groups(tmp_path): """Expanded samples and multiple source signal files retain their grouping.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/mixedsignals", stop=10, kind="digital", layout="expanded" ) path = tmp_path / "copy" wfdb.write_record(path, source) - result = wfdb.read_record(path, kind="digital", layout="expanded") + result = read_mutable_record(path, kind="digital", layout="expanded") for actual, expected in zip(result.e_d_signal, source.e_d_signal): np.testing.assert_array_equal(actual, expected) assert result.file_name == [ @@ -205,7 +206,7 @@ def test_expanded_digital_round_trip_preserves_file_groups(tmp_path): def test_loaded_forms_need_an_unambiguous_selection(tmp_path): """The writer does not silently choose among loaded signal arrays.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=20, kind="digital" ) source.p_signal = source.dac() + 0.1 @@ -214,11 +215,13 @@ def test_loaded_forms_need_an_unambiguous_selection(tmp_path): wfdb.write_record(path, source) wfdb.write_record(path, source, kind="digital") - digital = wfdb.read_record(path, layout="uniform", kind="digital").d_signal.copy() + digital = read_mutable_record( + path, layout="uniform", kind="digital" + ).d_signal.copy() np.testing.assert_array_equal(digital, source.d_signal) wfdb.write_record(path, source, kind="physical") - physical = wfdb.read_record(path, layout="uniform", kind="digital").d_signal + physical = read_mutable_record(path, layout="uniform", kind="digital").d_signal assert np.any(physical != digital) assert source.p_signal is not None np.testing.assert_array_equal(source.d_signal, digital) @@ -226,10 +229,10 @@ def test_loaded_forms_need_an_unambiguous_selection(tmp_path): def test_both_layouts_require_layout(tmp_path): """The requested kind alone cannot choose a loaded layout.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/mixedsignals", stop=10, kind="physical", layout="expanded" ) - source.p_signal = wfdb.read_record( + source.p_signal = read_mutable_record( "sample-data/mixedsignals", layout="uniform", stop=10, kind="physical" ).p_signal with pytest.raises(ValueError, match="Multiple signal forms"): @@ -238,7 +241,7 @@ def test_both_layouts_require_layout(tmp_path): def test_flattened_selection_writes_current_view(tmp_path): """A combined multi-segment selection is written as one Record.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/multi-segment/041s/041s", layout="uniform", start=900, @@ -248,7 +251,7 @@ def test_flattened_selection_writes_current_view(tmp_path): assert source.source_segments is not None path = tmp_path / "copy" wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") assert type(result) is wfdb.Record np.testing.assert_array_equal(result.d_signal, source.d_signal) assert source.source_segments is not None @@ -256,12 +259,12 @@ def test_flattened_selection_writes_current_view(tmp_path): def test_local_archive_round_trip(tmp_path): """The output path may select a local WFDB archive.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=10, kind="digital" ) path = tmp_path / "copy.wfdb" wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(result.d_signal, source.d_signal) assert not (tmp_path / "copy.hea").exists() @@ -269,13 +272,13 @@ def test_local_archive_round_trip(tmp_path): @pytest.mark.parametrize("path", ["memory://write-record/copy", "memory://copy"]) def test_memory_uri_round_trip(path): """A cloud record stem uses the existing staged writer.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=10, kind="digital" ) memory = fsspec.filesystem("memory") try: wfdb.write_record(path, source) - result = wfdb.read_record(path, layout="uniform", kind="digital") + result = read_mutable_record(path, layout="uniform", kind="digital") np.testing.assert_array_equal(result.d_signal, source.d_signal) finally: for suffix in (".hea", ".dat"): @@ -285,10 +288,10 @@ def test_memory_uri_round_trip(path): def test_invalid_record_and_destinations(tmp_path): """Unsupported inputs fail before creating files.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=10, kind="digital" ) - multi = wfdb.read_record( + multi = read_mutable_record( "sample-data/multi-segment/041s/041s", layout="uniform", combine_segments=False, @@ -309,7 +312,7 @@ def test_invalid_record_and_destinations(tmp_path): def test_missing_or_mismatched_values(tmp_path): """A header-only record or a mismatched request has no values to write.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=10, kind="digital" ) with pytest.raises(ValueError, match="No loaded signal values"): @@ -332,7 +335,7 @@ def test_write_rejects_stated_count_that_disagrees_with_values( tmp_path, kind, layout, field ): """A stated n_sig cannot be silently replaced by the signal array count.""" - source = wfdb.read_record("sample-data/100", stop=4, kind=kind, layout=layout) + source = read_mutable_record("sample-data/100", stop=4, kind=kind, layout=layout) source.n_sig = 5 path = tmp_path / "copy" @@ -345,7 +348,7 @@ def test_write_rejects_stated_count_that_disagrees_with_values( def test_record_write_reports_sliced_signal_width(tmp_path): """An edited array gets a clear count error before conversion or files.""" - source = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + source = read_mutable_record("sample-data/100", layout="uniform", stop=4) source.p_signal = source.p_signal[:, :1] path = tmp_path / "copy" @@ -359,7 +362,7 @@ def test_record_write_reports_sliced_signal_width(tmp_path): @pytest.mark.parametrize("field", ["signal_names", "fmt", "file_name"]) def test_write_rejects_per_channel_field_length(tmp_path, field): """Header fields must align with the selected signal array.""" - source = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + source = read_mutable_record("sample-data/100", layout="uniform", stop=4) setattr(source, field, getattr(source, field)[:1]) path = tmp_path / "copy" header_field = "sig_name" if field == "signal_names" else field @@ -372,7 +375,7 @@ def test_write_rejects_per_channel_field_length(tmp_path, field): def test_write_lists_all_retained_field_mismatches(tmp_path): """A subset edit names every field that still needs a matching channel.""" - source = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + source = read_mutable_record("sample-data/100", layout="uniform", stop=4) source.p_signal = source.p_signal[:, :1] source.n_sig = 1 for field in ("sig_name", "units", "fmt", "adc_gain", "baseline", "file_name"): @@ -387,13 +390,13 @@ def test_write_lists_all_retained_field_mismatches(tmp_path): assert f"{field} length 2" in message for field in ("byte_offset", "init_value", "checksum"): assert field not in message - assert "read_record(..., channels=[...])" in message + assert "rdrecord(..., channels=[...])" in message assert not path.with_suffix(".hea").exists() def test_write_ignores_fields_it_replaces(tmp_path): """Stale generated values do not block writing a valid selected view.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) source.byte_offset = [0] @@ -413,7 +416,7 @@ def test_write_ignores_fields_it_replaces(tmp_path): def test_write_ignores_skew_already_applied_on_read(tmp_path): """Aligned values do not need a source skew list in the output header.""" - source = wfdb.read_record("sample-data/100skew", layout="uniform", stop=4) + source = read_mutable_record("sample-data/100skew", layout="uniform", stop=4) assert source.skew == source._applied_skew == [None, 3] source.p_signal = source.p_signal[:, :1] source.n_sig = 1 @@ -441,7 +444,7 @@ def test_write_ignores_skew_already_applied_on_read(tmp_path): def test_write_rejects_new_skew_on_aligned_values(tmp_path): """A changed skew must fail before producing an unreadable output.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=12, kind="digital" ) source.skew[0] = 1 @@ -457,7 +460,7 @@ def test_write_rejects_new_skew_on_aligned_values(tmp_path): def test_write_clears_retained_source_skew_on_aligned_values(tmp_path): """Clearing one channel's skew keeps the other channel aligned.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=12, kind="digital" ) expected = source.d_signal.copy() @@ -471,7 +474,7 @@ def test_write_clears_retained_source_skew_on_aligned_values(tmp_path): None, ] np.testing.assert_array_equal( - wfdb.read_record(path, layout="uniform", kind="digital").d_signal, expected + read_mutable_record(path, layout="uniform", kind="digital").d_signal, expected ) assert source.skew == [0, 3] @@ -488,7 +491,7 @@ def _keep_one_channel_in_place(record, index): def test_write_accepts_manual_channel_removal_without_remaining_skew(tmp_path): """A cleared-skew subset can be written despite old provenance length.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=12, kind="digital" ) expected = source.d_signal[:, :1].copy() @@ -501,20 +504,20 @@ def test_write_accepts_manual_channel_removal_without_remaining_skew(tmp_path): assert wfdb.read_header(path).signals[0].skew is None np.testing.assert_array_equal( - wfdb.read_record(path, layout="uniform", kind="digital").d_signal, expected + read_mutable_record(path, layout="uniform", kind="digital").d_signal, expected ) def test_write_rejects_unmapped_skew_after_manual_channel_removal(tmp_path): """A nonzero skew needs a known mapping to the applied source channels.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=12, kind="digital" ) _keep_one_channel_in_place(source, 1) assert source.skew == [3] path = tmp_path / "copy" - with pytest.raises(ValueError, match="select channels with read_record"): + with pytest.raises(ValueError, match="select channels with rdrecord"): source.write(path, signal_alignment="aligned") assert not path.with_suffix(".hea").exists() @@ -523,7 +526,7 @@ def test_write_rejects_unmapped_skew_after_manual_channel_removal(tmp_path): @pytest.mark.parametrize("writer", ["write", "wrsamp"]) def test_ignored_skew_accepts_manual_channel_subset(tmp_path, writer): """A retained source skew follows a manually selected raw channel.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", kind="digital", signal_alignment="raw" ) _keep_one_channel_in_place(source, 1) @@ -536,7 +539,7 @@ def test_ignored_skew_accepts_manual_channel_subset(tmp_path, writer): source.wrsamp(write_dir=str(tmp_path)) assert wfdb.read_header(tmp_path / "copy").signals[0].skew == 3 - assert wfdb.read_record( + assert read_mutable_record( tmp_path / "copy", layout="uniform", kind="digital" ).d_signal.shape == ( source.sig_len, @@ -547,7 +550,7 @@ def test_ignored_skew_accepts_manual_channel_subset(tmp_path, writer): @pytest.mark.parametrize("writer", ["write", "wrsamp"]) def test_ignored_skew_rejects_unmapped_channel_subset(tmp_path, writer): """An unmatched skew after channel removal gets selection guidance.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100skew", layout="uniform", stop=200, @@ -559,7 +562,7 @@ def test_ignored_skew_rejects_unmapped_channel_subset(tmp_path, writer): source.record_name = "copy" source.file_name = ["copy.dat"] - with pytest.raises(ValueError, match="select channels with read_record"): + with pytest.raises(ValueError, match="select channels with rdrecord"): if writer == "write": source.write(tmp_path / "copy", signal_alignment="raw") else: @@ -569,7 +572,7 @@ def test_ignored_skew_rejects_unmapped_channel_subset(tmp_path, writer): def test_write_rejects_non_integer_signal_count(tmp_path): """A count with the wrong type raises TypeError before writing.""" - source = wfdb.read_record("sample-data/100", layout="uniform", stop=4) + source = read_mutable_record("sample-data/100", layout="uniform", stop=4) source.n_sig = "2" path = tmp_path / "copy" with pytest.raises(TypeError, match="n_sig must be an integer"): @@ -579,7 +582,7 @@ def test_write_rejects_non_integer_signal_count(tmp_path): def test_write_validates_only_selected_signal_form(tmp_path): """Other loaded forms need not have the selected form's channel count.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) source.p_signal = source.dac()[:, :1] @@ -588,13 +591,15 @@ def test_write_validates_only_selected_signal_form(tmp_path): source.write(tmp_path / "physical", kind="physical") source.write(tmp_path / "digital", kind="digital") - written = wfdb.read_record(tmp_path / "digital", layout="uniform", kind="digital") + written = read_mutable_record( + tmp_path / "digital", layout="uniform", kind="digital" + ) np.testing.assert_array_equal(written.d_signal, source.d_signal) def test_write_can_infer_an_unset_signal_count(tmp_path): """An absent n_sig can still be filled from the selected values.""" - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", layout="uniform", stop=4, kind="digital" ) source.n_sig = None diff --git a/tests/test_write_record_data.py b/tests/test_write_record_data.py index 685d42f2..805e3919 100644 --- a/tests/test_write_record_data.py +++ b/tests/test_write_record_data.py @@ -28,7 +28,7 @@ def _same_written_bytes(tmp_path, data, **options): @pytest.mark.parametrize("layout", ["uniform", "expanded"]) def test_function_matches_method_for_single_segment(tmp_path, kind, layout): """The same selected values produce byte-identical files.""" - data = wfdb.read_signals( + data = wfdb.read_record( "sample-data/100", kind=kind, layout=layout, start=10, stop=18 ) _same_written_bytes(tmp_path, data) @@ -51,7 +51,7 @@ def _dated_data(tmp_path): base_date=datetime.date(2020, 5, 6), base_time=datetime.time(12, 0), ) - return wfdb.read_signals(path, kind="digital", layout="uniform") + return wfdb.read_record(path, kind="digital", layout="uniform") @pytest.mark.parametrize("edit", ["select", "values", "channels", "comments", "time"]) @@ -84,7 +84,7 @@ def test_function_matches_method_after_conversion(tmp_path, conversion): @pytest.mark.parametrize("alignment", ["aligned", "raw"]) def test_function_matches_method_for_skew(tmp_path, alignment): """Both entry points require the same explicit alignment choice.""" - data = wfdb.read_signals( + data = wfdb.read_record( "sample-data/test01_00s_skew", kind="digital", layout="uniform", @@ -99,7 +99,7 @@ def test_function_matches_method_for_skew(tmp_path, alignment): def test_function_matches_method_for_flattened_segments(tmp_path): """A combined multi-segment view is written as one record.""" - data = wfdb.read_signals( + data = wfdb.read_record( "sample-data/multi-segment/fixed1/v102s", kind="digital", layout="uniform", @@ -137,9 +137,9 @@ def test_formats_and_missing_mask_use_same_validation(tmp_path): adc_gain=[200], baseline=[0], ) - data = wfdb.read_signals(source, kind="digital", layout="uniform") + data = wfdb.read_record(source, kind="digital", layout="uniform") written = _same_written_bytes(tmp_path, data, formats="24") - restored = wfdb.read_signals(written, kind="digital", layout="uniform") + restored = wfdb.read_record(written, kind="digital", layout="uniform") np.testing.assert_array_equal( restored.signals.values.mask, data.signals.values.mask ) @@ -150,7 +150,7 @@ def test_formats_and_missing_mask_use_same_validation(tmp_path): def test_future_read_record_write_record_round_trip(tmp_path): """The 6.0 pair will preserve selected digital values and logical metadata.""" - original = wfdb.read_signals( + original = wfdb.read_record( "sample-data/100", kind="digital", layout="uniform", @@ -159,7 +159,7 @@ def test_future_read_record_write_record_round_trip(tmp_path): ) destination = tmp_path / "copy" wfdb.write_record(destination, original) - restored = wfdb.read_signals(destination, kind="digital", layout="uniform") + restored = wfdb.read_record(destination, kind="digital", layout="uniform") np.testing.assert_array_equal(restored.signals.values, original.signals.values) np.testing.assert_array_equal( np.ma.getmaskarray(restored.signals.values), @@ -178,9 +178,7 @@ def test_future_read_record_write_record_round_trip(tmp_path): def test_record_data_rejects_record_only_options_before_writing(tmp_path): """kind and layout choose a form only when writing a mutable Record.""" - data = wfdb.read_signals( - "sample-data/100", kind="digital", layout="uniform", stop=4 - ) + data = wfdb.read_record("sample-data/100", kind="digital", layout="uniform", stop=4) for option in ({"kind": "digital"}, {"layout": "uniform"}): with pytest.raises(ValueError, match="apply only to Record"): wfdb.write_record(tmp_path / "wrong", data, **option) diff --git a/tests/test_write_signals.py b/tests/test_write_signals.py index 39425603..3e260a0a 100644 --- a/tests/test_write_signals.py +++ b/tests/test_write_signals.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record def _write(path, values, *, kind="digital", formats="16", **kwargs): @@ -46,7 +47,7 @@ def test_digital_masked_round_trip_with_per_channel_formats(tmp_path): ) assert (tmp_path / "mixed_0.dat").exists() assert (tmp_path / "mixed_1.dat").exists() - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") np.testing.assert_array_equal(read.signals.values.mask, values.mask) np.testing.assert_array_equal(read.signals.values.compressed(), values.compressed()) np.testing.assert_array_equal(values.data, original.data) @@ -69,7 +70,7 @@ def test_expanded_masked_round_trip(tmp_path): adc_gain=[200.0, 200.0], baseline=[0, 0], ) - read = wfdb.read_signals(path, kind="digital", layout="expanded") + read = wfdb.read_record(path, kind="digital", layout="expanded") assert read.signals.samples_per_frame == (1, 2) for actual, expected in zip(read.signals.values, values, strict=True): np.testing.assert_array_equal(actual.mask, expected.mask) @@ -91,7 +92,7 @@ def test_expanded_mixed_masked_and_plain_channels(tmp_path): adc_gain=[200.0, 200.0], baseline=[0, 0], ) - read = wfdb.read_signals(path, kind="digital", layout="expanded") + read = wfdb.read_record(path, kind="digital", layout="expanded") assert read.signals.values[0].mask.tolist() == [False, True, False] assert not np.any(np.ma.getmaskarray(read.signals.values[1])) @@ -102,7 +103,7 @@ def test_physical_nan_round_trip(tmp_path): original = values.copy() path = tmp_path / "physical" _write(path, values, kind="physical", formats="16") - read = wfdb.read_signals(path, kind="physical", layout="uniform") + read = wfdb.read_record(path, kind="physical", layout="uniform") np.testing.assert_array_equal(np.isnan(read.signals.values), np.isnan(values)) np.testing.assert_allclose( read.signals.values[~np.isnan(values)], values[~np.isnan(values)], atol=1e-4 @@ -117,7 +118,7 @@ def test_physical_with_per_channel_formats_uses_separate_files(tmp_path): _write(path, values, kind="physical", formats=["16", "212"]) assert (tmp_path / "physical_mixed_0.dat").exists() assert (tmp_path / "physical_mixed_1.dat").exists() - record = wfdb.read_record(path, kind="physical", layout="uniform") + record = read_mutable_record(path, kind="physical", layout="uniform") assert record.fmt == ["16", "212"] np.testing.assert_allclose(record.p_signal, values, atol=1e-3) @@ -134,7 +135,7 @@ def test_physical_range_error_matches_signal_read_write(tmp_path): adc_gain=gain, baseline=baseline, ) - read = wfdb.read_signals(tmp_path / "source", kind="physical", layout="uniform") + read = wfdb.read_record(tmp_path / "source", kind="physical", layout="uniform") read.signals.values[0, 0] = 1e6 with pytest.raises(ValueError, match="valid range -32767 to 32767") as from_read: read.write(tmp_path / "from_read") @@ -161,7 +162,7 @@ def test_local_archive_target(tmp_path): adc_gain=[200.0, 200.0], baseline=[0, 0], ) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") np.testing.assert_array_equal(read.signals.values, [[1, 2], [3, 4]]) @@ -175,7 +176,7 @@ def test_memory_cloud_target(): adc_gain=[200.0, 200.0], baseline=[0, 0], ) - read = wfdb.read_signals(path, kind="digital", layout="uniform") + read = wfdb.read_record(path, kind="digital", layout="uniform") np.testing.assert_array_equal(read.signals.values, [[1, 2], [3, 4]]) @@ -295,7 +296,7 @@ def test_flattened_mixed_format_read_keeps_mask(tmp_path): baseline=[0], ) (tmp_path / "mixed.hea").write_text("mixed/2 1 100 6\npart16 3\npart212 3\n") - source = wfdb.read_signals( + source = wfdb.read_record( tmp_path / "mixed", kind="digital", layout="uniform", @@ -314,7 +315,7 @@ def test_flattened_mixed_format_read_keeps_mask(tmp_path): adc_gain=[200.0] * values.shape[1], baseline=[0] * values.shape[1], ) - read = wfdb.read_signals(tmp_path / "flattened", kind="digital", layout="uniform") + read = wfdb.read_record(tmp_path / "flattened", kind="digital", layout="uniform") np.testing.assert_array_equal( np.ma.getmaskarray(read.signals.values), np.ma.getmaskarray(values) ) diff --git a/tests/test_write_warning_caller.py b/tests/test_write_warning_caller.py index 48305ba9..08685a00 100644 --- a/tests/test_write_warning_caller.py +++ b/tests/test_write_warning_caller.py @@ -6,6 +6,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record @pytest.mark.parametrize( @@ -27,9 +28,9 @@ def test_overwrite_warning_points_to_caller(tmp_path, writer): if writer == "flattened_signal_read_write" else "sample-data/100" ) - source = wfdb.read_signals(path, stop=10, kind="digital", layout="uniform") + source = wfdb.read_record(path, stop=10, kind="digital", layout="uniform") else: - source = wfdb.read_record( + source = read_mutable_record( "sample-data/100", stop=10, kind="digital", layout="uniform" ) diff --git a/tests/test_writer_byte_fixtures.py b/tests/test_writer_byte_fixtures.py index 5032c15b..075a1d5c 100644 --- a/tests/test_writer_byte_fixtures.py +++ b/tests/test_writer_byte_fixtures.py @@ -12,6 +12,7 @@ import pytest import wfdb +from tests._legacy_reader import read_mutable_record FIXTURE_ROOT = Path(__file__).parent / "fixtures" / "writer_bytes" @@ -165,7 +166,7 @@ def _raw_skew(path): def _aligned_skew(path): - read = wfdb.read_signals( + read = wfdb.read_record( "sample-data/100skew", kind="physical", layout="uniform", @@ -176,7 +177,7 @@ def _aligned_skew(path): def _flattened_multisegment(path): - record = wfdb.read_record( + record = read_mutable_record( "sample-data/multi-segment/041s/041s", kind="digital", layout="uniform", @@ -193,9 +194,7 @@ def _variable_master(path): def _archive(path): - read = wfdb.read_signals( - "sample-data/100", kind="digital", layout="uniform", stop=5 - ) + read = wfdb.read_record("sample-data/100", kind="digital", layout="uniform", stop=5) read.write(path.with_suffix(".wfdb"))