#!/usr/bin/env python3 """Single entry point: regenerates every table and figure of the mir_quiescent study. python3 code/run_all.py # full run; downloads are cached in $MIRQ_RAW python3 code/run_all.py --no-download # reuse the download cache (fails if it is incomplete) python3 code/run_all.py --analysis-only # start from data/master_slim.csv.gz and data/model_grid.npz # (no catalogue service needed; add --no-images to skip everything # that needs image cut-outs: the vetting contact sheets, the # neighbour lists and the image-level profile-fit test, whose # tables in data/ are then reused as they are) Raw downloads go to fermi_raw/mir_quiescent (override with MIRQ_RAW); derived tables to data/, figures to figures/. Cold-cache runtime is dominated by the network (IRSA upload matches ~10-40 min, SDSS SkyServer ~20-40 min, NOIRLab Data Lab ~40-60 min, ~900 unWISE cut-outs ~10 min); with a warm cache the whole chain takes about 20 minutes single-threaded (limits and variants ~8 min, image-level test ~10 min). The only non-automatic input is code/vetting_manual.csv (visual classes of the 'clean' candidates, entered by hand after looking at the contact sheets written to $MIRQ_RAW/cutouts); it affects only data/limits_vetted.csv and the class labels in the candidate tables. data/report_numbers.txt collects the numbers quoted in report.md. Step order: download -> signal model -> master table -> image-level profile-fit response test (s09; writes data/psf_response_grid.csv, which the 'psf_response_*' variants of the limits step read) -> baseline -> limits and variants -> candidate accounting -> digest of numbers and limit curves -> figures. """ import sys import time def main(): t0 = time.time() args = set(sys.argv[1:]) import s01_download import s02_build import s03_model import s04_baseline import s05_limits import s06_vetting import s07_figures import s08_report_numbers import s09_image_injection images = "--no-images" not in args steps = [("download", s01_download.main), ("signal model", s03_model.main), ("build master table", s02_build.main), ("image-level profile-fit response test", s09_image_injection.main), ("baseline, photometry checks, caps, stacks", s04_baseline.main), ("sensitivity fractions, candidate counts, limits, variants", s05_limits.main), ("candidate accounting / vetting", lambda: s06_vetting.main(make_sheets=images, fetch_neighbours=images)), ("digest of numbers and limit curves", s08_report_numbers.main), ("figures", s07_figures.main)] skip = set() if "--no-download" in args or "--analysis-only" in args: skip.add("download") if "--analysis-only" in args: skip |= {"signal model", "build master table"} if not images: skip.add("image-level profile-fit response test") for name, fn in steps: if name in skip: continue print("\n==== %s ====" % name, flush=True) fn() print("---- %s done, %.0f s elapsed" % (name, time.time() - t0), flush=True) if __name__ == "__main__": main()