quantcore_circuits.live.snapshot

KLayout screenshots of a layout, rendered by KLayout itself.

snapshot uses a headless klayout.lay.LayoutView with KQC’s default_layer_props.lyp (same colours and stipples as the GUI), so it works in Jupyter, CI and on the server. gui_snapshot asks the running KLayout GUI (quantcore-circuits KLayout plugin, command server on port 8083) to save its current view instead, falling back to snapshot when the GUI is not reachable.

Attributes

Functions

gui_available([port, timeout]) → bool

gui_snapshot(png[, size, layout, box, port, timeout, ...]) → tuple[pathlib.Path, str]

Screenshot from the running KLayout GUI (quantcore-circuits KLayout plugin, port 8083) → (png, "gui").

layer_props_path() → str | None

Quantcore layer properties: KQC's default_layer_props.lyp with the ground grid (cheese) visible and

snapshot(source, png[, size, box, background, ...]) → pathlib.Path

Render source (an .oas/.gds path or a BuildResult) to png.

Module Contents

quantcore_circuits.live.snapshot.gui_available(port: int = GUI_PORT, timeout: float = 0.3) → bool
quantcore_circuits.live.snapshot.gui_snapshot(png: str | pathlib.Path, size: tuple[int, int] = (1600, 1600), layout: str | pathlib.Path | None = None, box: tuple[float, float, float, float] | None = None, port: int = GUI_PORT, timeout: float = 20.0, fallback=None) → tuple[pathlib.Path, str]

Screenshot from the running KLayout GUI (quantcore-circuits KLayout plugin, port 8083) → (png, "gui").

layout makes the GUI open/reload that file first; box (µm) zooms. If the GUI is not reachable and fallback (a layout path or BuildResult; defaults to layout) exists, it is rendered headless instead → (png, "headless").

quantcore_circuits.live.snapshot.layer_props_path() → str | None

Quantcore layer properties: KQC’s default_layer_props.lyp with the ground grid (cheese) visible and every face shown like face 1t1.

KQC ships '1t1 ground grid' 132/1 hidden, which hid the PDK cheese band in every snapshot and KLayout view. KQC’s 2t1 group also shows its waveguide path (centre lines) and base metal gap for EBL and hides its base metal gap, unlike the other faces: here each face layer gets the visibility of the 1t1 layer of the same name, so a two-face picture has no centre lines over it. The variant is written next to the temp dir and refreshed when KQC’s file or this module changes; load it in KLayout (File → Load Layer Properties) to see the cheese there too.

quantcore_circuits.live.snapshot.snapshot(source, png: str | pathlib.Path, size: tuple[int, int] = (1600, 1600), box: tuple[float, float, float, float] | None = None, background: str = '#ffffff', oversampling: int = 2, hide: tuple[str, ...] = HIDE) → pathlib.Path

Render source (an .oas/.gds path or a BuildResult) to png.

box (µm, x0 y0 x1 y1) zooms to a region; default is the whole top cell. Layers whose names contain one of hide are switched off (helper layers that clutter a picture).

quantcore_circuits.live.snapshot.ANNOTATION_LAYERS = ('instance names', 'refpoints', 'annotations', 'texts')
quantcore_circuits.live.snapshot.GUI_PORT = 8083
quantcore_circuits.live.snapshot.HIDE = ('refpoints', 'ground grid avoidance', 'waveguide path', 'waveguide length', 'annotations', 'ports')
quantcore_circuits.live.snapshot.OUTLINE = ('chip boundary',)