Skip to content

Add AxisArray.config_id, a digest identifying a stream's configuration - #278

Draft
cboulay wants to merge 4 commits into
cboulay/axisarray-segmentfrom
cboulay/axisarray-config-id
Draft

cboulay wants to merge 4 commits into
cboulay/axisarray-segmentfrom
cboulay/axisarray-config-id

Conversation

@cboulay

@cboulay cboulay commented Nov 16, 2026

Copy link
Copy Markdown
Member

Stacked on #277 (AxisArray.segment). This is the new top of the stack.

What

AxisArray gains config_id: int = 0, a digest of the stream's configuration. It travels with the message, including over shared memory, so a downstream stage can decide whether to reset with one integer compare instead of hashing the layout of every message. 0 means "not declared".

Together with segment (#277) this separates two questions:

  • segment changes when there is a break in the data (a measured gap).
  • config_id changes when the stream itself is different (layout, dtype, axes, units).

API

  • compute_config_id(message) digests: the key, dims, stream_dim, the dtype, the array backend (numpy, mlx, ...), and for each non-stream dim its name, length and axis (unit / gain / offset for a LinearAxis, the fingerprint for a CoordinateAxis). For the stream dim only unit and gain are digested.
  • Not digested: attrs, the length of the stream dim, and the stream axis offset. These change per message.
  • chain_config_id(parent, *parts) derives a new id from an input id plus whatever a stage adds (its settings, a device id, scaling). numpy scalars and arrays in parts are converted to plain Python values first, so np.float64(2.0) and 2.0 give the same id.
  • array_backend(data) names the array library of a data buffer.
  • Ids are positive 63-bit integers and never 0 or -1.

Details

  • Keys, dim names and units are digested as str, so np.str_("x") and "x" agree.
  • String-labelled data ignores the fixed string width where it would otherwise make the id unstable.

Tests

tests/messages/test_axisarray.py: what does and does not change the id, stability across key and scalar types, chaining, and the round trip through pickling.

Downstream

ezmsg-baseproc uses config_id to decide resets and ezmsg-sigproc and the source packages stamp it. Those PRs follow and need a pre-release of this stack.

@cboulay
cboulay marked this pull request as draft November 16, 2026 07:52

This branch was successfully deployed

1 active deployment
github-pages — a6d76ed8 Deployed Nov 16, 2026 by cboulay via deploy #129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant