#!/usr/bin/env bash # verify_all.sh [PxCy ...] -- run verify_alignment.py --expect 0 over captures, sequentially. # # Passes a real capture DIRECTORY, which is what verify_alignment.py needs. Passing a bare # capture name used to fail as `FileNotFoundError: /cameras.json`, which reads like a # misalignment but is just a bad argument; the script now resolves bare names too, and this # wrapper passes the resolved path explicitly. # # Writes one log per capture plus a summary table. # setsid nohup ./scripts/verify_all.sh > logs/verify.log 2>&1 < /dev/null & set -uo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BASE="$(dirname "$HERE")" STAGING="${STAGING:-$BASE/staging}" PY="${PY:-/home/szj/miniconda3/envs/omni_pose/bin/python}" LOGDIR="$BASE/logs"; mkdir -p "$LOGDIR" CAPTURES=("$@") if [ ${#CAPTURES[@]} -eq 0 ]; then CAPTURES=(P1C1 P1C2 P2C1 P2C2 P3C1 P3C2 P4C1 P4C2 P5C2 P6C2) fi STAMP="$(date +%Y%m%d_%H%M%S)" SUM="$LOGDIR/verify_summary_${STAMP}.txt" : > "$SUM" for c in "${CAPTURES[@]}"; do log="$LOGDIR/verify_${c}_${STAMP}.log" d="$STAGING/data/$c" if [ ! -f "$d/cameras.json" ]; then printf '%-6s NOT_STAGED\n' "$c" | tee -a "$SUM"; continue fi timeout 3600 "$PY" "$HERE/verify_alignment.py" "$d" --cams 6 12 --expect 0 > "$log" 2>&1 rc=$? best=$(grep -o 'MEASURED: video_frame = fit_frame + ([+-][0-9]*)' "$log" | tail -1 \ | grep -o '[+-][0-9]*' | tail -1) marg=$(grep -o 'margin over d=[+-][0-9]*: [0-9.]*' "$log" | tail -1 | awk '{print $NF}') case $rc in 0) verdict="PASS d=${best:-?}" ;; 1) verdict="FAIL d=${best:-?} (expected +0)" ;; 2) verdict="INCONCLUSIVE d=${best:-?}" ;; 124) verdict="TIMEOUT" ;; *) verdict="ERROR rc=$rc" ;; esac printf '%-6s %-28s margin=%-7s %s\n' "$c" "$verdict" "${marg:-n/a}" "$log" | tee -a "$SUM" done echo "VERIFY DONE" | tee -a "$SUM"