Repository navigation
Read format 61 signals with smooth_frames=False - #678
Merged
Merged
Conversation
convert_dtype compared dtypes by parsing their names, which fails for the big-endian dtype of format 61 (>i2). Use np.can_cast instead, which also handles byte order.
tompollard
commented
Nov 24, 2026
tompollard
left a comment
Member
Author
There was a problem hiding this comment.
Reviewed commit 8170c9a. I found no issues. The dtype check handles big-endian format 61 samples, returns the requested native dtype, and still rejects output dtypes that are too small. All 115 offline record tests pass. Docs and style checks pass; the test matrix is still running. Ready to merge once CI passes.
…rder # Conflicts: # tests/test_record.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rdrecordwithphysical=Falseandsmooth_frames=Falsefails for any record with a format 61 signal:convert_dtypecompared dtypes by parsing their names (int(str(dtype)[3:])). Format 61 is stored in big-endian byte order, so its dtype is>i2, which has nothing after the first three characters. It now usesnp.can_cast(current_dtype, return_dtype, "safe"), which handles byte order. Samples are returned in the requested native dtype, and asking for a dtype that is too small still raises the same "lower dtype" error.This is the read that a lossless round trip needs (#484, #500). It affects
p10143andbinformatsinsample-data. Writing format 61 is still not supported, so those two records can be read this way but not yet written back.Testing:
TestExpandedBigEndianchecks the samples and dtype forreturn_resof 16, 32 and 64, that a dtype that is too small is rejected, and a record mixing format 61 with other formats. All of them fail onmain.uv run pytest -m "not network" -W error(571 passed), the network tests intests/test_record.py(14 passed),ruff format --checkandruff checkpass. Changelog entry added inchangelog.d/.Refs #484, #500
@tompollard 🟥 red 🐳 whale · quince