#!/bin/bash
# ONE-COMMAND reproduction of the DFD-vs-ΛCDM frozen-parameter cosmology comparison.
# Usage:  bash reproduce.sh        (from the DFD_CLASS_verification directory)
# Env:    python3.11+, numpy>=2.4, scipy>=1.17, camb==1.6.6 ; for the joint fit also: the fetched data.
set -e
cd "$(dirname "$0")"; export PYTHONPATH="$PWD"

echo "############################################################################"
echo "# DFD vs ΛCDM — frozen-parameter cosmology, NO refits.  Honest claim:"
echo "#   DFD has passed the global-competitiveness test; not the unique-confirmation test."
echo "############################################################################"

echo; echo "===== 1. FROZEN PARAMETERS (every DFD number derived/inherited/fitted) ====="
echo "      (full provenance table: README_VERIFICATION.md sec. 5; values: dfd_params.py)"
python3 - <<'PY'
import dfd_params
for k in sorted(vars(dfd_params)):
    if not k.startswith('_'): print(f"  {k} = {getattr(dfd_params,k)!r}")
PY

echo; echo "===== 2. PARAMETER-COUNT SENSITIVITY (hidden-knobs objection, counted openly) ====="
echo "      (uses the reproducible frozen per-probe chi^2; no data download needed)"
python3 paramcount_sensitivity.py

echo; echo "===== 3. FULL JOINT LIKELIHOOD (re-runs CAMB; needs the fetched data) ====="
if [ -f planck_campaign_data/planck_2018_pliklite_native/plik_lite_v22.dataset ] && [ -f pantheon_data/PantheonPlusSH0ES.dat ]; then
  python3 joint_fit.py
else
  echo "  [skipped] fetch data first:  bash planck_campaign_data/FETCH_DATA.sh   (+ Pantheon+ covariance)"
fi

echo; echo "Done.  Artifacts: DFD_Parameter_Ledger.md, FALSIFY.md."
