PipelineResult¶
- class PipelineResult[source]¶
Bases:
dictPipeline result dict with convenience access for single-result pipelines.
Behaves exactly like a regular
dictkeyed byNodeKeytuples. For the common single-circuit case, use thevalueproperty instead ofresult[()].Attributes Summary
Return the single result value, unwrapped at the boundary.
Attributes Documentation
- value¶
Return the single result value, unwrapped at the boundary.
Pipelines store expectation values in a canonical
list[float]shape indexed by observable position. This accessor squeezes a length-1 list (single-observable expval) to a scalarfloatso casual callers get the natural shape — mirroring the scalar-in/scalar-out symmetry of higher-level programs likeTimeEvolution. Probability and count dicts pass through unchanged; multi-observable lists are returned as-is.result[()]gives the unsqueezed pipeline-internal form, but only when the spec stage’sreducecollapses its own axis (which the built-in spec stages do for single-circuit batches). Custom spec stages must mirror that behavior; if they do not, the result will not have a()key.evaluate()returns{param_set_idx: value}wherevalueis the unsqueezed form (e.g.[1.0]for a single expectation value, not1.0).When the source MetaCircuit was constructed with
_was_multi_obs=True(e.g. the user wroteobservable=[O]), the pipeline disables the squeeze and a length-1 list is returned as-is.- Raises:
ValueError – If the result contains more than one key.