#!/bin/bash
# Full English rerun of the 3.9 self-tuning and gate experiment. Each step logs to runs_en_*.out; rerunning skips finished steps.
cd "$(dirname "$0")"
P=<workspace>/.venv/bin/python
step() { local tag=$1; shift; [ -f "done_en_$tag" ] && { echo "skip $tag"; return; }; echo "start $tag $(date)"; "$@" > "runs_en_$tag.out" 2>&1 && touch "done_en_$tag" && echo "done $tag $(date)"; }
step noise_v0 $P noise.py en skill_v0_en.md
for v in ungated gatedstrict gated gatedavg; do
  flag=""; [ $v = gatedstrict ] && flag=--gate-strict; [ $v = gated ] && flag=--gate; [ $v = gatedavg ] && flag=--gate-avg
  for s in 1 2 3; do step ${v}_$s $P autotune.py en $s $flag & done; wait
done
step noise_r02 $P noise.py en runs/en_ungated_1/skill_r02.md
step final $P final_eval.py en
step curve $P curve_reeval.py en
echo ALL DONE $(date)
