#!/usr/bin/env bash
set -euo pipefail

# Keep numerical libraries from over-spawning threads on reviewer machines/CI.
export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1}
export OPENBLAS_NUM_THREADS=${OPENBLAS_NUM_THREADS:-1}
export MKL_NUM_THREADS=${MKL_NUM_THREADS:-1}
export NUMEXPR_NUM_THREADS=${NUMEXPR_NUM_THREADS:-1}
export MPLBACKEND=${MPLBACKEND:-Agg}

python -u scripts/01_make_clean_sparc.py --root .
python -u scripts/02_run_phase_tuner.py --root .
python -u scripts/03_run_phase_correlations.py --root .
python -u scripts/04_run_lensing_base.py --root .
python -u scripts/05_run_real_lensing_pilots.py --root .
python -u scripts/06_run_bullet_centroid_deflection_proxy.py --root .
python -u scripts/07_build_benchmark_matrix.py --root .

echo "RBFL/RBFT reproducibility pipeline completed."
