Merge branch 'phase2-secondary-prediction' into 4-prototype-a-mixture-of-experts-routing-tree-architecture
Brings in the rollout-validation fixes developed alongside Phase 2 (exact e_sec budget rescaling in decode_secondaries, filtering synthetic termination rows out of load_rollout_vs_truth, Tier 4 truth overlay, --energy-gev support in dwarf make-root) and reconciles them with this branch's mixture-of-experts routing work: build_features/ build_models/dataset plumbing keep the ProcessRouter's proc_map/ proc_idx threading, and create_root_files.py's job_seed folds in both the per-job seed derivation and the new energy_gev component.
This commit is contained in:
@@ -263,6 +263,14 @@ def _minimal_step_data(N: int, process: np.ndarray | None = None) -> dict:
|
||||
return data
|
||||
|
||||
|
||||
def _step_data_no_sec_lists(n_sec: np.ndarray) -> dict:
|
||||
"""Minimal build_features input with n_sec but no per-secondary list columns
|
||||
(mimics a parquet that skipped the parent->child join)."""
|
||||
data = _minimal_step_data(len(n_sec))
|
||||
data["n_sec"] = np.asarray(n_sec, dtype=np.int32)
|
||||
return data
|
||||
|
||||
|
||||
def test_build_features_proc_idx_zero_without_proc_map():
|
||||
data = _minimal_step_data(3, process=np.array(["compt", "phot", "eIoni"], dtype=object))
|
||||
pdg_map, mat_map = {11: 0}, {"PbWO4": 0}
|
||||
@@ -287,8 +295,7 @@ def test_build_features_require_secondaries_raises_when_lists_missing():
|
||||
through the parent->child join; require_secondaries must catch it instead of
|
||||
silently zeroing every Stage-2 target (regression: this collapsed the
|
||||
secondary species to a single PDG index during training)."""
|
||||
data = _minimal_step_data(3)
|
||||
data["n_sec"] = np.array([0, 2, 1], dtype=np.int32) # secondaries, but no lists
|
||||
data = _step_data_no_sec_lists(np.array([0, 2, 1]))
|
||||
pdg_map, mat_map = {11: 0}, {"PbWO4": 0}
|
||||
|
||||
with pytest.raises(ValueError, match="per-secondary columns"):
|
||||
@@ -298,7 +305,7 @@ def test_build_features_require_secondaries_raises_when_lists_missing():
|
||||
def test_build_features_require_secondaries_ok_when_no_secondaries():
|
||||
"""require_secondaries only fires when secondaries actually exist; a file
|
||||
with n_sec == 0 everywhere (e.g. Stage-1-only) must still load."""
|
||||
data = _minimal_step_data(3) # n_sec all zero
|
||||
data = _step_data_no_sec_lists(np.zeros(3, dtype=np.int32))
|
||||
pdg_map, mat_map = {11: 0}, {"PbWO4": 0}
|
||||
|
||||
_, _, _, _, sec_cont, sec_pdg_idx, *_ = build_features(
|
||||
|
||||
Reference in New Issue
Block a user