Sync data and code after the per-digit re-audit
This commit is contained in:
@@ -27,6 +27,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
import sse_lib as L
|
||||
from sse_lib import DATA, DEVICE, rayleigh_gain, snr_to_sigma2, eval_ser_sse
|
||||
from exp_full import (main_model, base_keys, get_model, eve_wrong_mask,
|
||||
oma_ser_keylen,
|
||||
eval_ser_eve, mean_abs_xcorr, MAIN_D)
|
||||
|
||||
SNR = 10.0
|
||||
@@ -112,12 +113,15 @@ def main():
|
||||
ew = eve_wrong_mask(U, Lp, seed=20260813)
|
||||
ev = eval_ser_eve(m, ew, [SNR], frames=FRAMES)[0]
|
||||
xc = mean_abs_xcorr(m.masks().detach())
|
||||
rows.append((U, "%.6f" % lg, "%.6f" % ev, "%.6f" % xc))
|
||||
# OMA gets its own d/U dimensions per user at this load
|
||||
oma = oma_ser_keylen(MAIN_D // U, SNR)
|
||||
rows.append((U, "%.6f" % lg, "%.6f" % ev, "%.6f" % xc,
|
||||
"%.6f" % oma))
|
||||
print(" U=%2d legit %.4f eve %.5f xcorr %.2e"
|
||||
% (U, lg, ev, xc), flush=True)
|
||||
with open(DATA / "users.csv", "w", newline="") as f:
|
||||
w = csv.writer(f)
|
||||
w.writerow(["users", "legit_ser", "eve_ser", "mask_xcorr"])
|
||||
w.writerow(["users", "legit_ser", "eve_ser", "mask_xcorr", "oma"])
|
||||
w.writerows(rows)
|
||||
print("[csv]", DATA / "users.csv", flush=True)
|
||||
|
||||
|
||||
@@ -347,7 +347,6 @@ def fig_jam():
|
||||
ax.set_xlabel("JSR (dB)")
|
||||
ax.set_ylabel("SER")
|
||||
ax.set_xlim(min(x), max(x))
|
||||
ax.set_ylim(0.0, 1.02) # keep the reference line off the spine
|
||||
place_legend(ax)
|
||||
save(fig, "fig_sec_jam")
|
||||
|
||||
@@ -386,11 +385,11 @@ def fig_brute():
|
||||
x = col(r, "K")
|
||||
fig, ax = plt.subplots()
|
||||
ax.semilogx(x, col(r, "ser_perm"), color=C_EVE, marker="s", ls="--",
|
||||
label=LBL["perm"], **UNDER)
|
||||
markevery=(0, 3), label=LBL["perm"], **UNDER)
|
||||
ax.semilogx(x, col(r, "ser_pad"), color=C_PUB, marker="v", ls="-.",
|
||||
label=LBL["pad"], **OVER)
|
||||
markevery=(1, 3), label=LBL["pad"], **OVER)
|
||||
ax.semilogx(x, col(r, "ser_mask"), color=C_LEGIT, marker="o", ls="-",
|
||||
label=LBL["mask"])
|
||||
markevery=(2, 3), label=LBL["mask"])
|
||||
legit = main_legit()
|
||||
ax.axhline(legit, color=C_OMA, ls=(0, (4, 2)), lw=0.9,
|
||||
label=LBL["legit"])
|
||||
@@ -430,16 +429,18 @@ def fig_kpa():
|
||||
fig, ax = plt.subplots()
|
||||
sty = {0.0: (C_LEGIT, "o"), 10.0: (C_EVE, "s"),
|
||||
20.0: (C_PUB, "v")}
|
||||
for snr, (c, mk) in sty.items():
|
||||
for off, (snr, (c, mk)) in enumerate(sty.items()):
|
||||
rows = [row for row in r if float(row["snr_db"]) == snr]
|
||||
n = [float(row["n_frames"]) for row in rows]
|
||||
ser = [float(row["eve_ser"]) for row in rows]
|
||||
ax.semilogx(n, ser, color=c, marker=mk, ls="-",
|
||||
markevery=(off, 4), markerfacecolor="none" if off else c,
|
||||
label=LBL["mask"] + f", {int(snr)} dB")
|
||||
try:
|
||||
p = load("pkpa.csv")
|
||||
ax.semilogx(col(p, "n_frames"), col(p, "eve_ser"), color=C_MATCH,
|
||||
marker="P", ls="--", label=LBL["perm"] + ", 20 dB")
|
||||
marker="P", ls="--", markevery=(3, 4),
|
||||
label=LBL["perm"] + ", 20 dB")
|
||||
except FileNotFoundError:
|
||||
print("[skip] pkpa.csv not present yet")
|
||||
# legitimate reference measured with the SAME estimator as the
|
||||
|
||||
+4
-4
@@ -130,7 +130,7 @@ def v3_leakage_vs_correlation():
|
||||
corrs.append(abs((m @ mt) / D))
|
||||
emp = float(np.mean(corrs))
|
||||
claim = float(np.sqrt(2.0 / (np.pi * D)))
|
||||
ok_b = report("V3b random mask E|corr|", claim, emp, 0.1 * claim)
|
||||
ok_b = report("V3b random mask E|corr|", claim, emp, 0.03 * claim)
|
||||
return lin_ok and ok_b
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ def v4_blind_jammer_spread():
|
||||
# full contribution scales this by (hJ^2/hu^2) rho.
|
||||
ok2 = report("V4b blind jammer projection variance",
|
||||
float(np.mean(var_cl)), float(np.mean(var_emp)),
|
||||
0.05 * float(np.mean(var_cl)))
|
||||
0.01 * float(np.mean(var_cl)))
|
||||
return ok1 and ok2
|
||||
|
||||
|
||||
@@ -282,10 +282,10 @@ def v8_cross_period_terms():
|
||||
diag = float((a ** 2).sum())
|
||||
rel.append((float((a.sum(0) ** 2).sum()) - diag) / diag)
|
||||
mean = sum(rel) / len(rel)
|
||||
ok = abs(mean) < 0.01
|
||||
ok = abs(mean) < 0.0005
|
||||
print("V8 cross-period remainder, mean %+.4f of the retained term" % mean)
|
||||
ROWS.append(("V8 cross-period remainder", "0.0", "%.6f" % mean,
|
||||
"%.6f" % abs(mean), "0.01", "PASS" if ok else "FAIL"))
|
||||
"%.6f" % abs(mean), "0.0005", "PASS" if ok else "FAIL"))
|
||||
return ok
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user