quantcore_circuits.layouts.registry =================================== .. py:module:: quantcore_circuits.layouts.registry .. autoapi-nested-parse:: Resolve ``design.json`` cell references to Element classes and introspect their ports. Attributes ---------- .. autoapisummary:: quantcore_circuits.layouts.registry.KQC_EXTRA_PORTS quantcore_circuits.layouts.registry.KQC_PORT_WIDTHS Functions --------- .. autoapisummary:: quantcore_circuits.layouts.registry.cell_ref quantcore_circuits.layouts.registry.create_cell quantcore_circuits.layouts.registry.default_params quantcore_circuits.layouts.registry.element_cell_ports quantcore_circuits.layouts.registry.element_outline quantcore_circuits.layouts.registry.element_ports quantcore_circuits.layouts.registry.element_schema quantcore_circuits.layouts.registry.flip_chip_rf_ports quantcore_circuits.layouts.registry.list_components quantcore_circuits.layouts.registry.port_width_hook quantcore_circuits.layouts.registry.resolve_cell quantcore_circuits.layouts.registry.shape_params quantcore_circuits.layouts.registry.trilayer_junction quantcore_circuits.layouts.registry.x_coupler_arms Module Contents --------------- .. py:function:: cell_ref(cls: type[kqcircuits.elements.element.Element]) -> str Canonical reference string for a class (inverse of :func:`resolve_cell`). .. py:function:: create_cell(layout: kqcircuits.pya_resolver.pya.Layout, cls: type[kqcircuits.elements.element.Element], what: str = '', **params) -> kqcircuits.pya_resolver.pya.Cell ``cls.create`` that raises :class:`CellBuildError` instead of silently producing an error cell. .. py:function:: default_params(cls: type[kqcircuits.elements.element.Element]) -> dict .. py:function:: element_cell_ports(cls: type[kqcircuits.elements.element.Element], cell: kqcircuits.pya_resolver.pya.Cell, params: dict) -> dict[str, quantcore_circuits.layouts.ports.Port] Ports of an already created element cell, with CPW widths. ``a``/``b`` come from the element parameters; a class may override them per port with a classmethod ``qcc_port_widths(params) -> {port_name: (a, b)}`` (e.g. the Xmon claw tails); KQC classes get theirs from :data:`KQC_PORT_WIDTHS`. KQC classes without port refpoints get theirs from :data:`KQC_EXTRA_PORTS` (a Quantcore class: its static method ``qcc_extra_ports``). A multi-face class records each port's chip face with a classmethod ``qcc_port_faces(params) -> {port_name: face_id}``. .. py:function:: element_outline(cls: type[kqcircuits.elements.element.Element], max_points: int = 400, **params) -> dict A light outline of an element in its local frame, for a placement preview (the KLayout plugin's ghost): ``{"bbox": [x0, y0, x1, y1], "outline": [[[x, y], ...], ...], "ports": [...]}`` in µm. The outline is the merged etched shape (the ``base_metal_gap`` layers; else every drawn layer), smoothed so the preview stays a few hundred points; a shape too fine to keep (junction fingers) is dropped, the bbox always stays. .. py:function:: element_ports(cls: type[kqcircuits.elements.element.Element], layout: kqcircuits.pya_resolver.pya.Layout | None = None, **params) -> dict[str, quantcore_circuits.layouts.ports.Port] Ports of an element in its local frame (builds the cell in ``layout`` or a scratch layout). .. py:function:: element_schema(cls: type[kqcircuits.elements.element.Element]) -> list[dict] The parameters a designer edits, for the KLayout panel: ``[{"name", "default", "type", "description", "unit", "choices"}]`` (JSON-safe defaults; internal / face / EPR parameters left out). .. py:function:: flip_chip_rf_ports(refpoints: dict, p: dict) -> dict[str, quantcore_circuits.layouts.ports.Port] KQC ``FlipChipConnectorRf`` names its CPW ends ``_port`` (+ ``_corner``), not ``port_``: ``a`` is the end on ``face_ids[0]`` (CPW a/b), ``b`` the end on ``face_ids[1]`` (CPW a2/b2, -1 = a/b), each facing out and recording its face. .. py:function:: list_components(category: str | None = None, source: str | None = None, chips: bool = False) -> collections.abc.Mapping Components usable as ``cell`` (``ref → class``, resolved lazily), from :func:`.catalog.catalog`. Quantcore cells, KQC elements and Quantum Metal components (``metal:``); whole chips only with ``chips=True`` (or ``category="chip"``). .. py:function:: port_width_hook(cls: type[kqcircuits.elements.element.Element]) ``qcc_port_widths`` of a class, or the :data:`KQC_PORT_WIDTHS` entry of a KQC class, or None. .. py:function:: resolve_cell(ref: str) -> type[kqcircuits.elements.element.Element] Resolve a cell reference. Accepts a dotted class path (``"kqcircuits.qubits.swissmon.Swissmon"``, ``"quantcore_circuits.layouts.Xmon"``), a bare class name of any quantcore_circuits/KQC PCell (``"Xmon"``, ``"Swissmon"``, ``"FingerCapacitorSquare"``), or ``"metal:"`` for a Quantum Metal qlibrary component (``"metal:TransmonPocket"``). .. py:function:: shape_params(cls: type[kqcircuits.elements.element.Element], params: dict) -> dict ``params`` with JSON shapes converted for the class's ``TypeShape`` parameters (``design.json`` stores shapes as point lists; KQC expects ``pya.DPath``/``DPolygon``). .. py:function:: trilayer_junction(cell_ref: str, lj_nH: float | None = None, squid: bool = False, pdk=None) -> tuple[dict, dict] ``(params, junction)`` that make a qubit's junction the Quantcore trilayer junction (design decisions #6 / #21). ``params`` are the instance parameters to merge: ``junction_type`` = ``"Quantcore Junction"`` (``squid``: ``"Quantcore Squid"``) plus, when ``lj_nH`` is given, the sizing for that L_J (SQUID: the parallel total) on the PDK junction rule — ``junction_params: {"lj_nH": ...}`` for cells that forward one (Xmon, ``metal:``, the QPDK / SQDMetal qubits), KQC's ``junction_width`` (straight finger, µm; bent finger at the PDK 0.6 µm) for KQC qubits. ``junction`` is the drawn junction's ``{"Lj_nH", "Cj_fF"}`` for the instance's ``junction`` (LOM). Without ``lj_nH`` the PDK nominal device is drawn: a 0.5 × 0.6 µm junction (45 kΩ) or a SQUID whose parallel R_n is 45 kΩ (two 0.25 × 0.6 µm junctions of 90 kΩ; the window is for the whole SQUID, 2026-11-13). >>> params, junction = trilayer_junction("Swissmon", lj_nH=12.0) >>> d.add("QB", "Swissmon", junction=junction, **params) # doctest: +SKIP .. py:function:: x_coupler_arms(p: dict) -> dict[str, list[tuple[float, float]]] Centre lines of the four arms of KQC ``CapacitiveXCoupler`` (its ``build``): arm-end refpoint name → ``[end, (bend), capacitor centre]`` in µm. Each arm is a CPW (the element a/b) from its end through a FingerCapacitorSquare (at the last point) to the centre splitter at the origin. '+': p11 S, p21 E, p31 N, p41 W; 'x': the corners (p11 lower left, counter-clockwise), with a straight lead along the longer side when the box is not square. .. py:data:: KQC_EXTRA_PORTS .. py:data:: KQC_PORT_WIDTHS