2.3 KiB
2.3 KiB
Multi-Gate Feature Builder (MULTIGATE-FEATURES-1122)
Extends the frozen 19-column tools/gre24_features_v2.py builder to K \ge 1 gates without modifying gre24_features_v2.py. Code and synthetic CPU tests only; no real data, no GPU, no push to main.
Files
tools/multigate_features.py: multi-gate feature builder (features,pack_multigate_features) plus pure-NumPy geometry/gradient/moment helpers for minimal CPU test environments.tools/test_multigate_features.py: CPU synthetic tet-mesh tests (K=1 byte-identity, two-gate mirror symmetry, single-gate perturbation locality, K=3 packing, fail-closed guards).
Semantics & Compatibility
- Production default (
backend='production'): delegates directly togre24_features_v2.{mesh, exterior_faces, gate_nodes, solve_eikonal, cell_flow_speed, strict_volume_cdf, nodal_gradient, spatial_moment}in the exact same call order (fails closed iffimpy/sklearn/scipyare unavailable). ForK=1,features,Dw,Di,Df,Vf,mass, andall_wall_tet_idsare byte-identical togre24_features_v2.features. - Multi-gate outputs:
Di_per_gate,Df_per_gate:(N, K)raw geometric and wall-weighted flow arrival distances per gate.Di_per_gate_star = Di_per_gate / Di.max(),Df_per_gate_star = Df_per_gate / Df.max(): common-scale normalized per-gate channels preserving cross-gate ordering and symmetry.Di = min_k Di_per_gate,Df = min_k Df_per_gate,Vf = strict_volume_cdf(Df, mass): base 19 columns computed from(Df, Di, Dw).nearest_gate_di,nearest_gate_df(nearest_gatealias):int64in0..K-1(smallest-index tie-break), plusgate_tie_mask_di/gate_tie_mask_dffor exact symmetry/weld-front ties.
- Perturbation locality: moving gate
kleavesDw, other gates'Di_per_gate[:, j]/Df_per_gate[:, j](j \ne k), andDi/Df/nearest_gateoutside gate $k$'s old/new arrival basin byte-identical. (Vfis a global volume CDF overDfand therefore updates globally wherever the sorted volume rank shifts.)
Verification on Horsea
Run python -B tools/test_multigate_features.py in the Horsea fimpy/sklearn/scipy environment: test_single_gate_byte_identical_production_when_deps_available automatically runs live against gre24_features_v2.features and asserts exact .tobytes() equality.