"""Build the data file for the pre-registered tests from the paper's own tables. Usage: python3 -I build_data.py Reads (as text, nothing compiled): - Table 4 (image rms), Table 5 (disk fits) and Table 6 (companion phases) from the arXiv v1 TeX source of Matthews et al. (2026); - the 13 points of Figure 13 as read from its vector drawing (extract_fig13.py); and adds the two literature epochs the paper plots in Figure 13, transcribed by hand from their own tables (locators below). Julian dates are computed from the calendar dates with the Fliegel-Van Flandern style integer formula (0h UT). """ import json import re import sys def jd0(y, m, d): """JD at 0h UT for a Gregorian date (valid 1901-2099).""" return 367 * y - (7 * (y + (m + 9) // 12)) // 4 + (275 * m) // 9 + d + 1721013.5 def num(s): s = s.strip().replace("$", "").replace("{", "").replace("}", "") s = s.replace("\\as", "") return float(s) def pm(s): """'11.4$\\pm$1.3 (0.01)' -> (11.4, 1.3, 0.01 or None).""" s = s.replace("$", "").replace("\\pm", "±") m = re.match(r"\s*([-\d.]+)\s*±\s*([-\d.]+)\s*(?:\(([-\d.]+)\))?", s) if not m: raise ValueError(s) return float(m.group(1)), float(m.group(2)), (float(m.group(3)) if m.group(3) else None) def table_body(tex, label): i = tex.find("\\label{" + label + "}") j = tex.find("\\end{tabular}", i) body = tex[i:j] k = body.find("\\hline", body.find("\\hline") + 1) # after header rule return body[k:] def main(): tex_path, fig_path, out_path = sys.argv[1:4] tex = open(tex_path, encoding="utf-8").read() # ---- Table 5 ------------------------------------------------------------- rows5 = [] body = table_body(tex, "tab:measurements") for line in body.split("\n"): line = line.split("%")[0].strip() if "&" not in line: continue cells = [c.strip() for c in line.rstrip("\\").split("&")] if len(cells) != 9 or not re.match(r"(\d{4}-\d\d-\d\d|\(Combined\))", cells[0]): continue S, Se, Sfit = pm(cells[2]) a, ae, _ = pm(cells[3]) b, be, _ = pm(cells[4]) pa, pae, _ = pm(cells[5]) e, ee, _ = pm(cells[6]) D = float(cells[7]) T, Te, _ = pm(cells[8].rstrip("\\").strip()) rows5.append({"date": cells[0], "nu": float(cells[1]), "S": S, "S_err": Se, "S_fit_err": Sfit, "theta_a": a, "theta_a_err": ae, "theta_b": b, "theta_b_err": be, "PA": pa, "PA_err": pae, "e": e, "e_err": ee, "D_au": D, "TB": T, "TB_err": Te}) # fill in the dates of the (Combined) rows from the rows just above them last = [] for r in rows5: if r["date"] == "(Combined)": r["combined_of"] = list(last) last = [] else: if last and abs(rows5[rows5.index(r) - 1]["nu"] - r["nu"]) > 1e-6: last = [] last.append(r["date"]) # ---- Table 4 ------------------------------------------------------------- rows4 = [] body = table_body(tex, "tab:newimages") for line in body.split("\n"): line = line.split("%")[0].strip() if "&" not in line: continue cells = [c.strip() for c in line.rstrip("\\").split("&")] if len(cells) < 7: continue try: rows4.append({"band": cells[0].replace("$", ""), "date": cells[1], "nu": float(cells[2]), "rms_uJy": float(cells[4])}) except ValueError: continue # ---- Table 6 ------------------------------------------------------------- rows6 = [] body = table_body(tex, "tab:siwarha") for line in body.split("\n"): line = line.split("%")[0].strip() if "&" not in line: continue cells = [c.strip().rstrip("\\").strip() for c in line.split("&")] if not re.match(r"\d{4}-\d\d-\d\d", cells[0]): continue rows6.append({"date": cells[0], "JD": float(cells[1]), "phase": float(cells[2]), "Theta_mas": float(cells[3].replace("$-$", "-").replace("$", "")), "direction": cells[4]}) # ---- dates -> JD for every Table 5 row ---------------------------------- def jd_of(date): y, m, d = (int(x) for x in date.split("-")) return jd0(y, m, d) for r in rows5: if r["date"] == "(Combined)": r["JD"] = sum(jd_of(d) for d in r["combined_of"]) / len(r["combined_of"]) else: r["JD"] = jd_of(r["date"]) if r["date"] == "2026-04-04": # observed 2026-04-04 23:26 to 04-05 01:13 UT (paper section 2.1) r["JD"] = jd0(2026, 4, 4) + (23 + 26 / 60 + 24 + 1 + 13 / 60) / 2 / 24 # ---- literature epochs plotted in Figure 13 ------------------------------- lit = [ {"source": "O'Gorman et al. 2017, A&A 602, L10, Table 1 (uniform elliptical disk of a multi-component fit)", "date": "2015-11-09", "JD": jd0(2015, 11, 9), "nu": 338.0, "theta_a": 57.8, "axis_ratio": 1.09, "axis_ratio_err": 0.01, "PA": 53.5, "PA_err": 0.4, "e_from_table": round(1 - 1 / 1.09, 4)}, {"source": "Matthews & Dupree 2022, ApJ 934, 131, Table 3 (uniform elliptical disk, 2019 Aug 2)", "date": "2019-08-02", "JD": jd0(2019, 8, 2), "nu": 22.0, "theta_a": 118.8, "theta_b": 114.5, "PA": 54.7, "PA_err": 5.2, "e_from_table": 0.04, "e_err_table": 0.07, "e_from_axes": round((118.8 - 114.5) / 118.8, 4), "S": 9.64, "S_err": 0.97, "TB": 2580, "TB_err": 260}, {"source": "Matthews & Dupree 2022, ApJ 934, 131, Table 3 (uniform elliptical disk, 2019 Aug 2)", "date": "2019-08-02", "JD": jd0(2019, 8, 2), "nu": 43.9, "theta_a": 96.9, "theta_b": 92.6, "PA": 111.0, "PA_err": 5.1, "e_from_table": 0.04, "e_err_table": 0.04, "e_from_axes": round((96.9 - 92.6) / 96.9, 4), "S": 22.34, "S_err": 2.41, "TB": 2270, "TB_err": 260}, ] fig = json.load(open(fig_path, encoding="utf-8")) out = {"table5": rows5, "table4": rows4, "table6": rows6, "literature": lit, "fig13": fig["markers"], "notes": "Built by build_data.py from the arXiv v1 TeX (Tables 4-6), Figure 13's vector paths, " "and two literature tables transcribed by hand."} with open(out_path, "w", encoding="utf-8", newline="\n") as f: json.dump(out, f, indent=1, ensure_ascii=False) print("table5 rows:", len(rows5), "| table4 rows:", len(rows4), "| table6 rows:", len(rows6), "| fig13 markers:", len(fig["markers"])) for r in rows5: print(f' {r["date"]:11s} {r["nu"]:6.1f} e={r["e"]:.3f} PA={r["PA"]:6.1f} S={r["S"]:6.1f} TB={r["TB"]:5.0f} JD={r["JD"]:.2f}' + (f' of {r["combined_of"]}' if "combined_of" in r else "")) for r in rows6: print(" T6", r) if __name__ == "__main__": main()