"""Night (00-04 UTC) and window medians of corr_x/corr_y, in px and in the whole-range noise (ranges.py noise).""" import sys, statistics as st from datetime import datetime, timezone sys.path.insert(0, "tools/scripts"); import data M = data.load("data/FLORIDA") NOISE = {("Sellette 4","corr_x"):0.0157,("Sellette 5","corr_x"):0.0181,("Sellette 4","corr_y"):0.0128,("Sellette 5","corr_y"):0.0144} def t(s): return datetime.strptime(s, "%Y-%m-%dT%H:%M").replace(tzinfo=timezone.utc) W = [("night 05",t("2026-10-05T00:00"),t("2026-10-05T04:00")),("night 06",t("2026-10-06T00:00"),t("2026-10-06T04:00")), ("night 07",t("2026-10-07T00:00"),t("2026-10-07T04:00")),("09 08:00-13:30",t("2026-10-09T08:00"),t("2026-10-09T13:30")), ("night 10",t("2026-10-10T00:00"),t("2026-10-10T04:00")),("night 11",t("2026-10-11T00:00"),t("2026-10-11T04:00"))] for s in ("Sellette 4","Sellette 5"): for c in ("corr_x","corr_y"): vals = {n: st.median([m[c] for m in M[s] if a <= m["t"] <= b and m[c] is not None] or [float("nan")]) for n,a,b in W} ref = st.median([vals["night 05"],vals["night 06"],vals["night 07"]]) print(s, c, " ".join(f"{n}={v:+.3f}({(v-ref)/NOISE[(s,c)]:+.1f}n)" for n,v in vals.items()))