qcc_kplugin.instance_values =========================== .. py:module:: qcc_kplugin.instance_values .. autoapi-nested-parse:: 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..`` (tolerances: :func:`design_io.target_tolerance`); * the LOM value: ``build//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//consensus.json`` (``chosen`` value and the relative spread between methods). Attributes ---------- .. autoapisummary:: qcc_kplugin.instance_values.COLOURS qcc_kplugin.instance_values.FEM_WORDS qcc_kplugin.instance_values.QUANTITIES qcc_kplugin.instance_values.RANK Functions --------- .. autoapisummary:: qcc_kplugin.instance_values.collect qcc_kplugin.instance_values.detail qcc_kplugin.instance_values.grade qcc_kplugin.instance_values.is_fem qcc_kplugin.instance_values.line qcc_kplugin.instance_values.readout qcc_kplugin.instance_values.sources qcc_kplugin.instance_values.worst Module Contents --------------- .. py:function:: 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. .. py:function:: detail(row: dict) -> tuple[str, str, str, str, str] Panel columns: LOM, FEM, consensus (± spread), target (± tolerance), grade. .. py:function:: 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). .. py:function:: is_fem(source) -> bool .. py:function:: line(row: dict) -> str One text line for the layout: ``f_q 5.228 GHz (target 5.1 ± 0.02)``. .. py:function:: readout(name: str, rows: list[dict]) -> str The panel's read-out for one instance (a few lines). .. py:function:: sources(design_path, sidecar: dict | None = None) -> dict The raw inputs for ``design_path``: ``{"targets", "lom", "results", "consensus"}``. .. py:function:: worst(rows: list[dict]) -> str .. py:data:: COLOURS .. py:data:: FEM_WORDS :value: ('fem', 'hfss', 'eigen', 'driven', 'q3d', 'palace', 'elmer', 'sonnet') .. py:data:: QUANTITIES :value: (('f_q_GHz', 'f_q', 'GHz'), ('alpha_MHz', 'α', 'MHz'), ('f_GHz', 'f_r', 'GHz'), ('kappa_MHz',... .. py:data:: RANK