Defines the WeakForwardSimulator calculator class

Module Contents



A calculator of circuit outcome probabilities from a "weak" forward simulator

class pygsti.forwardsims.weakforwardsim.WeakForwardSimulator(shots, model=None, base_seed=None)

Bases: pygsti.forwardsims.forwardsim.ForwardSimulator

A calculator of circuit outcome probabilities from a “weak” forward simulator (i.e. probabilites taken as average frequencies over a number of “shots”).

Due to their ability to only sample outcome probabilities, WeakForwardSimulators rely heavily on implementing the _compute_sparse_circuit_outcome_probabilities function of ForwardSimulators.

Construct a new WeakForwardSimulator object.


shots: int

Number of times to run each circuit to obtain an approximate probability


Optional parent Model to be stored with the Simulator

base_seed: int, optional

Base seed for RNG of probabilitic operations during circuit simulation. Incremented for every shot such that deterministic seeding behavior can be carried out with both serial or MPI execution. If not provided, falls back to using time.time() to get a valid seed.

bulk_probs(circuits, clip_to=None, resource_alloc=None, smartc=None)

Construct a dictionary containing the probabilities for an entire list of circuits.

circuitslist of Circuits

The list of circuits. May also be a CircuitOutcomeProbabilityArrayLayout object containing pre-computed quantities that make this function run faster.

clip_to2-tuple, optional

(min,max) to clip return value if not None.

resource_allocResourceAllocation, optional

A resource allocation object describing the available resources and a strategy for partitioning them.

smartcSmartCache, optional

A cache object to cache & use previously cached values inside this function.


A dictionary such that probs[circuit] is an ordered dictionary of outcome probabilities whose keys are outcome labels.