quantcore_circuits.autotrack ============================ .. py:module:: quantcore_circuits.autotrack .. autoapi-nested-parse:: Automatic run tracking: the library's own calls record into ``build//state.json`` for the dashboard. Switch it on with one line (``from quantcore_circuits import track; track.start("t04")``) or ``QCC_TRACK=1`` in the environment (a name instead of ``1`` names the run). From then on the hooks in the library report to the :class:`Session`: ========================= ===================================================================================== library call what the dashboard gets ========================= ===================================================================================== ``write_layout`` Layout step, design block, headless KLayout snapshot (``shots/chip*.png``, background) ``assembly.drc.check`` DRC counts on the Layout step ``circuit.fill.fill`` circuit (values, estimate vs FEM) and C-matrix, ``femCompare`` table, Extract step ``lom.simulate.simulate`` Hamiltonian step, targets with values, goal, plots, cards, one history row per design ``analysis.extract.*`` (old API) targets with values ``optimise.optimise`` one history row per evaluation, with the knobs ``loop.analyse/feedback`` as before (explicit :class:`~quantcore_circuits.track.Run` or the session's) FEM jobs under build/jobs a watcher thread polls ``job.json`` / ``solve.log`` / ``*_convergence.txt`` / ``results/results.json`` (and the tutorials' kept results) once a second ========================= ===================================================================================== Run naming: ``track.start("t04")`` records everything into ``build/t04`` whatever the design is called (the tutorial's revisions all land in one run); ``track.start()`` keeps one run per design name (``build/``, what ``loop.analyse`` and ``Run(design)`` use). ``build/_live.json`` points at the run that saw the latest event; ``qcc dashboard`` follows it. Nothing here may break a notebook: every handler is wrapped, a failure is logged once in the run's log. Attributes ---------- .. autoapisummary:: quantcore_circuits.autotrack.MAX_SHOTS quantcore_circuits.autotrack.POINTER Classes ------- .. autoapisummary:: quantcore_circuits.autotrack.Session Functions --------- .. autoapisummary:: quantcore_circuits.autotrack.quiet Module Contents --------------- .. py:class:: Session(name: str | None = None, root: str | pathlib.Path = 'build', reset: bool = True, snapshots: bool = True, watch: bool = True) .. py:method:: flush(timeout: float = 30.0) -> None Wait until the background jobs (snapshots, cards) queued so far are done (scripts, tests). .. py:method:: handle(event: str, kw: dict, run=None) -> None .. py:method:: on_compare(run, targets, extracted, design=None) The old extract/compare API: values vs targets. .. py:method:: on_drc(run, report, design) .. py:method:: on_fill(run, filled, job=None) .. py:method:: on_layout(run, result, path) .. py:method:: on_lom(run, result, filled) .. py:method:: on_optimise(run, index, knobs, metrics, error, tol, design) .. py:method:: on_optimise_end(run, converged, error=None, evaluations=0, design=None) .. py:method:: on_stage(run, step, phase, label='', detail='') A library stage (render / export): running → done / failed; nested stages of a step mark the outermost. .. py:method:: on_synthesis(run, targets, result) .. py:method:: run_for(design=None, model_name: str | None = None) The Run events about ``design`` (a Design, or None + ``model_name``) go to; made and reset on first use. .. py:method:: stop() .. py:attribute:: current :value: None .. py:attribute:: lom_designs :type: dict[str, dict[str, dict]] .. py:attribute:: lom_hashes :type: dict[str, list[str]] .. py:attribute:: lom_last :type: dict[str, tuple] .. py:attribute:: lom_rows :type: dict[str, dict[str, dict]] .. py:attribute:: name :value: None .. py:attribute:: pending :type: list[tuple[str, dict]] :value: [] .. py:attribute:: quiet_depth :value: 0 .. py:attribute:: reset :value: True .. py:attribute:: root .. py:attribute:: runs :type: dict[str, object] .. py:attribute:: snapshots :value: True .. py:function:: quiet(session) .. py:data:: MAX_SHOTS :value: 12 .. py:data:: POINTER :value: '_live.json'