Let the base class decide when these transformers reset - #37
Merged
Conversation
ezmsg-baseproc 1.12.0's default `_hash_message` folds in the message key, the dims, the length of every dimension except the chunk dimension, the coordinate *values* on those dimensions, and the gain and offset of any linear axis among them. Two of the three overrides here were strict subsets of that and are gone; the third keeps only what the default cannot see. What the deletions buy is the channel fingerprint. A source that renames or reorders channels without changing how many it sends -- a device reconfigured mid-session, a montage swapped -- was invisible to these hashes, so per-channel state carried onto channels it did not belong to: * `RefractoryTransformer` kept armA's `elapsed` counters, suppressing armB's events for the first refractory window. * `ThresholdCrossingTransformer` kept armA's adaptive z-scoring state, so armB's first crossings were judged against the wrong running mean. Neither announces itself in the output. `refractory`'s override was `return super()._hash_message(message)` in any case; `peak`'s hashed the key, the non-time shape and the gain, all of which the default already covers. `BinnedKernelActivation` still overrides, for two things the base class has no way to know: the data dtype (via `str()`, since mlx arrays do not expose `.kind`) and the array backend, whose code paths differ between sparse, numpy and mlx. Those move to `extra=`, and it now inherits the key and the fingerprint, which it previously ignored -- `activation`, `dense_carry` and `samples_since_update` are per-channel running state and must not follow a stream switch. Requires ezmsg-baseproc 1.12.0. The direct `ezmsg` pin is raised to 3.10.0b2 alongside it: baseproc needs that version for `CoordinateAxis.fingerprint` and `AxisArray.chunk_dim`, and uv only enables pre-releases for a package named with a pre-release marker in *this* file, so leaving it to the transitive requirement fails resolution outright. 11 new tests, verified by restoring the old hashes: 3 of the 4 relabel tests fail without this change, including both behavioural ones. The fourth was vacuous at first -- armA and armB fired at the same sample indices, so the carried refractory counters changed nothing; it now straddles the refractory window, and fails too. 166 passed, up from 155.
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.
ezmsg-baseproc 1.12.0's default
_hash_messagefolds in the message key, the dims, the length of every dimension except the chunk dimension, the coordinate values on those dimensions, and the gain and offset of any linear axis among them. Two of the three overrides here were strict subsets of that.What the deletions buy
The channel fingerprint. A source that renames or reorders channels without changing how many it sends — a device reconfigured mid-session, a montage swapped — was invisible to these hashes, so per-channel state carried onto channels it did not belong to:
RefractoryTransformerkept armA'selapsedcounters, suppressing armB's events for the first refractory window.ThresholdCrossingTransformerkept armA's adaptive z-scoring state, so armB's first crossings were judged against the wrong running mean.Neither announces itself in the output.
refractory's override wasreturn super()._hash_message(message)in any case.peak's hashed the key, the non-time shape and the gain — all of which the default already covers.The deletions weren't decided by reading. A harness ran each override and the default over one stream and compared their reset points; an override was removed only where the default's set was a superset:
BinnedKernelActivationkeeps its overrideFor two things the base class has no way to know: the data dtype (via
str(), since mlx arrays don't expose.kind) and the array backend, whose code paths differ between sparse, numpy and mlx. Those move toextra=.It now also inherits the key and the fingerprint, which it previously ignored —
activation,dense_carryandsamples_since_updateare per-channel running state and must not follow a stream switch. Its reset set goes from[0,5,6,8,9]to[0,3,5,6,7,8,9]: a strict superset of the default, plus the dtype.Testing
166 passed, up from 155. 11 new tests, verified by restoring the old hashes: 3 of the 4 relabel tests fail without this change, including both behavioural ones.
The fourth was vacuous when I first wrote it — armA and armB fired at the same sample indices, so the carried refractory counters changed nothing and it passed either way. It now straddles the refractory window (armA on its last sample, armB on its sixth, against a 60-sample window) and fails on the old hash like the others.
Dependencies
ezmsg-baseproc>=1.12.0, and the directezmsgpin raised to3.10.0b2alongside it. The latter is not optional: baseproc needs that version forCoordinateAxis.fingerprintandAxisArray.chunk_dim, and uv only enables pre-releases for a package named with a pre-release marker in this file — leaving it to the transitive requirement fails resolution outright withrequirements are unsatisfiable.🤖 Generated with Claude Code