Skip to content

Split merge module into separate steps: align and concat - #137

Merged
cboulay merged 2 commits into
devfrom
align_concat
Mar 24, 2026
Merged

Split merge module into separate steps: align and concat#137
cboulay merged 2 commits into
devfrom
align_concat

Conversation

@cboulay

@cboulay cboulay commented Mar 18, 2026

Copy link
Copy Markdown
Member

Each of align and concat have utility on their own, and concat has expanded utility including concatenating along a new axis.

AI Summary:

New files:

  • src/ezmsg/sigproc/align.py — AlignAlongAxisProcessor + AlignAlongAxis unit. Extracted all time-alignment/buffering logic (seek-based overlap detection,
    gain matching, per-input buffer management) from the old merge.py. Returns paired aligned chunks (a, b).
  • src/ezmsg/sigproc/concat.py — ConcatProcessor + Concat unit + shared helpers. Queue-based FIFO pairing (like Add). Includes:
    • _build_merged_coordinate_axis() — struct-aware axis merging (Req 3)
    • _validate_shared_axes() — assert identical shared axis .data (Req 2)
    • _build_cached_axes() — pre-construct non-alignment axes once (Req 4)
    • New-axis validation: all non-concat dims must match (Req 1)

Rewritten:

  • src/ezmsg/sigproc/merge.py — Merge is now an ez.Collection composing AlignAlongAxis → Concat. MergeProcessor is a convenience wrapper preserving the old
    proc(msg_a) / proc.push_b(msg_b) interface.

Tests:

  • tests/unit/test_align.py — 8 tests covering aligned pairs, stagger, float precision, gain mismatch, shape changes
  • tests/unit/test_concat.py — 22 tests covering helpers (struct merging, validation), ConcatProcessor (basic, relabel, new-axis, assert-identical,
    struct-aware, caching)
  • tests/unit/test_merge.py — All 13 existing tests pass (one minor fix: proc.state.merged_concat_axis → proc.concat_state.merged_concat_axis)

@cboulay
cboulay merged commit 221d3d0 into dev Mar 24, 2026
14 checks passed
@cboulay
cboulay deleted the align_concat branch March 24, 2026 12:48
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