#!/usr/bin/env python3
"""Render the preregistered profile-ablation figure with schematic data."""

from pathlib import Path

import matplotlib.pyplot as plt


CONFIGS = [f"TP{tp}\nMNS{mns}" for tp in (1, 2, 4) for mns in (8, 16, 32, 64)]

# Schematic only. These values are deliberately not derived from experiment data.
MOCK = {
    "Real (mock)": [0.42, 0.50, 0.58, 0.57, 0.60, 0.76, 1.00, 0.99, 0.55, 0.70, 0.74, 0.73],
    "Old profile-only (mock)": [0.38, 0.44, 0.51, 0.50, 0.47, 0.58, 0.70, 0.69, 0.66, 0.84, 0.95, 0.96],
    "New P-020 profile-only (H1 mock)": [0.40, 0.49, 0.57, 0.56, 0.58, 0.74, 0.98, 0.97, 0.53, 0.69, 0.75, 0.74],
    "Per-TP calibrated upper bound (mock)": [0.41, 0.50, 0.58, 0.57, 0.59, 0.75, 0.99, 0.98, 0.54, 0.69, 0.75, 0.74],
}


def main() -> None:
    output = Path(__file__).with_name("mock-profile-ablation.png")
    fig, ax = plt.subplots(figsize=(13.5, 5.8), constrained_layout=True)
    x = list(range(len(CONFIGS)))
    styles = ["o-", "s--", "^-", "D:"]
    for (label, values), style in zip(MOCK.items(), styles, strict=True):
        ax.plot(x, values, style, linewidth=2, markersize=5, label=label)
    ax.axvline(3.5, color="0.75", linewidth=1)
    ax.axvline(7.5, color="0.75", linewidth=1)
    ax.set_xticks(x, CONFIGS)
    ax.set_ylabel("Normalized SLO-feasible throughput (schematic)")
    ax.set_xlabel("Configuration")
    ax.set_ylim(0.3, 1.08)
    ax.grid(axis="y", alpha=0.25)
    ax.legend(ncol=2, frameon=False, loc="upper left")
    ax.set_title("MOCK / SCHEMATIC — expected discriminative result, not experiment data")
    fig.savefig(output, dpi=180)
    print(output)


if __name__ == "__main__":
    main()
