qcc_kplugin.design_ops ====================== .. py:module:: qcc_kplugin.design_ops .. autoapi-nested-parse:: design.json edits behind the Edit menu's rename / chip settings / junction / coupling / pad-edge actions. Plain Python (no pya), so they are unit-tested outside KLayout; ``edits.py`` holds the dialogs and menu actions. Every function changes the design dict in place (and returns it, or a description) and raises ``ValueError`` with a message fit for the status bar. Attributes ---------- .. autoapisummary:: qcc_kplugin.design_ops.KEEP qcc_kplugin.design_ops.RESERVED qcc_kplugin.design_ops.SUBSTRATE_KEYS Functions --------- .. autoapisummary:: qcc_kplugin.design_ops.apply_pad_edge qcc_kplugin.design_ops.fix_junction_at_placement qcc_kplugin.design_ops.pad_edge_instances qcc_kplugin.design_ops.rename_instance qcc_kplugin.design_ops.rename_route qcc_kplugin.design_ops.set_chip qcc_kplugin.design_ops.set_coupling qcc_kplugin.design_ops.set_junction qcc_kplugin.design_ops.set_substrate qcc_kplugin.design_ops.substrate_of Module Contents --------------- .. py:function:: apply_pad_edge(design: dict, names: list[str]) -> list[str] ``place.edge = "auto"`` on these instances (absolute placements): the build slides each pad perpendicular to its nearest die edge so its outer edge sits the PDK distance (100 µm) from it. Returns the names changed. .. py:function:: fix_junction_at_placement(design: dict, inst: str, values: dict | None) -> str | None A component placed with a junction gets its simulation / LOM values fixed in design.json (``junction = {Lj_nH, Cj_fF}``, from ``values``: ``guiflow.placement_junction``). An instance that has a ``junction`` already (a duplicate keeps its source's) is left alone. Returns the status-bar note, or None. .. py:function:: pad_edge_instances(drc: list[dict]) -> list[str] Instances named by the sidecar's ``pad_edge`` design warnings (a pad that is not at the PDK edge distance). .. py:function:: rename_instance(design: dict, old: str, new: str) -> dict Rename instance ``old`` to ``new`` everywhere the design refers to it: routes' ends, snap placements, targets, sim groups, couplings. Order of ``instances`` is kept. .. py:function:: rename_route(design: dict, old: str, new: str) -> dict Rename route ``old``: hanger ends that hang off it, targets, sim groups, couplings follow. .. py:function:: set_chip(design: dict, name_chip: str | None = None, with_grid: bool | None = None, size=None) -> list[str] Chip settings: the label written on the die (``chip.params.name_chip``), the ground-plane grid (``with_grid``), the die ``size`` = (width, height) µm (its lower left corner stays where it is). Returns what changed. .. py:function:: set_coupling(design: dict, name: str, a: str, b: str, kind: str = 'C', value: float | None = None, note: str = '') -> dict A lumped element between two instances / routes the layout implies (``couplings``). ``kind`` C (fF), L (nH) or wire (ports ``inst.port``, no value). .. py:function:: set_junction(design: dict, inst: str, lj_nh: float | None, cj_ff: float | None, flux_phi0=KEEP, asym=KEEP) -> bool The lumped junction values (LOM and simulation only, not fab values) of ``inst``, **merged into** its existing ``junction`` dict: ``Lj_nH`` (L_J0) and ``Cj_fF`` (None removes the key), and for a SQUID ``flux_phi0`` (Φ/Φ0) and ``asym`` (d), which are written only when non-zero (zero removes the key; ``KEEP`` leaves the stored value). Keys this function does not know stay as they are. The ``junction`` entry goes when nothing is left in it. Returns True when design.json changed. .. py:function:: set_substrate(design: dict, base_substrate: dict, h: float, eps_r: float, tan_d: float) -> str | None The design's own substrate: ``design["pdk"]`` becomes ``"+substrate(h=…,eps_r=…,tan_d=…)"`` with the values that differ from the PDK's ``base_substrate`` (all equal: the plain PDK name). Returns what changed, or None. .. py:function:: substrate_of(sidecar_pdk: dict) -> dict {"h", "eps_r", "tan_d"} the design uses now (from the sidecar's ``pdk``), PDK defaults when it has none. .. py:data:: KEEP .. py:data:: RESERVED :value: ('chip',) .. py:data:: SUBSTRATE_KEYS :value: ('h', 'eps_r', 'tan_d')