quantcore_circuits.layouts.registry

Resolve design.json cell references to Element classes and introspect their ports.

Attributes

Functions

cell_ref(cls) → str

Canonical reference string for a class (inverse of resolve_cell()).

create_cell(layout, cls[, what]) → kqcircuits.pya_resolver.pya.Cell

cls.create that raises CellBuildError instead of silently producing an error cell.

default_params(cls) → dict

element_cell_ports(cls, cell, params) → dict[str, quantcore_circuits.layouts.ports.Port]

Ports of an already created element cell, with CPW widths.

element_outline(cls[, max_points]) → dict

A light outline of an element in its local frame, for a placement preview (the KLayout plugin's ghost):

element_ports(cls[, layout]) → dict[str, quantcore_circuits.layouts.ports.Port]

Ports of an element in its local frame (builds the cell in layout or a scratch layout).

element_schema(cls) → 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).

flip_chip_rf_ports(refpoints, p) → dict[str, quantcore_circuits.layouts.ports.Port]

KQC FlipChipConnectorRf names its CPW ends <face>_port (+ _corner), not port_<name>: a is

list_components([category, source, chips]) → collections.abc.Mapping

Components usable as cell (ref → class, resolved lazily), from catalog.catalog().

port_width_hook(cls)

qcc_port_widths of a class, or the KQC_PORT_WIDTHS entry of a KQC class, or None.

resolve_cell(ref) → type[kqcircuits.elements.element.Element]

Resolve a cell reference.

shape_params(cls, params) → dict

params with JSON shapes converted for the class's TypeShape parameters (design.json stores shapes as

trilayer_junction(cell_ref[, lj_nH, squid, pdk]) → tuple[dict, dict]

(params, junction) that make a qubit's junction the Quantcore trilayer junction (design decisions #6 / #21).

x_coupler_arms(p) → dict[str, list[tuple[float, float]]]

Centre lines of the four arms of KQC CapacitiveXCoupler (its build): arm-end refpoint name →

Module Contents

quantcore_circuits.layouts.registry.cell_ref(cls: type[kqcircuits.elements.element.Element]) → str

Canonical reference string for a class (inverse of resolve_cell()).

quantcore_circuits.layouts.registry.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 CellBuildError instead of silently producing an error cell.

quantcore_circuits.layouts.registry.default_params(cls: type[kqcircuits.elements.element.Element]) → dict
quantcore_circuits.layouts.registry.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 KQC_PORT_WIDTHS. KQC classes without port refpoints get theirs from 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}.

quantcore_circuits.layouts.registry.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.

quantcore_circuits.layouts.registry.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).

quantcore_circuits.layouts.registry.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).

quantcore_circuits.layouts.registry.flip_chip_rf_ports(refpoints: dict, p: dict) → dict[str, quantcore_circuits.layouts.ports.Port]

KQC FlipChipConnectorRf names its CPW ends <face>_port (+ _corner), not port_<name>: 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.

quantcore_circuits.layouts.registry.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 catalog.catalog().

Quantcore cells, KQC elements and Quantum Metal components (metal:<Class>); whole chips only with chips=True (or category="chip").

quantcore_circuits.layouts.registry.port_width_hook(cls: type[kqcircuits.elements.element.Element])

qcc_port_widths of a class, or the KQC_PORT_WIDTHS entry of a KQC class, or None.

quantcore_circuits.layouts.registry.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:<Class>" for a Quantum Metal qlibrary component ("metal:TransmonPocket").

quantcore_circuits.layouts.registry.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).

quantcore_circuits.layouts.registry.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:<Class>, 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)
quantcore_circuits.layouts.registry.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.

quantcore_circuits.layouts.registry.KQC_EXTRA_PORTS
quantcore_circuits.layouts.registry.KQC_PORT_WIDTHS