"""Download every raw input (cached under RAW; rerun with --fresh to force). 1. OGLE-II bulge DIA catalogue of candidate variables (Wozniak et al. 2002), 4-season FITS tables, 49 fields x (catalogue + light-curve database) ~1.9 GB 2. OGLE-II bulge VI photometric maps (Udalski et al. 2002), 49 fields ~0.83 GB 3. Gaia DR3 bright stars (G < 12.5) over the OGLE-II bulge area (for the artefact test) 4. Gaia Photometric Science Alerts index (alerts.csv) 5. OGLE-IV microlensing optical depth / event rate per field and star counts per subfield (Mroz et al. 2019, VizieR J/ApJS/244/29, tables "fields" and "table5") 6. Mamajek mean dwarf sequence (mass-luminosity relation) 7. One subframe of each OGLE-II DIA reference image (49 x 0.1 MB): its header names one of the frames stacked into the reference image, used to check the recovered reference epochs 8. OGLE Collection of Variable Stars, eclipsing binaries toward the bulge (Soszynski et al. 2016): ident.dat and ecl.dat (75 MB), for the catalogue-inclusion test """ import os import sys from common import RAW, OGLE_FTP, GAIA_TAP, VIZIER_TAP, fetch, tap_sync FRESH = "--fresh" in sys.argv def get(url, path, **kw): if FRESH and os.path.exists(path): os.remove(path) return fetch(url, path, **kw) def tap_to(path, base, adql, min_bytes=1000): if FRESH or not os.path.exists(path) or os.path.getsize(path) < min_bytes: blob = tap_sync(base, adql) if len(blob) < min_bytes: raise RuntimeError(f"TAP query returned too little data for {path}: {blob[:200]!r}") with open(path, "wb") as f: f.write(blob) return path def main(): dia = os.path.join(RAW, "ogle2_dia") maps = os.path.join(RAW, "ogle2_maps") base = OGLE_FTP + "/ogle2/bulge_dia_variables/fits_tables/SEASONS_1997_to_2000" for i in range(1, 50): for k in ("cat4", "db4"): get(f"{base}/bul_sc{i}_{k}.fts", os.path.join(dia, f"bul_sc{i}_{k}.fts"), min_bytes=2880) get(f"{OGLE_FTP}/ogle2/maps/bulge/bul_sc{i}.map.gz", os.path.join(maps, f"bul_sc{i}.map.gz"), min_bytes=1000) get(f"{OGLE_FTP}/ogle2/bulge_dia_variables/reference_frames/bul_sc{i}/ref_1_1_u.fts.gz", os.path.join(RAW, "ogle2_ref", f"sc{i}_ref_1_1_u.fts.gz"), min_bytes=2880) print(f"[download] OGLE-II field {i}/49 ok", flush=True) tap_to(os.path.join(RAW, "gaia_bright_bulge.csv"), GAIA_TAP, "SELECT source_id,ra,dec,phot_g_mean_mag,phot_rp_mean_mag,bp_rp FROM gaiadr3.gaia_source " "WHERE ra BETWEEN 261 AND 277 AND dec BETWEEN -41 AND -21 AND phot_g_mean_mag<12.5") print("[download] Gaia bright stars ok") get("https://gsaweb.ast.cam.ac.uk/alerts/alerts.csv", os.path.join(RAW, "gaia_alerts.csv"), min_bytes=100000) print("[download] Gaia alerts ok") tap_to(os.path.join(RAW, "mroz2019_fields.csv"), VIZIER_TAP, 'SELECT * FROM "J/ApJS/244/29/fields"') tap_to(os.path.join(RAW, "mroz2019_table5.csv"), VIZIER_TAP, 'SELECT * FROM "J/ApJS/244/29/table5"') print("[download] Mroz+2019 OGLE-IV tables ok") for name in ("ident.dat", "ecl.dat"): get(f"{OGLE_FTP}/ogle4/OCVS/blg/ecl/{name}", os.path.join(RAW, "ocvs", name), min_bytes=10_000_000, timeout=1800) print("[download] OGLE eclipsing-binary catalogue ok") get("https://www.pas.rochester.edu/~emamajek/EEM_dwarf_UBVIJHK_colors_Teff.txt", os.path.join(RAW, "mamajek_dwarf.txt"), min_bytes=5000) print("[download] Mamajek table ok") if __name__ == "__main__": main()