Files
naps-deliverable-4/pmos_doe_analysis.ipynb
T
2026-10-31 21:45:21 -04:00

1.6 MiB

PMOS Design of Experiments

One-factor-at-a-time DOE around a baseline PMOS design.

Factor Column Low Baseline High
Boron SOD concentration Csod_B (cm⁻³) 2.5e20 5e20 7.5e20
Spin-on dopant time SDTime (min) 20 30 40
Al₂O₃ thickness Tal2o3 (µm) 0.02 0.025 0.03
In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter

plt.rcParams.update({
    "figure.dpi": 110,
    "font.family": "sans-serif",
    "axes.spines.top": False,
    "axes.spines.right": False,
    "axes.edgecolor": "#444444",
    "axes.labelcolor": "#333333",
    "axes.titleweight": "regular",
    "axes.titlesize": 11,
    "axes.grid": True,
    "grid.color": "#e8e8e8",
    "grid.linewidth": 0.6,
    "xtick.color": "#444444",
    "ytick.color": "#444444",
    "legend.frameon": False,
    "lines.linewidth": 1.6,
    "lines.markersize": 4,
})

COLORS = {"low": "#4c78a8", "base": "#222222", "high": "#e45756"}

FACTORS = {
    "Csod_B": dict(label="Boron SOD concentration", unit="cm$^{-3}$", base=5e20, low=2.5e20, high=7.5e20,
                   fmt=lambda v: f"{v:.2e}"),
    "SDTime": dict(label="SOD time", unit="min", base=30, low=20, high=40,
                   fmt=lambda v: f"{v:g}"),
    "Tal2o3": dict(label="Al$_2$O$_3$ thickness", unit="µm", base=0.025, low=0.02, high=0.03,
                   fmt=lambda v: f"{v:g}"),
}

Load data

In [2]:
def load_curves(factor, kind):
    df = pd.read_csv(f"{factor} {kind} Characteristics.csv")
    xcol = df.columns[0]
    df = df.rename(columns={xcol: "V"}).set_index("V")
    df.columns = df.columns.astype(float)
    return df.sort_index()

curves = {
    (f, k): load_curves(f, k)
    for f in FACTORS for k in ("Output", "Transfer")
}

raw = pd.read_csv("pmos_alum.csv")
splits = raw.iloc[0, 2:].tolist()
raw = raw.iloc[1:].copy()
raw.columns = ["Module", "Variable"] + splits
raw = raw.drop_duplicates("Variable").set_index("Variable")
raw = raw.drop(columns="Module")
raw = raw.drop(index="Split", errors="ignore")

metrics = raw.loc[raw.index.str.endswith(("_V", "_A", "_um", "_dec", "_mV"))].astype(float)
metrics = metrics.drop(index=["Idlin_A", "Idsat_A", "Ioff_A"], errors="ignore")
metrics
Out [2]:
Baseline Csod_B low Csod_B high SDTime low SDTime high Tal2o3 low Tal2o3 high
Variable
Vtgm_V -0.46300 -0.457000 -0.46500 -0.463000 -0.46000 -0.5750 -0.359000
Vtlin_V -0.41700 -0.427000 -0.40700 -0.441000 -0.39500 -0.5150 -0.283000
Idlin_uA_um 6.26000 5.250000 6.91000 5.620000 6.75000 7.1000 5.570000
Vtsat_V -0.29900 -0.308000 -0.29300 -0.317000 -0.28600 -0.5030 -0.261000
Idsat_uA_um 163.00000 141.000000 178.00000 144.000000 176.00000 184.0000 153.000000
Ioff_pA_um 0.13700 0.108000 0.22300 0.096500 0.57900 0.0924 0.975000
SSsat_mV_dec 79.00000 75.900000 82.40000 73.700000 87.90000 71.8000 74.700000
DIBL_mV 118.00000 119.000000 114.00000 124.000000 109.00000 11.9000 21.800000
IdVd5_A 0.00106 0.000915 0.00116 0.000936 0.00115 0.0012 0.000997
IdVd5_uA_um 163.00000 141.000000 178.00000 144.000000 176.00000 184.0000 153.000000

Output characteristics (I_D vs V_D)

In [3]:
def level_color(factor, val):
    f = FACTORS[factor]
    return COLORS["base"] if val == f["base"] else COLORS["low"] if val == f["low"] else COLORS["high"]

def level_order(factor, cols):
    f = FACTORS[factor]
    return [f["low"], f["base"], f["high"]]

fig, axes = plt.subplots(1, 3, figsize=(13, 3.8), sharey=True)
for ax, factor in zip(axes, FACTORS):
    df = curves[(factor, "Output")]
    f = FACTORS[factor]
    for v in level_order(factor, df.columns):
        s = df[v].dropna() * -1e3
        ax.plot(-s.index, s.values, marker="o", color=level_color(factor, v), label=f["fmt"](v))
    ax.set_title(f["label"])
    ax.set_xlabel("$|V_D|$ (V)")
    ax.legend(title=f["unit"], title_fontsize=8, fontsize=8)
axes[0].set_ylabel("$|I_D|$ (mA)")
fig.suptitle("Output characteristics by factor", fontsize=12)
fig.tight_layout()
plt.show()
In [ ]:
fig, axes = plt.subplots(1, 3, figsize=(13, 3.8), sharey=True)
for ax, factor in zip(axes, FACTORS):
    df = curves[(factor, "Transfer")]
    f = FACTORS[factor]
    for v in level_order(factor, df.columns):
        s = df[v].dropna().abs() * 1e3
        ax.plot(s.index, s.values, color=level_color(factor, v), label=f["fmt"](v))
    ax.set_title(f["label"])
    ax.set_xlabel("$V_G$ (V)")
    ax.invert_xaxis()
    ax.legend(title=f["unit"], title_fontsize=8, fontsize=8)
axes[0].set_ylabel("$|I_D|$ (mA)")
fig.suptitle("Transfer characteristics by factor (linear)", fontsize=12)
fig.tight_layout()
plt.show()

Individual output plots

In [4]:
for factor, f in FACTORS.items():
    df = curves[(factor, "Output")]
    fig, ax = plt.subplots(figsize=(5.2, 3.8))
    for v in level_order(factor, df.columns):
        s = df[v].dropna() * -1e3
        ax.plot(-s.index, s.values, marker="o", color=level_color(factor, v), label=f["fmt"](v))
    ax.set_title(f"Output characteristics: {f['label']}")
    ax.set_xlabel("$|V_D|$ (V)")
    ax.set_ylabel("$|I_D|$ (mA)")
    ax.legend(title=f["unit"], title_fontsize=8)
    fig.tight_layout()
    plt.show()

Transfer characteristics (I_D vs V_G)

In [17]:
def plot_transfer(ax, factor, log):
    df = curves[(factor, "Transfer")]
    f = FACTORS[factor]
    for v in level_order(factor, df.columns):
        s = df[v].dropna().abs()
        ax.plot(s.index, s.values if log else s.values * 1e3, color=level_color(factor, v), label=f["fmt"](v))
    if log:
        ax.set_yscale("log")
        ax.set_ylabel("$|I_D|$ (A)")
    else:
        ax.set_ylabel("$|I_D|$ (mA)")
    ax.set_xlabel("$V_G$ (V)")
    ax.invert_xaxis()

fig, axes = plt.subplots(2, 3, figsize=(13, 7.4), sharex=True)
for j, factor in enumerate(FACTORS):
    f = FACTORS[factor]
    plot_transfer(axes[0, j], factor, log=True)
    plot_transfer(axes[1, j], factor, log=False)
    axes[0, j].set_title(f["label"])
    axes[0, j].legend(title=f["unit"], title_fontsize=8, fontsize=8)
    if j:
        axes[0, j].set_ylabel("")
        axes[1, j].set_ylabel("")
fig.suptitle("Transfer characteristics by factor (top: log, bottom: linear)", fontsize=12)
fig.tight_layout()
plt.show()

Individual transfer plots (log and linear)

In [6]:
for factor, f in FACTORS.items():
    fig, axes = plt.subplots(1, 2, figsize=(10, 3.8))
    plot_transfer(axes[0], factor, log=True)
    plot_transfer(axes[1], factor, log=False)
    axes[0].legend(title=f["unit"], title_fontsize=8)
    fig.suptitle(f"Transfer characteristics: {f['label']}", fontsize=11)
    fig.tight_layout()
    plt.show()

Extracted metrics (the Excel plots)

Each metric from pmos_alum.csv plotted against factor level, one panel per factor. The baseline run is shared by all three panels (dashed line).

In [7]:
LABELS = {
    "Vtgm_V": ("$V_{t,gm}$", "V"),
    "Vtlin_V": ("$V_{t,lin}$", "V"),
    "Vtsat_V": ("$V_{t,sat}$", "V"),
    "Idlin_uA_um": ("$I_{D,lin}$", "µA/µm"),
    "Idsat_uA_um": ("$I_{D,sat}$", "µA/µm"),
    "Ioff_pA_um": ("$I_{off}$", "pA/µm"),
    "SSsat_mV_dec": ("Subthreshold swing", "mV/dec"),
    "DIBL_mV": ("DIBL", "mV"),
}
LABELS = {k: v for k, v in LABELS.items() if k in metrics.index}

def metric_vs_factor(metric):
    out = {}
    for factor in FACTORS:
        out[factor] = [metrics.loc[metric, f"{factor} low"], metrics.loc[metric, "Baseline"], metrics.loc[metric, f"{factor} high"]]
    return out

for metric, (name, unit) in LABELS.items():
    vals = metric_vs_factor(metric)
    fig, axes = plt.subplots(1, 3, figsize=(11, 3.2), sharey=True)
    for ax, factor in zip(axes, FACTORS):
        f = FACTORS[factor]
        x = [f["low"], f["base"], f["high"]]
        y = vals[factor]
        ax.plot(x, y, color="#888888", lw=1.2)
        ax.scatter(x, y, c=[COLORS["low"], COLORS["base"], COLORS["high"]], zorder=3, s=36)
        ax.axhline(y[1], color="#bbbbbb", ls="--", lw=0.8, zorder=1)
        ax.set_xticks(x)
        ax.set_xticklabels([f["fmt"](v) for v in x], fontsize=8)
        ax.set_xlabel(f"{f['label']} ({f['unit']})")
    axes[0].set_ylabel(f"{name} ({unit})")
    fig.suptitle(f"{name} vs factor level", fontsize=11)
    fig.tight_layout()
    plt.show()

Percent change from baseline

In [8]:
rows = []
for metric in LABELS:
    base = metrics.loc[metric, "Baseline"]
    for factor in FACTORS:
        for lvl in ("low", "high"):
            rows.append((metric, factor, lvl, 100 * (metrics.loc[metric, f"{factor} {lvl}"] - base) / abs(base)))
pct = pd.DataFrame(rows, columns=["metric", "factor", "level", "pct"])

fig, axes = plt.subplots(1, len(LABELS), figsize=(2.4 * len(LABELS), 3.2), sharey=True)
for ax, metric in zip(axes, LABELS):
    d = pct[pct.metric == metric]
    ypos = np.arange(len(FACTORS))
    for lvl, off in (("low", -0.18), ("high", 0.18)):
        dd = d[d.level == lvl].set_index("factor").loc[list(FACTORS)]
        ax.barh(ypos + off, dd.pct, height=0.34, color=COLORS[lvl], label=lvl)
    ax.axvline(0, color="#444444", lw=0.8)
    ax.set_title(LABELS[metric][0], fontsize=10)
    ax.set_yticks(ypos)
    ax.set_yticklabels(list(FACTORS))
    ax.invert_yaxis()
    ax.grid(axis="y", visible=False)
    ax.xaxis.set_major_formatter(FuncFormatter(lambda v, _: f"{v:.0f}%"))
    ax.tick_params(axis="x", labelsize=7)
axes[0].legend(fontsize=8)
fig.suptitle("Change from baseline by metric and factor level", fontsize=12)
fig.tight_layout()
plt.show()

Summary table

In [9]:
metrics.rename(index={k: f"{v[0]} ({v[1]})".replace("$", "") for k, v in LABELS.items()}).loc[
    [f"{v[0]} ({v[1]})".replace("$", "") for v in LABELS.values()]
]
Out [9]:
Baseline Csod_B low Csod_B high SDTime low SDTime high Tal2o3 low Tal2o3 high
Variable
V_{t,gm} (V) -0.463 -0.457 -0.465 -0.4630 -0.460 -0.5750 -0.359
V_{t,lin} (V) -0.417 -0.427 -0.407 -0.4410 -0.395 -0.5150 -0.283
V_{t,sat} (V) -0.299 -0.308 -0.293 -0.3170 -0.286 -0.5030 -0.261
I_{D,lin} (µA/µm) 6.260 5.250 6.910 5.6200 6.750 7.1000 5.570
I_{D,sat} (µA/µm) 163.000 141.000 178.000 144.0000 176.000 184.0000 153.000
I_{off} (pA/µm) 0.137 0.108 0.223 0.0965 0.579 0.0924 0.975
Subthreshold swing (mV/dec) 79.000 75.900 82.400 73.7000 87.900 71.8000 74.700
DIBL (mV) 118.000 119.000 114.000 124.0000 109.000 11.9000 21.800

Better device: overlaid series per factor

"Better" is defined per metric as: higher I_{D,lin} and I_{D,sat}; lower I_{off}, SS and DIBL; and |V_t| closer to zero. Each metric is min-max scaled over all 7 runs (1 = best run, 0 = worst), and a run's score is the mean across metrics. Edit BETTER to change the definition or WEIGHTS to emphasize metrics.

In [10]:
BETTER = {
    "Vtgm_V": "abs_low", "Vtlin_V": "abs_low", "Vtsat_V": "abs_low",
    "Idlin_uA_um": "high", "Idsat_uA_um": "high",
    "Ioff_pA_um": "low", "SSsat_mV_dec": "low", "DIBL_mV": "low",
}
WEIGHTS = {k: 1.0 for k in BETTER}

m = metrics.loc[[k for k in BETTER if k in metrics.index]]
goodness = pd.DataFrame(index=m.index, columns=m.columns, dtype=float)
for k in m.index:
    v = m.loc[k].astype(float)
    v = {"high": v, "low": -v, "abs_low": -v.abs()}[BETTER[k]]
    goodness.loc[k] = (v - v.min()) / (v.max() - v.min())
w = pd.Series({k: WEIGHTS[k] for k in m.index})
score = (goodness.mul(w, axis=0).sum() / w.sum()).rename("score")
score
Out [10]:
Baseline       0.549658
Csod_B low     0.437958
Csod_B high    0.610395
SDTime low     0.469149
SDTime high    0.519199
Tal2o3 low     0.625000
Tal2o3 high    0.647951
Name: score, dtype: float64
In [11]:
def run_name(factor, lvl):
    return "Baseline" if lvl == "base" else f"{factor} {lvl}"

def level_value(factor, lvl):
    return FACTORS[factor][lvl]

def best_level(factor):
    return max(("low", "base", "high"), key=lambda l: score[run_name(factor, l)])

for factor, f in FACTORS.items():
    best = best_level(factor)
    fig, axes = plt.subplots(1, 3, figsize=(15, 4.2))
    for lvl in ("low", "base", "high"):
        v = f[lvl]
        lw = 2.8 if lvl == best else 1.4
        lab = f"{f['fmt'](v)} ({lvl})" + ("  ★ best" if lvl == best else "")
        out = curves[(factor, "Output")][v].dropna()
        tr = curves[(factor, "Transfer")][v].dropna().abs()
        axes[0].plot(-out.index, -out.values * 1e3, color=COLORS[lvl], lw=lw, label=lab)
        axes[1].plot(tr.index, tr.values * 1e3, color=COLORS[lvl], lw=lw)
        axes[2].plot(tr.index, tr.values, color=COLORS[lvl], lw=lw)
    axes[0].set(xlabel="$|V_D|$ (V)", ylabel="$|I_D|$ (mA)", title="Output")
    axes[1].set(xlabel="$V_G$ (V)", ylabel="$|I_D|$ (mA)", title="Transfer (linear)")
    axes[2].set(xlabel="$V_G$ (V)", ylabel="$|I_D|$ (A)", title="Transfer (log)", yscale="log")
    axes[1].invert_xaxis(); axes[2].invert_xaxis()
    axes[0].legend(title=f"{f['label']} ({f['unit']})", title_fontsize=8, fontsize=8)
    fig.suptitle(f"Better device overlay: {f['label']} (★ = highest device score)", fontsize=12)
    fig.tight_layout()
    plt.show()

Per-metric scorecard (1 = best of all runs, 0 = worst)

In [12]:
names = {k: LABELS[k][0] for k in goodness.index}
fig, axes = plt.subplots(1, 3, figsize=(14, 4), sharey=False)
for ax, (factor, f) in zip(axes, FACTORS.items()):
    cols = [run_name(factor, l) for l in ("low", "base", "high")]
    g = goodness[cols]
    im = ax.imshow(g.values.astype(float), cmap="Greys", vmin=0, vmax=1, aspect="auto")
    ax.set_xticks(range(3))
    ax.set_xticklabels([f"low\n{f['fmt'](f['low'])}", f"base\n{f['fmt'](f['base'])}", f"high\n{f['fmt'](f['high'])}"], fontsize=8)
    ax.set_yticks(range(len(g)))
    ax.set_yticklabels([names[k] for k in g.index], fontsize=8)
    for i in range(g.shape[0]):
        for j in range(3):
            val = g.values[i, j]
            ax.text(j, i, f"{val:.2f}", ha="center", va="center", fontsize=8, color="white" if val > 0.55 else "#222222")
    ax.set_title(f["label"])
    ax.grid(False)
    for s in ax.spines.values():
        s.set_visible(False)
fig.suptitle("Per-metric scorecard (1 = best of all runs, 0 = worst)", fontsize=12)
fig.tight_layout()
plt.show()

Overall device score vs factor level

In [13]:
fig, axes = plt.subplots(1, 3, figsize=(11, 3.2), sharey=True)
for ax, (factor, f) in zip(axes, FACTORS.items()):
    x = [f["low"], f["base"], f["high"]]
    y = [score[run_name(factor, l)] for l in ("low", "base", "high")]
    best = best_level(factor)
    ax.plot(x, y, color="#888888", lw=1.2)
    ax.scatter(x, y, c=[COLORS[l] for l in ("low", "base", "high")], s=[110 if l == best else 36 for l in ("low", "base", "high")], zorder=3)
    ax.set_xticks(x)
    ax.set_xticklabels([f["fmt"](v) for v in x], fontsize=8)
    ax.set_xlabel(f"{f['label']} ({f['unit']})")
    ax.set_ylim(0, 1)
axes[0].set_ylabel("Device score")
fig.suptitle("Overall device score vs factor level", fontsize=11)
fig.tight_layout()
plt.show()

pd.DataFrame({
    factor: {"best level": best_level(factor), "value": FACTORS[factor][best_level(factor)],
             "score": score[run_name(factor, best_level(factor))], "baseline score": score["Baseline"]}
    for factor in FACTORS
}).T
Out [13]:
best level value score baseline score
Csod_B high 750000000000000000000.0 0.610395 0.549658
SDTime base 30 0.549658 0.549658
Tal2o3 high 0.03 0.647951 0.549658

Sensitivity charts: Δ response vs Δ factor

Each factor's low and high level is expressed as a % change from baseline (x) against the % change in the response (y), with all three factors overlaid and meeting at the baseline (0, 0).

In [14]:
FACTOR_COLORS = {"Csod_B": "#4c78a8", "SDTime": "#e45756", "Tal2o3": "#54a24b"}

def sensitivity_chart(title, ylabel, response, mode="pct", log=False):
    fig, ax = plt.subplots(figsize=(7.5, 4.6))
    for factor, f in FACTORS.items():
        dx = [(f["low"] - f["base"]) / f["base"] * 100, 0, (f["high"] - f["base"]) / f["base"] * 100]
        base = response(factor, "base")
        ys = []
        for lvl in ("low", "base", "high"):
            r = response(factor, lvl)
            ys.append(r / base if log else (r - base) / base * 100)
        ax.plot(dx, ys, marker="o", color=FACTOR_COLORS[factor], label=factor)
    ax.axvline(0, color="#444444", lw=0.8)
    if log:
        ax.set_yscale("log")
        ax.axhline(1, color="#444444", lw=0.8)
        ax.set_ylim(0.1, 10)
        ax.yaxis.set_major_formatter(FuncFormatter(lambda v, _: f"{v:g}"))
    else:
        ax.axhline(0, color="#444444", lw=0.8)
        ax.yaxis.set_major_formatter(FuncFormatter(lambda v, _: f"{v:.0f}%"))
    ax.xaxis.set_major_formatter(FuncFormatter(lambda v, _: f"{v:.0f}%"))
    ax.set_xlabel("Δ factor")
    ax.set_ylabel(ylabel)
    ax.set_title(title)
    ax.legend(loc="upper center", bbox_to_anchor=(0.5, -0.16), ncol=3)
    fig.tight_layout()
    plt.show()

def metric_at(metric):
    return lambda factor, lvl: metrics.loc[metric, "Baseline" if lvl == "base" else f"{factor} {lvl}"]

raw_ioff = raw.loc["Ioff_A"].astype(float)
ioff_at = lambda factor, lvl: raw_ioff["Baseline" if lvl == "base" else f"{factor} {lvl}"]
idsat_at = lambda factor, lvl: float(raw.loc["Idsat_A", "Baseline" if lvl == "base" else f"{factor} {lvl}"])

sensitivity_chart("I_ON sensitivity to factor change", "Δ I_ON", idsat_at)
sensitivity_chart("V_T sensitivity to factor change", "Δ |V_T|", lambda f, l: abs(metric_at("Vtlin_V")(f, l)))
sensitivity_chart("I_OFF sensitivity to factor change", "I_OFF / base", ioff_at, log=True)