ORYNTHRA-H6 / code /make_figures.py
PureOne's picture
ORYNTHRA-H6 verified research packaging edition v1.0.2
e740887 verified
Raw History Blame Contribute Delete
3.38 kB
"""Regenerate the five manuscript figures using the package's mathematical models.
This is a deterministic figure generator, not a simulation of an optical device.
Run from any working directory: python /path/to/code/make_figures.py
"""
from pathlib import Path
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from orynthra import storage_cutoff, symmetric_cutoff, mean_photon_lower_bound
ROOT = Path(__file__).resolve().parents[1]
def save(fig, stem: str) -> None:
fig.tight_layout()
fig.savefig(ROOT / "figures" / f"{stem}.pdf")
fig.savefig(ROOT / "figures" / f"{stem}.png", dpi=180)
plt.close(fig)
def main() -> None:
(ROOT / "figures").mkdir(exist_ok=True)
messages = np.unique(np.geomspace(3, 4096, 150).astype(int))
fig, ax = plt.subplots(figsize=(7.2, 4.6))
ax.loglog(messages, [storage_cutoff(int(x), 2) for x in messages], label="Storage only")
ax.loglog(messages, [symmetric_cutoff(int(x), 2) for x in messages],
label="Coherent full-permutation branches")
ax.set(xlabel="Number of distinguishable logical states M",
ylabel="Minimum photon cutoff K", title="Two-mode memory: capacity is not enough")
ax.legend()
ax.grid(True, alpha=0.25)
save(fig, "photon_frontier")
cutoffs = np.arange(10, 65)
fig, ax = plt.subplots(figsize=(7.2, 4.3))
ax.step(cutoffs, np.where(cutoffs < 62, 2 * (1 - 1/64), 0.0), where="post")
ax.set(xlabel="Photon cutoff K", ylabel="Minimum normalized squared covariance defect",
title="64-state branch register: the representation-deficit plateau", ylim=(-0.08, 2.15))
ax.grid(True, alpha=0.25)
save(fig, "covariance_plateau")
horizon = np.arange(37)
fig, ax = plt.subplots(figsize=(7.2, 4.3))
ax.plot(horizon, np.minimum(horizon + 1, 36), label="All six branch generators")
ax.plot(horizon, np.minimum(horizon + 1, 6), label="Kaya generator unavailable")
ax.set(xlabel="Maximum future branch-word length", ylabel="Required binary task dimensions",
title="The six-wing lock: future actions unlock hidden distinctions")
ax.legend()
ax.grid(True, alpha=0.25)
save(fig, "six_wing_horizon")
names = ["Lily", "Tachy", "Raven", "Enya", "Evie", "Kaya"]
gram = (np.eye(6) - np.ones((6, 6))/6) / (5/6)
fig, ax = plt.subplots(figsize=(6.2, 5.3))
image = ax.imshow(gram, vmin=-0.2, vmax=1.0, alpha=0.35)
ax.set_xticks(range(6), names, rotation=30)
ax.set_yticks(range(6), names)
for i in range(6):
for j in range(6):
ax.text(j, i, "1" if i == j else "−1/5", ha="center", va="center")
ax.set_title("H6 excitation geometry: a regular five-simplex")
fig.colorbar(image, ax=ax, label="Inner product of normalized excitation states")
save(fig, "six_simplex_gram")
errors = np.linspace(0, 0.45, 100)
fig, ax = plt.subplots(figsize=(7.2, 4.3))
ax.plot(errors, [mean_photon_lower_bound(20, 2, float(e)) for e in errors])
ax.set(xlabel="Maximum error probability for each requested bit", ylabel="Necessary mean photon number",
title="20-bit query memory: entropy lower bound, not an achievable design")
ax.grid(True, alpha=0.25)
save(fig, "query_energy_bound")
print("Five figure pairs regenerated in figures/.")
if __name__ == "__main__":
main()