cosmocore.spectrum_key module
Canonical key types for spectra and Fisher blocks. Defines
SpectrumKey, the structural SpectrumKind enum (ordered
slot pairs), and the SymmetryMode flag controlling how
cross-component E/B spectra are emitted. CMB-friendly aliases
(TT/EE/BB/EB/BE/TE/ET/TB/BT) live in
cosmocore.conventions.cmb.
- class cosmocore.spectrum_key.SymmetryMode(*values)[source]
Bases:
EnumHow cross-component spin-2 × spin-2 EB-like spectra are treated.
SYMMETRIC (default) — emits one combined GC spectrum per cross-pair; the Lambda model uses a single C_EB in both off-diagonal blocks. Standard cosmology (C_EB = 0) makes this numerically identical to DIRECTIONAL.
DIRECTIONAL — emits both GC (E_i × B_j) and CG (B_i × E_j) as separate spectra. Lambda uses C_GC and C_CG independently. Opt-in for polarisation angle calibration diagnostics and parity-violation searches. See ADR-0011.
- SYMMETRIC = 'symmetric'
- DIRECTIONAL = 'directional'
- class cosmocore.spectrum_key.Slot(label, spin)[source]
Bases:
EnumSub-mode within a spin-s component.
S = scalar (spin-0 field’s only slot; CMB alias: T). G = gradient (parity-even slot of a spin-2 field; CMB alias: E). C = curl (parity-odd slot of a spin-2 field; CMB alias: B).
- S = ('S', 0)
- G = ('G', 2)
- C = ('C', 2)
- class cosmocore.spectrum_key.SpectrumKind(slot_i, slot_j)[source]
Bases:
EnumDirectional spectrum kind: an ordered slot pair (slot_i, slot_j).
Nine values cover every (slot_i, slot_j) reachable from spin-0 and spin-2 components. Asymmetry is preserved (SG != GS, GC != CG); whether to collapse to a symmetric average is a separate decision driven by the SymmetryMode flag on Spectra/Fisher.
- SS = (Slot.S, Slot.S)
- GG = (Slot.G, Slot.G)
- CC = (Slot.C, Slot.C)
- GC = (Slot.G, Slot.C)
- CG = (Slot.C, Slot.G)
- SG = (Slot.S, Slot.G)
- GS = (Slot.G, Slot.S)
- SC = (Slot.S, Slot.C)
- CS = (Slot.C, Slot.S)
- class cosmocore.spectrum_key.SpectrumKey(comp_i, comp_j, kind, *, spins=None)[source]
Bases:
objectIdentifier for one cross/auto power spectrum.
Passive identifier — does not symmetrise, canonicalise, or perform algebra. Constructor validates that kind’s required spins match the actual spins at comp_i and comp_j.
-
kind:
SpectrumKind
-
kind:
- cosmocore.spectrum_key.kind_to_legacy_mode(kind, *, is_cross=False)[source]
Bridge for migration: map SpectrumKind to the legacy int mode.
For spin-2 × spin-2 the mode→kind mapping is context-dependent and must match
_spin_pair_mode_to_kind(above) in this module:Auto-pair (
is_cross=False, default):[GG=0, CC=1, GC=2]. CG has no slot here — auto-pair derivative builders emit the symmetrised GC matrix and never distinguish E_i B_j from B_i E_j.Cross-pair (
is_cross=True):[GG=0, GC=1, CG=2, CC=3]— the 4-entry ordering used byPolarizationField.get_cross_spectrum_labelsand DIRECTIONAL-mode derivative construction.
All other spin pairs have a single ordering independent of
is_cross.- Return type: