#!/bin/sh
# The study from the search's tables (data/run, data/run_dev).
# Registered steps: select the sample again from the catalogs and check it is the one searched;
# count the flares and compare them with the Kepler rate; locate each counted flare in its target
# pixel file and count again (results/*.json).
# Corrections after registration (deviations.json): require the SAP flux to move the same way as
# the event, and repeat the analysis without the events that fail (results/corrected/); search
# again every light curve under data/lc and compare every column of the tables.
# Exploratory: the counted flares' widths against recovered injections, their spread over stars,
# their Gaia neighbors, and the Kepler search emulated on flares of the assumed shape.
# collect.py gathers the declared results (R0 to R18).
set -eu
python code/verify_selection.py data/meta data results
python code/analyze.py data data/run results --set main
python code/counted.py results data/run results/counted_flares.csv
python code/localize.py results/counted_flares.csv data/tpf results/localization.csv
python code/analyze.py data data/run results --set main --localization results/localization.csv
python code/analyze.py data data/run_dev results/dev --set dev
python code/sap_sign.py data data/run results
python code/corrected.py data data/run results/corrected results/sap_sign.csv --localization results/localization.csv
python code/audit_all.py data data/run results
python code/width_check.py data data/run results results/corrected/primary.json
python code/exploratory.py data data/run results results/corrected/primary.json
python code/cadence_test.py data results
python code/collect.py results
