Appendix D — Reference Implementation & Test Script Inventory
I. One-line Aim
Provide a minimal, template-aligned (v0.1) reference implementation and a concrete list of test scripts—covering directory layout, entrypoints, configuration, execution, and audit rules—so that end-to-end flows for Catalog/Seeds/Trajectory, Phi_T/grad_Phi_T, L_nu/LC, n_eff, { ell_i }, Delta_T_sigma, {R_env,T_trans,A_sigma}, and both arrival-time forms T_arr/Delta_T_arr are deployable, reproducible, and auditable.
II. Scope & Non-Goals
- Covers: repository layout; minimal interfaces (Template API family → this volume’s I70-* mapping); benchmark scripts and their intent; CLI run examples; configuration samples; outputs & audit essentials; reproducibility workflow; security constraints.
- Not: device-level hardware code; private/closed libraries; anything beyond “minimal viable + dimensional safeguards.”
III. Directory Layout (recommended)
ref_eo/ # reference implementation root
core/ # physics & numerics core
catalog.py # I.Build.Catalog → build_early_object_catalog
seed.py # I.Build.Seeds|Triggers → seed_and_trigger
evolve.py # I.Build.* → evolve_object_state
sed.py # spectra/fields → synthesize_spectrum
transport.py # I.Arrival.Constant|General|Delta → predict_arrival_signature
interfaces.py # I.Interface.ApplyMatching|I.Path.Segment|I.Path.InterfaceCorrection
rt.py # I.RT.Estimate → estimate_energy_triplet
metrics.py # I.Consistency.*, I.Uncertainty.* (eta_T, tau_switch, GUM/MC)
io/
contract.py # Contract I/O + validation + DimReport
dataio.py # read/write Catalog/Seeds/Trajectory/SeaProfile/Path/Observations
hashing.py # content hashes for Catalog/Seeds/Trajectory/SeaProfile/Phi_T/n_eff/gamma/code
utils/
solvercfg.py # quadrature/step rules/concurrency policies
logger.py # I.Report.Log|Emit → log_artifacts_EO, emit_measurement_report
rng.py # seeded RNG for MC reproducibility
scripts/ # benchmarks & tests (see §V)
configs/ # runnable configs & samples (see §VII)
artifacts/ # results & audits (logs, reports, hash manifests, replay lists)
Naming isolation (hard-guard): never conflate T_fil with T_trans, nor n with n_eff. Every entry must pass n_eff ≥ 1 and dimensional checks at ingress.
IV. Core Interfaces (Template API Family → this volume I70-*)
- I.Build.Catalog → build_early_object_catalog(params) -> Catalog (I70-1)
- I.Build.Seeds|Triggers → seed_and_trigger(Phi_T, env, priors) -> Seeds (I70-2)
- I.Build. (evolution)* → evolve_object_state(O, env, tgrid) -> Trajectory (I70-3)
- I.Build.Phi / spectra → synthesize_spectrum(O, state, fgrid) -> L_nu (I70-4)
- I.Arrival.Constant|General|Delta →
predict_arrival_signature(n_eff, gamma, mode, c_ref) -> { T_arr, Delta_T_arr } (I70-6)
with mode ∈ {constant, general}; segmentation and Delta_T_sigma are provided at ingress or assembled with n_eff. - I.Interface.ApplyMatching / I.Path.Segment / I.Path.InterfaceCorrection →
detect_interfaces, segment_integrals, interface_correction_sea - I.RT.Estimate → estimate_energy_triplet(data, Sigma_env) -> { R_env, T_trans, A_sigma } (I70-7)
- I.Consistency.DualMode|ThinThick → check_dual_arrival_consistency, consistency_thin_vs_thick_EO
- I.Uncertainty.GUM|MC → propagate_uncertainty_GUM, propagate_uncertainty_MC
- I.Report.Log|Emit → log_artifacts_EO, emit_measurement_report
Unified constraints (all ingress): run check_dimension; enforce T_arr ≥ L_path / c_ref and R_env + T_trans + A_sigma = 1; include explicit segment endpoints { ell_i }; no cross-interface interpolation.
V. Script Inventory & Purpose (minimal set)
- scripts/run_catalog.py — build Catalog and environment refs (I.Build.Catalog).
- scripts/run_seed.py — sample Seeds/Triggers and persist (I.Build.Seeds|Triggers).
- scripts/run_evolve.py — advance Trajectory, log events (**I.Build.*`).
- scripts/run_spectrum.py — synthesize L_nu/LC (spectral).
- scripts/run_transport.py — assemble n_eff, segment, compute both T_arr/Delta_T_arr (I.Arrival. + I.Path.).
- scripts/run_interfaces.py — detect/match interfaces, apply Delta_T_sigma, estimate {R_env,T_trans,A_sigma} (I.Interface. + I.RT.Estimate*).
- scripts/run_dispersion.py — differential band analysis and n_path polynomial fit (I.Arrival.Delta).
- scripts/run_dual_consistency.py — two-form consistency eta_T (I.Consistency.DualMode).
- scripts/run_thin_vs_thick.py — thin/thick coherence tau_switch (I.Consistency.ThinThick).
- scripts/run_uncertainty_gum.py / scripts/run_uncertainty_mc.py — GUM/MC propagation & tail risk.
- scripts/run_report.py — consolidate logs & metrics, generate report & hash manifest.
VI. Run Examples (CLI)
Catalog → Seeds → Evolution (basics)
python scripts/run_catalog.py --contract configs/eo.contract.json --out artifacts/catalog/
python scripts/run_seed.py --contract configs/eo.contract.json --priors configs/priors.json --out artifacts/seeds/
python scripts/run_evolve.py --contract configs/eo.contract.json --catalog artifacts/catalog/catalog.json --seeds artifacts/seeds/sd.json --out artifacts/traj/
Spectra → Transport → Consistency
python scripts/run_spectrum.py --contract configs/eo.contract.json --traj artifacts/traj/trajectory.jsonl --fgrid configs/fgrid.json --out artifacts/sed/
python scripts/run_transport.py --contract configs/eo.contract.json --path paths/p001.path.jsonl --phi fields/phi_t.zarr --gphi fields/grad_phi_t.zarr --sea seaprofile/sea.v1.json --out artifacts/transport/
python scripts/run_dual_consistency.py --contract configs/eo.contract.json --path paths/p001.path.jsonl --neff fields/neff.zarr --cref calib/c_ref.json --out artifacts/consistency/
Differential / Thin–Thick / Uncertainty
python scripts/run_dispersion.py --contract configs/eo.contract.json --obs obs/p001.obs.jsonl --fgrid configs/fgrid.json --out artifacts/dispersion/
python scripts/run_thin_vs_thick.py --contract configs/eo.contract.json --path paths/p001.path.jsonl --sea seaprofile/sea.v1.json --out artifacts/switch/
python scripts/run_uncertainty_gum.py --contract configs/eo.contract.json --inputs artifacts/transport/results.json --out artifacts/uncertainty/gum/
python scripts/run_uncertainty_mc.py --contract configs/eo.contract.json --inputs artifacts/transport/results.json --nsamples 20000 --seed 20250905 --out artifacts/uncertainty/mc/
Reporting
python scripts/run_report.py --manifest artifacts/manifest.json --out artifacts/report/
VII. Sample Config (minimal)
configs/eo.contract.json
configs/priors.json
configs/solver.eo.json
configs/fgrid.json
VIII. Outputs & Audit (minimum set)
- Results: results.json (contains T_arr/Delta_T_arr, optional Delta_T_sigma, eta_T, tau_switch, primary hashes, and SolverCfg/metric_spec snapshot).
- Audit: audit.log (dimension checks, form selection, step & error stats, interface triggers, energy-consistency margins, clamp rates).
- Hashes: hashes.json (content hashes of Catalog/Seeds/Trajectory/SeaProfile/Phi_T/n_eff/gamma/code).
- Report: report.md (metric panels, falsification samples, replay commands, environment & versions).
IX. Reproducibility (one-click replay)
- Freeze artifacts/manifest.json (includes Contract; Catalog/Seeds/Trajectory; SeaProfile/Path; Fields/Neff; SolverCfg/metric_spec; seed; all hashes).
- Execute:
python scripts/run_report.py --manifest artifacts/manifest.json --out artifacts/report/
- Verify that the new hashes.json matches the frozen one; any mismatch ⇒ replay failure with a diff summary.
X. Security & Integrity
- Read-only inputs: mount /contracts, /obs, /interfaces as read-only to prevent tampering.
- Dimensional guard: every script gates on check_dimension; failures hard-fail and log.
- Naming isolation: forbid mapping T_fil ↔ T_trans, n ↔ n_eff.
- Seeded randomness: MC scripts accept --seed and persist the seed in logs.
XI. Template API Family Quick Map (anchored to template v0.1)
- Build: I.Build.Catalog|Seeds|Trajectory|Phi|Neff
- Path: I.Path.Capture|Segment|InterfaceCorrection
- Arrival: I.Arrival.Constant|General|Delta
- Interface/Energy: I.Interface.ApplyMatching, I.RT.Estimate
- Consistency/Uncertainty: I.Consistency.DualMode|ThinThick, I.Uncertainty.GUM|MC
- Reporting: I.Report.Log|Emit
Engineering mapping: see this volume’s I70-* roster in §IV.
XII. Cross-References
- EFT.WP.Cosmo.EarlyObjects v1.0: Ch. 3–10, 11–12 (objects, causation, growth, radiation, propagation, metrology, interfaces, numerics, validation & errors).
- Template v0.1: API family & I/O contract layering.
- Cosmo.LayeredSea v1.0: segmentation, matching, and consistency.
- Propagation.TensionPotential v1.0: two-form arrival & differential flows.
- Core. suite: Equations / Metrology / Errors.
XIII. Deliverables
- Minimal reference skeleton (ref_eo/core|io|utils) plus test script set (scripts/).
- Runnable config samples (configs/) and benchmark path/observation placeholders.
- Audit & replay templates (artifacts/: results.json, audit.log, hashes.json, report.md, manifest.json).