CircuitSpecStage

class CircuitSpecStage[source]

Bases: SpecStage[MetaCircuit | Sequence[MetaCircuit] | Mapping[str, MetaCircuit]]

SpecStage that wraps one or more pre-built MetaCircuits into a batch.

Accepts three input shapes:

  • A single MetaCircuit{(("circuit", 0),): meta}

  • A Sequence[MetaCircuit] → indexed by position

  • A Mapping[str, MetaCircuit] → indexed by key name

Use this when the MetaCircuit(s) are already constructed and don’t need Hamiltonian decomposition.

Attributes Summary

axis_name

Axis name introduced by this stage.

Methods Summary

expand(batch, env)

Wrap input MetaCircuit(s) into a keyed batch.

introspect(batch, env, token)

Return stage-specific metadata for dry-run reporting.

reduce(results, env, token)

Strip the 'circuit' axis from result keys.

Attributes Documentation

axis_name

Methods Documentation

expand(batch, env)[source]

Wrap input MetaCircuit(s) into a keyed batch.

Return type:

tuple[dict[tuple[tuple[str, Hashable], ...], MetaCircuit], Any]

introspect(batch, env, token)[source]

Return stage-specific metadata for dry-run reporting.

Override in subclasses to provide richer introspection data. Called by the dry-run tool after expand with the post-expand batch, the pipeline env, and the stage’s token.

Return type:

dict[str, Any]

reduce(results, env, token)[source]

Strip the 'circuit' axis from result keys.

Return type:

dict[Any, Any]