Files
MeltMind/docs/multigate-features-README.md
T

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 to gre24_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 if fimpy/sklearn/scipy are unavailable). For K=1, features, Dw, Di, Df, Vf, mass, and all_wall_tet_ids are byte-identical to gre24_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_gate alias): int64 in 0..K-1 (smallest-index tie-break), plus gate_tie_mask_di / gate_tie_mask_df for exact symmetry/weld-front ties.
  • Perturbation locality: moving gate k leaves Dw, other gates' Di_per_gate[:, j] / Df_per_gate[:, j] (j \ne k), and Di / Df / nearest_gate outside gate $k$'s old/new arrival basin byte-identical. (Vf is a global volume CDF over Df and 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.