quantcore_circuits.design.io

Load, save and hash designs.

Functions

canonical_json(data) → str

Deterministic JSON: sorted keys, no whitespace, floats normalised so 1 == 1.0.

design_hash(design[, extra, short]) → str

sha256 over the canonical design JSON plus tool versions (the results-store key).

group_hash(design, group[, short]) → str

design_hash() of what one sim group's jobs see: the design with only that group's spec (the others are

load_design(source) → quantcore_circuits.design.schema.Design

Load a design from a .json file, a .py file, a dict or a Design.

save_design(design, path) → pathlib.Path

tool_versions([pdk_name]) → dict[str, str]

Versions that change geometry or physics: quantcore-circuits, KQC, KLayout and the PDK.

Module Contents

quantcore_circuits.design.io.canonical_json(data: Any) → str

Deterministic JSON: sorted keys, no whitespace, floats normalised so 1 == 1.0.

quantcore_circuits.design.io.design_hash(design: quantcore_circuits.design.schema.Design, extra: dict | None = None, short: bool = True) → str

sha256 over the canonical design JSON plus tool versions (the results-store key).

targets are excluded: changing a target does not change geometry or simulation results.

quantcore_circuits.design.io.group_hash(design: quantcore_circuits.design.schema.Design, group: str, short: bool = True) → str

design_hash() of what one sim group’s jobs see: the design with only that group’s spec (the others are left out), so adding or changing another sim group (a new subset) does not make this group’s kept results look like another revision. Written to job.json as group_hash (additive; older jobs only have design_hash).

quantcore_circuits.design.io.load_design(source: str | pathlib.Path | dict | quantcore_circuits.design.schema.Design) → quantcore_circuits.design.schema.Design

Load a design from a .json file, a .py file, a dict or a Design.

A .py design file must define design (a dict or Design) or a function design() returning one.

quantcore_circuits.design.io.save_design(design: quantcore_circuits.design.schema.Design, path: str | pathlib.Path) → pathlib.Path
quantcore_circuits.design.io.tool_versions(pdk_name: str | None = None) → dict[str, str]

Versions that change geometry or physics: quantcore-circuits, KQC, KLayout and the PDK.