21 lines
947 B
Python
21 lines
947 B
Python
"""Per-day rejection rate of R3 (and the other references), by day (05-16 UTC) and by night, over a window."""
|
|
import sys, collections
|
|
sys.path.insert(0, "tools/scripts")
|
|
import data
|
|
D = data.load("data/WILDSTRUBEL")
|
|
start, end = data.parse_time(sys.argv[1]), data.parse_time(sys.argv[2])
|
|
refs = [s for s, ms in D.items() if data.is_reference(ms)]
|
|
print("references:", refs)
|
|
for s in refs:
|
|
tot = collections.Counter(); rej = collections.Counter()
|
|
T = [0, 0]
|
|
for m in D[s]:
|
|
if not (start <= m["t"] < end): continue
|
|
day = m["t"].strftime("%m-%d"); dn = "D" if 5 <= m["t"].hour < 16 else "N"
|
|
tot[day, dn] += 1; T[0] += 1
|
|
if data.rejected(m): rej[day, dn] += 1; T[1] += 1
|
|
print(f"{s}: {T[1]}/{T[0]} rejected")
|
|
if s == "R3" or "-v" in sys.argv:
|
|
for day in sorted({d for d, _ in tot}):
|
|
print(" ", day, " ".join(f"{dn} {rej[day,dn]}/{tot[day,dn]}" for dn in "DN" if tot[day, dn]))
|