quantcore_circuits.design.io ============================ .. py:module:: quantcore_circuits.design.io .. autoapi-nested-parse:: Load, save and hash designs. Functions --------- .. autoapisummary:: quantcore_circuits.design.io.canonical_json quantcore_circuits.design.io.design_hash quantcore_circuits.design.io.group_hash quantcore_circuits.design.io.load_design quantcore_circuits.design.io.save_design quantcore_circuits.design.io.tool_versions Module Contents --------------- .. py:function:: canonical_json(data: Any) -> str Deterministic JSON: sorted keys, no whitespace, floats normalised so 1 == 1.0. .. py:function:: 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. .. py:function:: group_hash(design: quantcore_circuits.design.schema.Design, group: str, short: bool = True) -> str :func:`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``). .. py:function:: 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 :class:`Design`. A ``.py`` design file must define ``design`` (a dict or :class:`Design`) or a function ``design()`` returning one. .. py:function:: save_design(design: quantcore_circuits.design.schema.Design, path: str | pathlib.Path) -> pathlib.Path .. py:function:: tool_versions(pdk_name: str | None = None) -> dict[str, str] Versions that change geometry or physics: quantcore-circuits, KQC, KLayout and the PDK.