mimiqcircuits.backends.progress¶
Progress reporting for LocalBackend.execute().
Mirrors the AbstractProgress sink in Julia AbstractQCSs.jl. The
execute driver and backends open named stages and advance them; the
concrete sink decides whether and how to render. NoProgress is
the zero-cost default; TqdmProgress draws bars with tqdm.
A sink is driven through three verbs, all no-ops on NoProgress:
progress.stage(name, total=...)opens a bar and returns a stage.stage.step(n=1)advances it.stage.finish()closes it.
The driver owns the trajectory bar and, on the single-evolve path, an
execution bar fed by the backend’s per-step callback. A backend with
a countable compression step emits its own stage by overriding
LocalBackend.compile_progress().
Functions
|
Wrap a per-step |
|
Normalise the user-facing |
Classes
Default sink: every verb is a no-op, so threading |
|
|
Sink for execution progress. |
|
A single progress bar opened by |
|
Render stages as tqdm bars. |
- class mimiqcircuits.backends.progress.Stage[source]¶
Bases:
ABCA single progress bar opened by
Progress.stage().
- class mimiqcircuits.backends.progress.NoProgress[source]¶
Bases:
ProgressDefault sink: every verb is a no-op, so threading
progressthrough the pipeline costs nothing when reporting is disabled.
- class mimiqcircuits.backends.progress.TqdmProgress(*, leave=False)[source]¶
Bases:
ProgressRender stages as tqdm bars.
leave=Falseclears each bar once its stage finishes so sequential stages do not pile up.
- mimiqcircuits.backends.progress.to_progress(progress)[source]¶
Normalise the user-facing
progress=argument: aProgresspasses through, aboolselects betweenTqdmProgressandNoProgress.
- mimiqcircuits.backends.progress.execution_progress_callback(progress, user, box)[source]¶
Wrap a per-step
callbackso the execution bar advances on each step the backend reports, then forwards touserunchanged.Backends report a step by calling
callback(i, total):iis the 1-based step index andtotalthe step count (orNonewhen unknown). The stage is opened lazily on the first step so its total comes from the backend.boxis a one-element list that receives the stage so the driver can close it once evolution returns.