Repository navigation
Write dat files from captured channel fields - #877
Conversation
tompollard
left a comment
There was a problem hiding this comment.
This step is correct, and it can merge. The parity test passes (359 passed, 44 expected skips), as do the offline suite (2,167 passed, 48 skipped) and Ruff.
What I checked
- Grouping matches the legacy path.
_write_dat_filesbuilds the same file groups withdescribe_list_indices, takes each file's format and byte offset from its first channel, uses offset 0 whenbyte_offsetwasn't captured, and passessamps_per_frame or 1for expanded channels. All of that comes from the snapshot rather thanself. - The uniform slice is safe.
values[:, channels[0] : channels[-1] + 1]assumes a file's channels are adjacent. The legacy path makes the same assumption, andcheck_fieldalready rejects non-adjacent channels before writing ("Signals in a record that share a given file must be consecutive",record.py:803). So nothing changes here. - Nothing is shared without a comparison. The per-format encoder
wr_dat_fileis called by both sides but isn't modified in this PR, so the comparison really tests the grouping change. The new cases cover all eight writable formats in both layouts, mixed formats with gaps across separate files, and a declared byte offset.
For the next step
wr_dat_files still falls back to _legacy_wr_dat_files when it's called without a snapshot. That fallback, and the other legacy paths, are what the "model passes directly" step should remove. When it does, the parity test will lose its legacy side. Before deleting them, it would help to freeze the outputs as reference bytes for a few representative cases: formats 16 and 212, expanded mixed frames, a gap in each format and a multi-segment master. That way the end state is still checked against something.
|
Thanks for checking the grouping and format coverage. I agree on preserving reference bytes before the legacy side goes away. I’ll add fixed outputs from the pinned #866 baseline for formats 16 and 212, expanded mixed frames, missing samples in each format, and a multi-segment master before removing the fallback paths. I’ll keep the live old-versus-new comparison through the model handoff so that step can still be checked directly. |
Summary
Continue #866 by moving
.datfile grouping onto captured channel fields and explicit digital arrays. The per-formatwr_dat_fileencoder already accepts explicit inputs; the remainingRecorddependency was inwr_dat_files, which selected file groups, formats, offsets, and samples per frame from mutable attributes. The prepared write path now passes its channel snapshot and arrays to_write_dat_files.The previous
wr_dat_filesimplementation remains temporarily for the differential tests and direct calls without a snapshot. This is an internal refactor with no intended output or public API change, so there is no changelog entry.Checks
.datgrouping path too.The next #866 step is to let modern writers pass their model directly through these explicit functions, then remove the temporary
Recordadapter and legacy paths once the comparisons and benchmark pass.