"""Extract the plotted twilight means from the preprint's Figures 4 and 5. Both figures are vector drawings on page 10 of arXiv 2610.41750v1. Each marker is drawn as a separate filled path, so markers can be counted and located exactly, even where they overlap: - historical triangulation: a white-filled 47-segment circle (with black pieces drawn over it); - recent triangulation: a black-filled 47-segment circle; - recent colorimetry: a black ring of 55+ segments with a white centre. The legend's three markers (top left of each frame) are excluded. Axis calibration uses the tick marks drawn in each frame (see constants below, read from the page's tick paths). Output keeps the drawing order, which is used to pair points between the two figures. Usage: python3 -I extract_points.py """ import json import sys # Figure 4: frame x 157.26..475.86, y 551.58..734.70 (PDF points) # x ticks every 20 years from 1880 at x=157.26 to 2040 at x=475.86 # y ticks: 78 km at 551.58, 80 at 597.30, 82 at 643.08, 84 at 688.86, 86 at 734.70 F4 = dict(x0=157.26, x1=475.86, t0=1880.0, t1=2040.0, y0=551.58, y1=734.70, h0=78.0, h1=86.0, box=(157.5, 552.0, 476.0, 734.5)) # Figure 5: frame x 155.88..481.56, y 184.62..371.34 # y ticks: 78 km at 184.62, 80 at 231.24, 82 at 277.92, 84 at 324.60, 86 at 371.34 # x ticks (bottom, below axis) every 0.2 rad: see calibrate_fig5() F5 = dict(y0=184.62, y1=371.34, h0=78.0, h1=86.0, box=(156.0, 185.0, 481.5, 371.2)) def primaries(shapes, box): x0, y0, x1, y1 = box out = [] for i, s in enumerate(shapes): if not (x0 < s["cx"] < x1 and y0 < s["cy"] < y1): continue w = s["bbox"][2] - s["bbox"][0] h = s["bbox"][3] - s["bbox"][1] if max(w, h) > 6: continue g = s["fill"][1] if s["fill"] and s["fill"][0] == "g" else None cls = None if s["paint"] == "f" and s["nseg"] == 47 and g == 1.0: cls = "historical" elif s["paint"] == "f" and s["nseg"] == 47 and g == 0.0: cls = "recent_triangulation" elif s["paint"] == "f" and s["nseg"] >= 55 and g == 0.0: cls = "recent_colorimetry" if cls: out.append({"order": i, "class": cls, "x": s["cx"], "y": s["cy"], "w": round(w, 2), "h": round(h, 2)}) return out def drop_legend(points, xmax, ymin): return [p for p in points if not (p["x"] < xmax and p["y"] > ymin)] def main(): shapes = json.load(open(sys.argv[1], encoding="utf-8")) out = {} # Figure 4 p4 = primaries(shapes, F4["box"]) legend4 = [p for p in p4 if p["x"] < 182 and p["y"] > 700] p4 = drop_legend(p4, 182, 700) for p in p4: p["year_plotted"] = round(F4["t0"] + (p["x"] - F4["x0"]) * (F4["t1"] - F4["t0"]) / (F4["x1"] - F4["x0"]), 3) p["height_km"] = round(F4["h0"] + (p["y"] - F4["y0"]) * (F4["h1"] - F4["h0"]) / (F4["y1"] - F4["y0"]), 3) # Figure 5 p5 = primaries(shapes, F5["box"]) legend5 = [p for p in p5 if p["x"] < 300 and p["y"] > 335] p5 = [p for p in p5 if p not in legend5] for p in p5: p["height_km"] = round(F5["h0"] + (p["y"] - F5["y0"]) * (F5["h1"] - F5["h0"]) / (F5["y1"] - F5["y0"]), 3) out["fig4"] = p4 out["fig5"] = p5 out["legend4"] = legend4 out["legend5"] = legend5 with open(sys.argv[2], "w", encoding="utf-8", newline="\n") as f: json.dump(out, f, indent=1) from collections import Counter print("fig4", Counter(p["class"] for p in p4), "legend", [p["class"] for p in legend4]) print("fig5", Counter(p["class"] for p in p5), "legend", [(p["class"], p["x"], p["y"]) for p in legend5]) if __name__ == "__main__": main()