diff --git a/messung/motor/stackoff_preis/eichung_pruefung.log b/messung/motor/stackoff_preis/eichung_pruefung.log new file mode 100644 index 00000000..e69de29b diff --git a/messung/motor/stackoff_preis/eichung_pruefung.py b/messung/motor/stackoff_preis/eichung_pruefung.py new file mode 100644 index 00000000..4640654e --- /dev/null +++ b/messung/motor/stackoff_preis/eichung_pruefung.py @@ -0,0 +1,45 @@ +"""Grobe Pruefung MOTOR_STACKOFF_EICHUNG (01.12.): echte Nachflop-Anfragen seit 24.11. (Schattenlog Live-Baum), Live-Schalter. +1. Aus: neue Exe ohne Schalter gegen die Live-Exe auf 450 zufaelligen Anfragen (alle Strassen) -> muss gleich sein. +2. An: alle Nachflop-Anfragen, in denen der Motor RAISE/ALL_IN spielte, mit und ohne Schalter: Zahl der Aenderungen, Arten, + Strasse/Groesse und die Haende wie gespielt (netto bb, nur Summen). 6 Faeden (je ein Exe-Prozess, ~5 GB je Prozess). + python -I -X utf8 eichung_pruefung.py """ +import collections, json, os, random, sys +from concurrent.futures import ThreadPoolExecutor +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from aus_pruefung import LIVE, lauf +alt, neu = sys.argv[1:3] +F = [] +for z in open(LIVE + "/archiv/lauf/schatten.jsonl", "rb"): + if b'"q"' not in z: continue + try: r = json.loads(z) + except ValueError: continue + if r.get("q") and str(r.get("zeit", "")) >= "2026-11-24" and r.get("motor"): F.append(r) +netto = {} +for z in open(LIVE + "/archiv/lauf/haende.jsonl", encoding="utf-8"): + try: h = json.loads(z) + except ValueError: continue + if h.get("bb"): netto[str(h.get("hand"))] = h["netto"] / h["bb"] +def parallel(exe, faelle, extra, n=6): + teile = [faelle[i::n] for i in range(n)] + with ThreadPoolExecutor(n) as ex: res = list(ex.map(lambda t: lauf(exe, t, extra), teile)) + out = [None] * len(faelle) + for i, r in enumerate(res): + for j, x in enumerate(r): out[i + j * n] = x + return out +rund = lambda x: None if x is None else round(x, 6) +gleich = lambda x, y: (x.get("action"), rund(x.get("size"))) == (y.get("action"), rund(y.get("size"))) +random.seed(13) +aus = random.sample(F, 450) +a, b = parallel(alt, aus, {}), parallel(neu, aus, {}) +z = [f"Aus gegen {os.path.basename(alt)}: {sum(map(gleich, a, b))}/{len(aus)} gleich"] +an = [r for r in F if r["q"]["street"] != "PREFLOP" and r["motor"].get("action") in ("RAISE", "ALL_IN")] +c = parallel(neu, an, {}) +d = parallel(neu, an, {"MOTOR_STACKOFF_EICHUNG": "1"}) +weg = [(r, x, y) for r, x, y in zip(an, c, d) if not gleich(x, y)] +arten = collections.Counter(f"{r['q']['street']} {x.get('action')}->{y.get('action')}" for r, x, y in weg) +summe = sum(netto.get(str(r.get("hand")), 0) for r, _, _ in weg if r.get("gespielt") is not False) +z.append(f"An: {len(weg)}/{len(an)} Nachflop-Raises geaendert {dict(arten)}; diese Haende wie gespielt {summe:+.1f} bb") +for r, x, y in weg[:25]: + z.append(f" {r['q']['street']} {x.get('action')} {x.get('size')} -> {y.get('action')} | Hand {netto.get(str(r.get('hand')), 0):+.0f} | {str(y.get('reason'))[:150]}") +open("eichung_pruefung.txt.tmp", "w", encoding="utf-8", newline="\n").write("\n".join(z) + "\n"); os.replace("eichung_pruefung.txt.tmp", "eichung_pruefung.txt") +print("\n".join(z))