Add schema-free single-register loader - #9
Merged
Conversation
This was referenced Jul 25, 2026
glopesdev
approved these changes
Aug 6, 2026
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.
Summary
Introduces
harp.data.read(source), the pyharp counterpart of harp-python'sharp.io.read: read one register's binary.bindata into a pandas DataFrame, inferring the layout from the first frame. It is implemented on top of the unifiedharp.protocolregister API instead of a hand-rolled byte parser.Background — how harp-python loaded data
harp-python offered two layers:
harp.io.read(file, address=, dtype=, length=, epoch=, keep_type=): read a single register file, infer stride / timestamp / row count from the first message, and decode to the native numpy dtype. It hand-coded the Harp framing math (_dtypefrompayloadtype, stride/offset arithmetic, timestamp handling).harp.reader.create_reader(device)on top ofharp.schema.read_schema+harp.model: parse adevice.yml, generate per-register readers at runtime, and decode masks / enums /payloadSpecmembers from the schema. Files were resolved by the{device}_{address}.binconvention.What this PR adds
harp.data.read(source, *, timestamp=True, message_type=False)— inspects the first frame's header (payload-type byte, length byte, timestamp flag), builds the matching native register fromharp.protocol(RegisterU16,RegisterS16Array(addr, length=n), …), and delegates toparse_to_dataframe→RegisterBase.parse_bulk. Decodes to native numpy types only (no enum / bit-mask decoding), matchingio.read's behavior.sourcemay be a path, bytes, or an open binary file.harp.protocolnow exportsdecode_payload_type,encode_payload_type, andPayloadTypeInfo— the canonical payload-type-byte decoder thatreadrelies on to infer the element type, size, and timestamp flag.