Quantum Circuit Observables and Measurement Results: Counts, Probabilities, Quasi-Distributions, and Expectation Values
measurementresult handlingprobability distributionsQiskitCirqPennyLanequantum developer tooling

Quantum Circuit Observables and Measurement Results: Counts, Probabilities, Quasi-Distributions, and Expectation Values

CCoQubit Editorial Team
2026-11-14
8 min read

Learn how to validate and convert quantum counts, probabilities, samples, quasi-distributions, and expectation values across major SDKs.

Quantum SDKs can return counts, probabilities, samples, expectation values, or quasi-distributions for the same circuit. This guide explains what each result means, how to convert between formats, and which validation checks to perform before plotting a result or sending it into classical application code.

Overview

A quantum circuit does not usually return a single definitive answer. Measurement produces samples from a probability distribution, and a software development kit may expose those samples in several forms. The right format depends on the question your hybrid application is asking.

  • Counts record how many times each measured bitstring appeared.
  • Probabilities divide counts by the number of shots and are useful for plotting or comparing distributions.
  • Samples or measurement arrays preserve individual shot outcomes, which is useful for custom aggregation and statistical tests.
  • Expectation values summarize an observable, such as the average value of a Pauli operator.
  • Quasi-probabilities can contain negative values, typically after a reconstruction or mitigation procedure. They are not ordinary empirical frequencies.

The first rule of quantum measurement result handling is to preserve the original result object or raw data until validation is complete. Convert it into a common internal representation only after recording the backend, circuit, shot count, measurement layout, observable definition, and any mitigation or post-processing steps.

For a broader Python-focused introduction, see Quantum Measurement Results in Python. Result interpretation also depends on backend choice, transpilation, noise, and resource limits, so pair this workflow with your team's documentation for selecting quantum cloud backends.

The basic conversion

If a circuit produces counts C(b) for bitstring b and runs for N shots, the empirical probability is:

P(b) = C(b) / N

For example, counts of {'00': 492, '11': 508} from 1,000 shots become probabilities of 0.492 and 0.508. The missing bitstrings have an observed probability of zero, although their ideal probability may not be zero. With finite shots, the result is an estimate rather than an exact description of the circuit's underlying distribution.

Checklist by scenario

When you receive counts

  1. Confirm the shot count. It should normally equal the sum of all returned counts, unless the provider reports discarded, post-selected, or otherwise filtered shots separately.
  2. Identify the bitstring width. A missing key usually means zero observed occurrences, not a missing measurement register.
  3. Check bit ordering before interpreting a key as an integer or mapping it to a classical feature.
  4. Convert with explicit arithmetic rather than assuming the SDK has already normalized the values.
counts = {'00': 492, '11': 508}
shots = sum(counts.values())
probabilities = {state: count / shots for state, count in counts.items()}

Use counts when you need reproducibility, resampling, confidence estimates, or a direct view of shot noise. They are often the safest interchange format because the conversion to probabilities is straightforward and reversible when the shot count is retained.

When you need probabilities or a histogram

Before plotting, decide whether the x-axis represents bitstrings, integers, computational-basis states, or observable labels. Sort states deliberately. Lexicographic ordering, integer ordering, and SDK display ordering are not interchangeable. Also include zero-probability states when comparing two distributions over the same basis; otherwise a plot can hide differences caused by omitted keys.

For a normalized empirical distribution, check that:

abs(sum(probabilities.values()) - 1.0) < tolerance

A small tolerance is appropriate for floating-point arithmetic. A large discrepancy usually indicates a wrong denominator, filtered shots, duplicate aggregation, or a conversion error.

When you need samples or measurement arrays

Samples retain one outcome per shot, for example ['00', '11', '11', '00']. They are useful when a classical routine needs per-shot data, when you want to bootstrap an estimate, or when several observables are measured from the same shot record. They also require more careful memory handling than aggregated counts.

Check the array shape and axis meaning. A result may be represented as one integer per shot, one Boolean per qubit per shot, or a structured array with named measurement registers. Do not infer these dimensions from a printed preview. Read the result metadata or write an assertion against the expected shape.

When you need an expectation value

An expectation value is an average of observable outcomes, not a probability of a bitstring. For an observable with eigenvalues of plus or minus one, estimate it as:

<O> = (number of +1 outcomes - number of -1 outcomes) / shots

For a single-qubit Z measurement, bit 0 commonly maps to +1 and bit 1 to -1, giving <Z> = P(0) - P(1). That mapping must be verified for the observable and convention in use. A Pauli product, a Hamiltonian term, and a raw computational-basis bit are related but not identical result types.

When you receive a quasi-distribution

A quasi-distribution resembles a probability map but may contain negative entries or values above one. Treat it as a reconstructed estimator, not as a list of physical shot frequencies. Do not clip negative values, renormalize silently, or sample from it as though it were an ordinary probability distribution.

Record how it was produced, including the calibration, mitigation, inversion, or reconstruction method. Then check whether its total is close to one and report any negativity or other diagnostic supplied by the workflow. For noisy hardware post-processing guidance, see Quantum Error Mitigation Methods Compared.

Cross-SDK comparison

Names and return schemas change across SDK versions, so treat this table as a conceptual map and verify the installed version's documentation before copying code into production.

SDKCommon result formWhat to verify
QiskitCounts from measurement results; probability and expectation-value utilities may be available through result, primitive, or estimator workflows.Classical-register and bit-order conventions, result access methods, and whether a primitive returns an observable value rather than shot-level counts.
CirqMeasurement results commonly appear as arrays in a run result, while histogram utilities aggregate sampled values.Measurement key names, array axes, qubit order, and how multiple measurement keys are combined.
PennyLaneA quantum node can return samples, probabilities, expectation values, or variances according to its measurement process.Measurement declarations, shot configuration, wire order, and whether analytic or finite-shot execution was requested.
Amazon BraketTask results may expose measurement counts, measured results, probabilities, or device-specific result fields.Task schema, device and simulator behavior, qubit indexing, shot count, and provider-specific metadata.

In a multi-SDK application, define an adapter that converts provider output into a small internal schema such as counts, probabilities, samples, expectation_values, shots, qubit_order, and metadata. Keep the original provider response alongside the adapter output for debugging.

What to double-check

Normalization and denominators

Do not assume the requested shot count is the denominator. Use the number of valid observations actually represented by the result, and document exclusions. For expectation values, confirm whether the SDK has already averaged over shots, observables, or Hamiltonian terms.

Endianness and register order

The leftmost character in a displayed bitstring may correspond to the highest-indexed qubit, the first classical register, or another presentation choice. A Bell-state test is a useful diagnostic: prepare a circuit whose expected outcomes are known, then verify that the returned keys map to the intended qubits. Store an explicit wire-to-bit mapping rather than relying on memory.

Shot noise and uncertainty

Two executions of the same finite-shot circuit can produce different counts. Avoid treating small probability differences as meaningful without an uncertainty estimate or repeated-run comparison. For a binary probability estimated from independent shots, a basic standard-error approximation is sqrt(p(1-p)/N); use a method appropriate to your sampling design and observable when the result matters.

Mitigation artifacts

Mitigation can improve an estimator while making it less like a direct frequency distribution. Keep raw and processed results separate, label plots accordingly, and preserve calibration settings. If a quasi-distribution contains negative values, that is a signal to use an estimator-aware analysis path.

Conversion before classical processing

Before feeding results into a machine-learning model, optimizer, database, or dashboard, define the feature contract. Specify state ordering, vector length, treatment of absent states, normalization, numeric precision, and whether values are raw, simulated, hardware-measured, or mitigated. A model can consume a correctly shaped but semantically misordered vector without raising an error.

Common mistakes

  • Confusing counts with probabilities: a downstream routine may interpret 492 as a probability unless the conversion is explicit.
  • Assuming omitted states are impossible: they may simply have received zero samples.
  • Reversing bitstrings: this can make a correct circuit appear incorrect while leaving normalization unchanged.
  • Comparing incompatible result types: a Z expectation value should not be plotted beside a bitstring probability without clearly defining the transformation.
  • Clipping quasi-probabilities: this changes the estimator and can conceal mitigation behavior.
  • Dropping metadata: shot count, wire order, backend, seed, and mitigation settings are often necessary to reproduce an anomaly.
  • Testing only ideal simulations: noisy, finite-shot, transpiled, and hardware results can exercise different code paths.

Add result-validation tests to the same workflow as circuit tests. Include normalization checks, known-state circuits, endianness fixtures, empty or partial result handling, and regression cases for every provider adapter. Guidance on building these checks into CI/CD is available in CI/CD and Automated Tests for Hybrid Quantum-Classical Applications.

When to revisit

Revisit this checklist before seasonal planning or any release that changes a backend, SDK, provider integration, circuit compiler, measurement declaration, or post-processing method. Result object names, return schemas, ordering conventions, and default shot behavior can change between software releases or execution targets, even when the circuit source looks unchanged.

As a practical update routine:

  1. Run a known-state and a known-superposition circuit against every supported simulator or hardware path.
  2. Capture raw responses and compare their schemas with the adapter contract.
  3. Recheck normalization, bit ordering, array shapes, expectation-value signs, and quasi-distribution diagnostics.
  4. Compare raw, mitigated, and ideal-reference outputs separately.
  5. Update code examples and documentation after confirming the installed SDK versions, rather than copying an older result-access pattern unchanged.

For larger changes, pair result checks with resource estimates, noise-model tests, and transpilation comparisons. The goal is not merely to make a plot look plausible; it is to ensure that every value crossing from the quantum execution layer into classical application code has a documented meaning.

Related Topics

#measurement#result handling#probability distributions#Qiskit#Cirq#PennyLane#quantum developer tooling
C

CoQubit Editorial Team

Quantum Software Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.