# Generated from the package source. Do not edit. """A device's calibration snapshot, written as facts for the `quantum` module. A snapshot is a directory named for the device, holding `conf_.json` and `props_.json`, the two files Qiskit's fake backends ship for each device: its configuration and its calibration properties. `read` turns one into a `Device`, and `programs` turns that into DKE Python programs, each sized for one run, through `dke.factwriter`. Nothing here imports Qiskit; it reads the files. WHAT IS WRITTEN, by kind: - `Device.`: `qubits`; `snapshot_at`, the snapshot's own date; and `digest`, the snapshot's digest (`provenance.snapshot_digest`), which a result computed for the device records as the calibration it read. - `PhysicalQubit._q`: `device`, `index` (the qubit's number as text, which is how a compiled circuit's gates name it), `t1` and `t2` in microseconds, `readout_error`, and `measured_at`, the latest date among those three. - `Native._`: `device`, `op`, `a`, `b` for a pair, `error`, `length` in nanoseconds, and `measured_at`, the date the error was measured. A pair is ordered as the snapshot lists it, because a device may run a two-qubit operation one way round only. An operation keeps the device's name for it, except `cx`, which the module calls `cnot`. `reset`, `measure` and `delay` act on no state the module models and are not written. A value the snapshot lacks is not written, never as a placeholder, so a rule that asks whether a cell is empty is answered truly. A store refuses a program larger than a size it is set up with, so the size to split at is yours to pass, as `FactLoad` describes. Usage: dke-quantum-device --max-bytes N [--module M] print the programs, separated by a line holding only `# ---`""" import argparse import json import pathlib import sys from dataclasses import dataclass, field from datetime import datetime, timezone from dke.factwriter import FactLoad, sanitize from dke.quantum.provenance import snapshot_digest MODULE: ... SOURCE: ... RENAMED: ... NOT_OPERATIONS: ... UNITS: ... @dataclass class Qubit: subject: str index: str t1: float | None = None t2: float | None = None readout_error: float | None = None measured_at: str | None = None @dataclass class Native: subject: str op: str a: str b: str | None error: float | None = None length: float | None = None measured_at: str | None = None @dataclass class Device: name: str qubits: int snapshot_at: str digest: str physical: list[Qubit] = field(default_factory=list) natives: list[Native] = field(default_factory=list) skipped: dict[str, int] = field(default_factory=dict) def utc(stamp: str) -> str: """A snapshot date as RFC 3339 UTC, which is how DKE Python writes one. The snapshots carry an offset, and an instant is kept, not a wall clock.""" ... def read(directory: pathlib.Path) -> Device: """One snapshot directory, as a `Device`.""" ... def programs(dev: Device, *, max_bytes: int, module: str=MODULE) -> list[str]: """The programs that write `dev`, in the order they run, into a store holding the module as `module`, none larger than `max_bytes`. Each carries the load marker `Load.quantum_device__`, so a store can tell a load that finished from one that stopped part-way.""" ... def main(argv: list[str] | None=None) -> int: ...