"""SCI Figure Hub — XPS High-Resolution Peak Deconvolution (CC0-1.0)""" import numpy as np import matplotlib.pyplot as plt PALETTE = ["#4DBBD5", "#00A087", "#F39B7F"] plt.rcParams.update({"font.sans-serif": ["Arial", "DejaVu Sans"], "font.size": 8, "pdf.fonttype": 42}) be = np.linspace(527, 536, 400) gauss = lambda x, mu, s, a: a * np.exp(-0.5 * ((x - mu) / s) ** 2) bg = 0.12 + 0.08 / (1 + np.exp((be - 531.0) * 1.4)) c1 = gauss(be, 529.8, 0.55, 1.00) c2 = gauss(be, 531.3, 0.65, 0.62) c3 = gauss(be, 532.7, 0.72, 0.34) env = bg + c1 + c2 + c3 raw = env + np.random.default_rng(3).normal(0, 0.025, be.size) fig, ax = plt.subplots(figsize=(3.5, 2.55), dpi=300) ax.scatter(be[::4], raw[::4], s=10, facecolors="none", edgecolors="#475569", lw=0.6, label="Raw") ax.plot(be, bg, "--", color="#94A3B8", lw=0.85, label="Baseline") for comp, col, lbl in [(c1, PALETTE[0], "Lattice O"), (c2, PALETTE[1], "Vacancy O"), (c3, PALETTE[2], "Adsorbed O")]: ax.fill_between(be, bg, bg + comp, color=col, alpha=0.45, label=lbl) ax.plot(be, bg + comp, color=col, lw=0.9) ax.plot(be, env, color="#E64B35", lw=1.35, label="Envelope") ax.invert_xaxis() ax.set_yticks([]) ax.set_xlabel("Binding Energy (eV)") ax.set_ylabel("Intensity (a.u.)") ax.legend(frameon=False, fontsize=6.5, loc="upper left") fig.tight_layout() fig.savefig("xps_deconvolution.pdf", bbox_inches="tight")