feat(track-p): role out-of-band 2-channel carrier - #45
Merged
Conversation
Implement the role channel of GammaThetaMultiplexer.forward: when role is given, return a [B, 2, T] carrier. Channel 0 stays byte-identical to the role=None carrier (additive/out-of-band, preserving the full 64-code alphabet); channel 1 carries PREDICTION on the gamma band and ERROR on the theta band per nerve_core.neuroletter Role/Phase. Resolves the deferred issue #1 Q5 hook. Replace the NotImplementedError test with four tests (2-channel shape, channel-0 invariance, shape validation, gamma/theta spectral separability).
There was a problem hiding this comment.
Pull request overview
Implements the previously-deferred role channel in GammaThetaMultiplexer.forward. When role is supplied, forward now returns a [B, 2, T] carrier where channel 0 is byte-identical to the role=None output (preserving the full 64-code alphabet) and channel 1 carries the role: PREDICTION energy on the γ band (rFFT bin 7), ERROR on the θ band (bin 1), matching nerve_core.neuroletter.Role/Phase. The NotImplementedError is replaced with a ValueError for role/codes shape mismatch.
Changes:
- Replace
NotImplementedErrorinforwardwith shape validation and a real role-carrier branch that returns a stacked[B, 2, T]tensor. - Build the role channel as
(1 - role) * gauss * γ_i + role * gauss * cos(2π·θ·t), modulated by the same θ envelope and (optionally) the same noise model. - Update the multiplexer tests: drop the
raises NotImplementedErrortest and add four tests (2-channel shape, channel-0 invariance, role/codes shape validation, γ/θ spectral separability).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
track_p/multiplexer.py |
Adds out-of-band role channel generation and shape validation; updates docstring. |
tests/unit/test_multiplexer.py |
Replaces deferred-role test with four tests for shape, channel-0 invariance, validation, and γ/θ separability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- forward(): fail-fast ValueError when role tensor contains values
outside {0, 1} (PREDICTION/ERROR), with unique-values diagnostic.
Guard placed after the existing shape check, where role is
guaranteed non-None.
- demodulate(): raise ValueError with actionable hint (pass carrier[:,0])
when a 3-D [B, 2, T] carrier is passed; role-channel decoding is
not yet supported.
- Tests: add test_role_channel_zero_unchanged_under_noise (same RNG seed
on both forward calls) and test_forward_raises_on_invalid_role_values.
26/26 unit tests pass; 50/50 multiplex+gate_w non-regression pass.
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.
Implements the deferred role channel of GammaThetaMultiplexer.forward (issue #1 Q5).
When role is provided, forward returns a [B, 2, T] carrier:
Q5 arbitration resolved to out-of-band (not an in-band 32/32 alphabet split).
Tests: replaced the NotImplementedError test with four tests (2-channel shape, channel-0 invariance, role/codes shape validation, gamma/theta spectral separability). 24 multiplexer tests + full fast suite (531 passed) green; ruff + mypy clean.