quantcore_circuits.layouts.metal.geometry

Quantum Metal side of the metal:<Class> wrapper: class lookup, option handling and geometry extraction.

Quantum Metal is imported lazily (the first import takes 5–13 s), so importing this module is cheap and works inside the KLayout GUI, where Metal is usually not installed.

  • qlibrary_index() lists the qiskit_metal.qlibrary components by reading their source (no import).

  • template_options() / normalise_options() validate user options against the class defaults. Bare numbers on length options (defaults such as '30um') are µm, as everywhere in quantcore_circuits.

  • metal_geometry() instantiates the component once in a shared headless DesignPlanar at the origin with orientation 0, reads its rows of design.qgeometry.tables (poly, path, junction) and its pins, converts design units (mm) to µm, then deletes the component. Results are cached per (class, options, a, b).

The Element’s a/b drive Metal’s design variables cpw_width/cpw_gap, so Metal pins that default to cpw_width match the chip’s CPW.

Attributes

Classes

MetalClassInfo

MetalGeometry

A Metal component's geometry in µm (polygons as pya.DPolygon, paths already buffered).

MetalJunction

MetalPin

Functions

canonical_class_name(metal_class) → str

Canonical spelling of a Metal class reference (qlibrary class name, or a dotted path kept as is).

fillet_polyline(points, radius[, n]) → list[kqcircuits.pya_resolver.pya.DPoint]

Round the interior corners of a polyline with circular arcs of radius (reduced where segments are too

find_class_info(name) → MetalClassInfo | None

Look up a qlibrary class by name: exact, case-insensitive, or by module name (JJ_Manhattan).

flat_options(params) → dict

A metal cell's params with its options (a dict, or the JSON text of the PCell form, e.g. what the KLayout

is_length(default) → bool

A Metal option default that is a length: '455um'-style, or one of METAL_LENGTH_VARIABLES.

metal_class(metal_class_ref)

The QComponent class for a qlibrary name or a dotted path (imports Quantum Metal).

metal_geometry(metal_class_ref[, options_json, a, b]) → MetalGeometry

Instantiate a Metal component headless and return its geometry in µm (cached; treat the result as

normalise_options(metal_class_ref, options) → dict

Validate and normalise user options: unknown or placement options raise; bare numbers on length options

parse_um(value[, a, b]) → float

A Metal length ('455um', '0.455mm', 'cpw_width', or a bare number in mm) in µm.

qlibrary_index() → dict[str, MetalClassInfo]

All public QComponent classes of qiskit_metal.qlibrary, read from source (fast, no import).

qlibrary_root() → pathlib.Path | None

shared_design()

One headless DesignPlanar reused for every component (components are deleted after reading).

template_options(metal_class_ref) → dict

Default options of a Metal class (fresh copy; nested dicts included, e.g. _default_connection_pads).

user_options(metal_class_ref) → list[str]

Option names a user may set (the defaults minus placement and private _default_* templates).

Module Contents

class quantcore_circuits.layouts.metal.geometry.MetalClassInfo
category: str
description: str
is_route: bool
module: str
name: str
package: str
class quantcore_circuits.layouts.metal.geometry.MetalGeometry

A Metal component’s geometry in µm (polygons as pya.DPolygon, paths already buffered).

junctions: tuple[MetalJunction, ...] = ()
layers: dict
metal: tuple = ()
metal_class: str
options: dict
pins: dict
subtract: tuple = ()
class quantcore_circuits.layouts.metal.geometry.MetalJunction
name: str
points: tuple[tuple[float, float], ...]
width: float
class quantcore_circuits.layouts.metal.geometry.MetalPin
gap: float
middle: tuple[float, float]
name: str
normal: tuple[float, float]
width: float
quantcore_circuits.layouts.metal.geometry.canonical_class_name(metal_class: str) → str

Canonical spelling of a Metal class reference (qlibrary class name, or a dotted path kept as is).

quantcore_circuits.layouts.metal.geometry.fillet_polyline(points: list[kqcircuits.pya_resolver.pya.DPoint], radius: float, n: int = 64) → list[kqcircuits.pya_resolver.pya.DPoint]

Round the interior corners of a polyline with circular arcs of radius (reduced where segments are too short: each corner may use half of an interior segment, all of an end segment).

quantcore_circuits.layouts.metal.geometry.find_class_info(name: str) → MetalClassInfo | None

Look up a qlibrary class by name: exact, case-insensitive, or by module name (JJ_Manhattan).

quantcore_circuits.layouts.metal.geometry.flat_options(params: dict | None) → dict

A metal cell’s params with its options (a dict, or the JSON text of the PCell form, e.g. what the KLayout plugin’s parameter table writes) merged into the flat keys; a flat key wins, as in MetalComponent.qcc_params. The LOM and the design checks read the flat form.

quantcore_circuits.layouts.metal.geometry.is_length(default) → bool

A Metal option default that is a length: '455um'-style, or one of METAL_LENGTH_VARIABLES.

quantcore_circuits.layouts.metal.geometry.metal_class(metal_class_ref: str)

The QComponent class for a qlibrary name or a dotted path (imports Quantum Metal).

quantcore_circuits.layouts.metal.geometry.metal_geometry(metal_class_ref: str, options_json: str = '{}', a: float = 10.0, b: float = 6.0) → MetalGeometry

Instantiate a Metal component headless and return its geometry in µm (cached; treat the result as read-only). options_json holds normalised options (see normalise_options()).

quantcore_circuits.layouts.metal.geometry.normalise_options(metal_class_ref: str, options: dict) → dict

Validate and normalise user options: unknown or placement options raise; bare numbers on length options become µm strings (455 → '455um'); nested dicts (connection_pads) are normalised against their _default_<name> template.

quantcore_circuits.layouts.metal.geometry.parse_um(value, a: float = 10.0, b: float = 6.0) → float

A Metal length ('455um', '0.455mm', 'cpw_width', or a bare number in mm) in µm.

quantcore_circuits.layouts.metal.geometry.qlibrary_index() → dict[str, MetalClassInfo]

All public QComponent classes of qiskit_metal.qlibrary, read from source (fast, no import).

quantcore_circuits.layouts.metal.geometry.qlibrary_root() → pathlib.Path | None
quantcore_circuits.layouts.metal.geometry.shared_design()

One headless DesignPlanar reused for every component (components are deleted after reading).

quantcore_circuits.layouts.metal.geometry.template_options(metal_class_ref: str) → dict

Default options of a Metal class (fresh copy; nested dicts included, e.g. _default_connection_pads).

quantcore_circuits.layouts.metal.geometry.user_options(metal_class_ref: str) → list[str]

Option names a user may set (the defaults minus placement and private _default_* templates).

quantcore_circuits.layouts.metal.geometry.METAL_CATEGORY_OVERRIDES
quantcore_circuits.layouts.metal.geometry.METAL_LENGTH_VARIABLES = ('cpw_width', 'cpw_gap')
quantcore_circuits.layouts.metal.geometry.METAL_PACKAGE_CATEGORY
quantcore_circuits.layouts.metal.geometry.PLACEMENT_OPTIONS = ('pos_x', 'pos_y', 'orientation')
quantcore_circuits.layouts.metal.geometry.ROUTE_MAPPING
quantcore_circuits.layouts.metal.geometry.SPECIAL_LAYERS