qcc_kplugin.instance_values

Per-instance values for the layout view: what each qubit and resonator is worth (LOM / FEM / consensus) next to its target, and a colour for how far off it is. Display only: nothing here writes design.json. No KLayout import, so it is unit-tested without the GUI (tests/test_kplugin_instance_values.py); valuesview.py draws it.

Sources (all optional, read from the files the flow already writes):

  • the targets: design.json targets.<element>.<key> (tolerances: design_io.target_tolerance());

  • the LOM value: build/<name>/lom.json params ("Q1.f_q_GHz"), written by Run LOM;

  • the FEM value: the sidecar’s per-instance results (a parameter whose source is a field solver), and the FEM methods of the consensus;

  • the consensus: build/<name>/consensus.json (chosen value and the relative spread between methods).

Attributes

Functions

collect(src) → dict[str, list[dict]]

{element: [row, ...]}; a row is {key, label, unit, lom, fem, consensus, spread_rel, target, tol, value, grade}. value is what the colour judges: the FEM value, else the LOM value, else the consensus.

detail(row) → tuple[str, str, str, str, str]

Panel columns: LOM, FEM, consensus (± spread), target (± tolerance), grade.

grade(value, target, tol) → str

"ok" (within the tolerance), "near" (up to twice it), "off" (beyond), "none" (no value or no

is_fem(source) → bool

line(row) → str

One text line for the layout: f_q 5.228 GHz (target 5.1 ± 0.02).

readout(name, rows) → str

The panel's read-out for one instance (a few lines).

sources(design_path[, sidecar]) → dict

The raw inputs for design_path: {"targets", "lom", "results", "consensus"}.

worst(rows) → str

Module Contents

qcc_kplugin.instance_values.collect(src: dict) → dict[str, list[dict]]

{element: [row, ...]}; a row is {key, label, unit, lom, fem, consensus, spread_rel, target, tol, value, grade}. value is what the colour judges: the FEM value, else the LOM value, else the consensus.

qcc_kplugin.instance_values.detail(row: dict) → tuple[str, str, str, str, str]

Panel columns: LOM, FEM, consensus (± spread), target (± tolerance), grade.

qcc_kplugin.instance_values.grade(value, target, tol) → str

"ok" (within the tolerance), "near" (up to twice it), "off" (beyond), "none" (no value or no target to compare with).

qcc_kplugin.instance_values.is_fem(source) → bool
qcc_kplugin.instance_values.line(row: dict) → str

One text line for the layout: f_q 5.228 GHz (target 5.1 ± 0.02).

qcc_kplugin.instance_values.readout(name: str, rows: list[dict]) → str

The panel’s read-out for one instance (a few lines).

qcc_kplugin.instance_values.sources(design_path, sidecar: dict | None = None) → dict

The raw inputs for design_path: {"targets", "lom", "results", "consensus"}.

qcc_kplugin.instance_values.worst(rows: list[dict]) → str
qcc_kplugin.instance_values.COLOURS
qcc_kplugin.instance_values.FEM_WORDS = ('fem', 'hfss', 'eigen', 'driven', 'q3d', 'palace', 'elmer', 'sonnet')
qcc_kplugin.instance_values.QUANTITIES = (('f_q_GHz', 'f_q', 'GHz'), ('alpha_MHz', 'α', 'MHz'), ('f_GHz', 'f_r', 'GHz'), ('kappa_MHz',...
qcc_kplugin.instance_values.RANK