Skip to content

Follow chunk_dim for binning, and deprecate BinnedEventAggregatorSettings.axis - #38

Merged
cboulay merged 3 commits into
devfrom
cboulay/chunk-dim-axis
Sep 7, 2026
Merged

cboulay merged 3 commits into
devfrom
cboulay/chunk-dim-axis

Conversation

@cboulay

@cboulay cboulay commented Sep 7, 2026

Copy link
Copy Markdown
Member

Blocked: needs an ezmsg-sigproc 3.8.0 release (ezmsg-sigproc#239, merged). CI will be red until then — the >=3.8.0 pin can't resolve yet. Verified locally against a checkout of sigproc dev: 170 passed.

Why

Binning carries an open partial bin across message boundaries, so it is only meaningful along the dimension messages accumulate along. That dimension belongs to the producer — AxisArray.chunk_dim — and a setting that lets a consumer disagree can only be used to be wrong.

BinnedEventAggregatorSettings.axis is deprecated here and removed in 2.0, matching what sigproc 3.8 does to the BinnedAggregate this delegates to.

The pin bump is load-bearing

The default changes from "time" to None. Old BinnedAggregate indexes message.axes[None] and raises KeyError: None — I hit exactly that running the suite against released sigproc 2.31.0 (15 failures). So this needs the version that resolves chunk_dim, hence ezmsg-sigproc>=3.8.0.

Two forwarding sites suppressed

Without this, sigproc 3.8 would make existing, correct ezmsg-event pipelines emit FutureWarnings naming sigproc classes the user never touched:

  • binned.py hands our own already-warned axis to BinnedAggregateSettings. Warning twice for one user-visible setting sends people to look in the wrong package.
  • peak.py builds an AdaptiveStandardScaler with axis="time". This module works on "time" throughout (seven hardcoded uses), and the scaler shares the state that normalises the samples being thresholded — so it has to use the same axis. Suppressed rather than dropped for that reason: letting the scaler follow chunk_dim while everything around it used "time" would be worse than either.

Teaching peak.py to resolve chunk_dim throughout is a real follow-up, but it's a behaviour change to threshold crossing and deserves its own PR.

Testing

170 passed. New tests cover: setting axis warns about our class rather than sigproc's; leaving it unset is silent through processing (which is what the suppression buys); forwarding warns once, not twice; and a configured axis still bins identically, so behaviour is unchanged until removal.

…ings.axis

Binning carries an open partial bin across message boundaries, so it is only
meaningful along the dimension messages accumulate along. That dimension is
the producer's to declare -- `AxisArray.chunk_dim` -- and a setting letting a
consumer disagree can only be used to be wrong. Deprecated here, removed in
2.0, matching what ezmsg-sigproc 3.8 does to the binner this delegates to.

The default changes from "time" to None, so `BinnedAggregate` needs to be the
version that resolves chunk_dim rather than indexing `axes[None]`; hence the
ezmsg-sigproc>=3.8.0 pin.

Two forwarding sites are wrapped in suppress_axis_deprecation():

* binned.py hands our own already-warned `axis` to BinnedAggregateSettings.
  Warning again would name a sigproc class for a setting the user made on
  ours, sending them to look in the wrong place.
* peak.py builds an AdaptiveStandardScaler with axis="time". This module
  works on "time" throughout, and the scaler shares the state that normalises
  the samples being thresholded, so it must use the same axis. Suppressed
  rather than dropped for that reason -- letting the scaler follow chunk_dim
  while everything around it used "time" would be worse than either. Teaching
  the whole module to resolve chunk_dim is a separate change.
ezmsg-sigproc 3.8.0 shipped its own copy of the deprecation machinery before
it moved to ezmsg-baseproc, so its warnings check a ContextVar that
baseproc's suppress_axis_deprecation() does not set. Entering baseproc's
context therefore silenced nothing, and forwarding our axis warned twice --
once for our setting and once for sigproc's.

Importing the context manager from ezmsg.sigproc works against 3.8.0 and
against later versions, which re-export baseproc's (so it is the same object
and the same ContextVar). Our own settings keep warning through baseproc.
ezmsg-sigproc 3.8.1 shares baseproc's deprecation mechanism, so there is a
single ContextVar again and the import that works is simply the obvious one.
Pinned to >=3.8.1 accordingly, and the note explaining which of two
mechanisms to reach for is gone with it.
@cboulay
cboulay merged commit 3c2f62b into dev Sep 7, 2026
4 checks passed
@cboulay
cboulay deleted the cboulay/chunk-dim-axis branch September 7, 2026 05:22
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