"""Single entry point of the dark_companions study. python3 run_all.py # download (cached) + all analysis steps, about 2 minutes # (a first run also downloads about 160 MB, 20-40 minutes) python3 run_all.py --fresh # delete the raw cache first and re-download everything Raw catalogues are cached in fermi_raw/dark_companions (override with the environment variable DARKCOMP_RAW). Every number and figure of the report is regenerated in ../data and ../figures. """ import os import shutil import subprocess import sys import time HERE = os.path.dirname(os.path.abspath(__file__)) STEPS = ["01_download.py", "02_ir_detectability.py", "02b_w4_dark_counts.py", "03_dark_census.py", "04_wise_test.py", "05_oort.py", "06_microlensing.py", "07_synthesis.py"] def main(): if "--fresh" in sys.argv: sys.path.insert(0, HERE) from common import RAW # remove the cached downloads, but never a reviewer's scratch directory kept under RAW for name in os.listdir(RAW): if name in ("referee", "pdf_rev"): continue path = os.path.join(RAW, name) shutil.rmtree(path, ignore_errors=True) if os.path.isdir(path) else os.remove(path) t0 = time.time() for s in STEPS: print(f"\n===== {s} =====", flush=True) t1 = time.time() subprocess.run([sys.executable, os.path.join(HERE, s)], check=True, cwd=HERE) print(f"----- {s} done in {time.time() - t1:.0f} s", flush=True) print(f"\nall steps done in {time.time() - t0:.0f} s") if __name__ == "__main__": main()