Analyze QFT experiment results from RunHistory files. Computes particle masses and fundamental constants using multiple mass scale anchors (electron, Z boson, tau), validates against Standard Model values, and generates comprehensive comparison reports. Use when analyzing QFT simulation results or validating calibrations.
Orchestrate QFT experiment analysis, calibration validation, and multi-run comparison workflows.
Process QFT experiment RunHistory files to:
You orchestrate these existing Python scripts:
src/experiments/calibrate_fractal_gas_qft.py - Maps SM constants → algorithmic parameterssrc/experiments/analyze_fractal_gas_qft.py - Computes particle masses & observables from RunHistorysrc/experiments/constants_check.py - Reference SM constants for validation| Anchor | Mass (GeV) | Label | Use Case |
|---|---|---|---|
| Electron | 0.000510998950 | electron | Light fermion scale |
| Z Boson | 91.1876 | z | Electroweak scale (default) |
| Tau | 1.77686 | tau | Heavy lepton scale |
| Custom | User-specified | User-set | Experimental (e.g., Higgs: 125.1) |
From src/experiments/constants_check.py:
Extract parameters from $ARGUMENTS:
History Path:
--history-path <path> - Single file, glob pattern, or omit for auto-detect latestoutputs/my_run_history.pt (single file)"outputs/sweep_*.pt" (glob pattern - quote it!).pt file in outputs/Anchors:
--anchors <list> - Comma-separated: electron,z,tau,custom,allz (Z boson scale)all expands to electron,z,tau (+ custom if provided)Custom Anchor:
--anchor-mass <float> - Required if custom in anchors--anchor-label <string> - Default: "Custom"Optional Flags:
--no-particles - Skip particle mass computation (faster, field correlations only)--particle-max-lag <int> - Override default lag points--particle-fit-stop <int> - Override default fit rangeExample Parsing:
$ARGUMENTS = "--history-path outputs/sweep_*.pt --anchors z,electron"
→ history_pattern = "outputs/sweep_*.pt"
→ anchors = ["z", "electron"]
Before running analysis:
Ensure output directories exist:
mkdir -p outputs/qft_calibration
mkdir -p outputs/fractal_gas_potential_well_analysis
mkdir -p outputs/qft_analysis_reports
Resolve history files:
# If glob pattern
ls outputs/sweep_*.pt
# If auto-detect latest
ls -t outputs/*history*.pt | head -1
Verify all files exist and are readable.
Validate custom anchor:
If custom in anchors and no --anchor-mass, error:
Error: --anchor-mass required when using custom anchor
Example: /qft-analysis --anchors custom --anchor-mass 125.1 --anchor-label Higgs
Verify scripts are executable:
python src/experiments/calibrate_fractal_gas_qft.py --help >/dev/null 2>&1
For each (history_file, anchor) pair:
Generate unique run_id:
Format: <anchor_label>_<timestamp>
Example: z_boson_170125
Map anchor to mass/label:
ANCHORS = {
'electron': (0.000510998950, 'Electron'),
'z': (91.1876, 'Z_Boson'),
'tau': (1.77686, 'Tau'),
'custom': (user_mass, user_label)
}
Run calibration:
python src/experiments/calibrate_fractal_gas_qft.py \
--history-path <history_file> \
--m-gev <anchor_mass> \
--scale-label <anchor_label> \
--run-id <unique_run_id> \
--qsd-iter 4
Output location:
outputs/qft_calibration/<run_id>_calibration.json
Error Handling:
For each unique history file (once per file, not per anchor):
Generate unique analysis_id:
Format: <basename>_<timestamp>
Example: sweep_nu10_170125
Build command:
python src/experiments/analyze_fractal_gas_qft.py \
--history-path <history_file> \
--analysis-id <unique_analysis_id> \
--compute-particles \
--build-fractal-set \
--particle-operators "baryon,meson,glueball" \
--use-connected \
--use-local-fields
Optional flags (based on user input):
--no-particles: Omit --compute-particles and particle-related flags--particle-max-lag N: Add --particle-max-lag N--particle-fit-stop N: Add --particle-fit-stop NOutput location:
outputs/fractal_gas_potential_well_analysis/<analysis_id>_metrics.json
Error Handling:
Load calibration JSONs:
For each successful calibration, read JSON from outputs/qft_calibration/<run_id>_calibration.json:
Key fields:
{
"algorithmic_parameters": {
"epsilon_c": float,
"epsilon_d": float,
"rho": float,
"tau": float,
"nu": float,
"epsilon_F": float
},
"couplings": {
"e_em": float,
"g1": float,
"g2": float,
"g3": float,
"sin_theta_w": float,
"cos_theta_w": float
},
"inputs": {
"constants": {
"alpha_em": float,
"sin2_theta_w": float,
"alpha_s": float,
"scale_label": string
},
"calibration": {
"m_gev": float,
"lambda_gap": float
}
},
"stability": {
"stable": bool,
"alive_fraction": float,
"finite_positions": bool,
"finite_velocities": bool,
"finite_fitness": bool
},
"qsd_estimates": {
"samples": int
}
}
Compute gauge couplings from couplings:
Load analysis JSONs:
For each analysis, read JSON from outputs/fractal_gas_potential_well_analysis/<analysis_id>_metrics.json:
Key fields (may be nested deeper):
{
"particle_masses": {
"meson": {"mass": float, "r_squared": float},
"baryon": {"mass": float, "r_squared": float},
"glueball": {"mass": float, "r_squared": float}
},
"correlations": {
"d_prime": {"xi": float, "r_squared": float},
"r_prime": {"xi": float, "r_squared": float},
"density": {"xi": float},
"kinetic": {"xi": float}
},
"lyapunov_ratio": float,
"plots": {
"correlations": string,
"wilson_loops": string
}
}
Note: The actual JSON structure may be nested. Navigate carefully and handle missing fields.
Match calibrations to analyses:
Display these five tables in the terminal:
QFT Analysis Run Summary
========================
| Run ID | History File | Anchor | Stable | Alive % | QSD Samples |
|---------------------|-------------------------------|-----------|--------|---------|-------------|
| electron_170125 | sweep_nu10_history.pt | Electron | ✓ | 100.0% | 200 |
| z_boson_170125 | sweep_nu10_history.pt | Z Boson | ✓ | 100.0% | 200 |
| tau_170125 | sweep_nu10_history.pt | Tau | ✓ | 100.0% | 200 |
Data sources:
inputs.calibration or commandinputs.constants.scale_labelstability.stable == true, ✗ otherwisestability.alive_fraction * 100qsd_estimates.samplesGauge Coupling Validation
=========================
(Input couplings should match exactly; validates inversion formulas)
| Run ID | Anchor | α_em | sin²θ_W | α_s | Match Quality |
|-----------------|-----------|-----------|-----------|----------|---------------|
| electron_170125 | Electron | 0.007297 | 0.2312 | 0.1179 | ✓✓✓ Exact |
| z_boson_170125 | Z Boson | 0.007297 | 0.2312 | 0.1179 | ✓✓✓ Exact |
| tau_170125 | Tau | 0.007297 | 0.2312 | 0.1179 | ✓✓✓ Exact |
Data sources:
inputs.constantsMatch Quality:
def match_quality(alpha_em, sin2_theta_w, alpha_s):
ref = {"alpha_em": 0.007297352564, "sin2_theta_w": 0.23121, "alpha_s": 0.1179}
max_error = max(
abs(alpha_em - ref["alpha_em"]) / ref["alpha_em"],
abs(sin2_theta_w - ref["sin2_theta_w"]) / ref["sin2_theta_w"],
abs(alpha_s - ref["alpha_s"]) / ref["alpha_s"]
)
if max_error < 0.001: return "✓✓✓ Exact"
if max_error < 0.01: return "✓✓ Good"
if max_error < 0.05: return "✓ Fair"
return "✗ Poor"
Algorithmic Parameters by Anchor
=================================
| Parameter | Electron Scale | Z Boson Scale | Tau Scale | Physical Meaning |
|-----------|----------------|---------------|-----------|----------------------------|
| ε_c | 1.684 | 1.684 | 1.684 | Clone coupling scale |
| ε_d | 2.799 | 2.799 | 2.799 | Distance coupling scale |
| ρ | 1742.9 | 0.0096 | 0.540 | Mass-field coupling |
| τ | 0.000725 | 1317.8 | 0.833 | Time scale |
| ν | 84.5 | 84.5 | 84.5 | Viscosity parameter |
| ε_F | 0.00557 | 10123 | 63.9 | Fermion mass scale |
Data sources:
algorithmic_parametersFormatting:
Physical meanings (hardcoded):
PARAM_MEANINGS = {
"epsilon_c": "Clone coupling scale",
"epsilon_d": "Distance coupling scale",
"rho": "Mass-field coupling",
"tau": "Time scale",
"nu": "Viscosity parameter",
"epsilon_F": "Fermion mass scale"
}
Particle Mass Predictions
=========================
| Run ID | Anchor | Meson Mass | Meson R² | Baryon Mass | Baryon R² | Glueball Mass | Glueball R² | Quality |
|-----------------|----------|------------|----------|-------------|-----------|---------------|-------------|------------|
| electron_170125 | Electron | 70.0 | 0.128 | 60.2 | 0.178 | 3.37 | 0.243 | Poor |
| z_boson_170125 | Z Boson | 63.9 | 0.867 | 58.4 | 0.791 | 3.21 | 0.682 | Good |
| tau_170125 | Tau | 65.1 | 0.654 | 59.3 | 0.612 | 3.28 | 0.571 | Fair |
Data sources:
particle_masses.{meson,baryon,glueball}Quality Scoring:
def particle_quality(r2_meson, r2_baryon, r2_glueball):
avg_r2 = (r2_meson + r2_baryon + r2_glueball) / 3
if avg_r2 > 0.8: return "Excellent"
if avg_r2 > 0.5: return "Good"
if avg_r2 > 0.3: return "Fair"
return "Poor"
Missing data:
--no-particles used, show "N/A" for all masses/R²Correlation & Field Diagnostics
================================
| Run ID | d_prime ξ | d_prime R² | r_prime ξ | r_prime R² | Density ξ | Kinetic ξ | Lyapunov Ratio |
|-----------------|-----------|------------|-----------|------------|-----------|-----------|----------------|
| electron_170125 | 0.0 | 0.0 | 0.426 | 0.973 | 0.125 | 0.016 | 0.0084 |
Data sources:
correlations and lyapunov_ratioNote: Correlation length ξ indicates spatial structure strength. R² indicates exponential fit quality.
Compute overall quality:
1. Stability Check:
all_stable = all(cal["stability"]["stable"] for cal in calibrations)
unstable_runs = [cal["run_id"] for cal in calibrations if not cal["stability"]["stable"]]
2. Particle Fit Quality:
r2_values = []
for analysis in analyses:
for operator in ["meson", "baryon", "glueball"]:
if operator in analysis["particle_masses"]:
r2_values.append(analysis["particle_masses"][operator]["r_squared"])
avg_particle_r2 = sum(r2_values) / len(r2_values) if r2_values else 0
if avg_particle_r2 > 0.8: particle_quality = "EXCELLENT"
elif avg_particle_r2 > 0.5: particle_quality = "GOOD"
elif avg_particle_r2 > 0.3: particle_quality = "MODERATE"