from __future__ import annotations import gzip from pathlib import Path from scripts.plot_pop_ld_decay import _curve, main def test_ld_plotter_uses_pair_weighted_physical_bins(tmp_path: Path) -> None: stat = tmp_path / "x.stat.gz" with gzip.open(stat, "wt", encoding="utf-8") as handle: handle.write("#Dist\tMean_r^2\tMean_D'\tSum_r^2\tSum_D'\tNumberPairs\n") handle.write("1\t0.5\tNA\t1.0\tNA\t2\n2\t0.25\tNA\t1.0\tNA\t4\n") x, y = _curve(stat, 10, 500) assert x == [0.005] assert y == [2 / 6] assert main(["-inFile", str(stat), "--output", str(tmp_path / "plot")]) == 0 assert (tmp_path / "plot.png").stat().st_size > 0 assert (tmp_path / "plot.pdf").stat().st_size > 0