We're celebrating World Quantum Day 2022! Join us

cirq.devices.InsertionNoiseModel

Simple base noise model for inserting operations.

Inherits From: NoiseModel

Operations generated by this model for a given moment are all added into a single "noise moment", which is added before or after the original moment based on prepend.

ops_added a map of gate types (and optionally, qubits they act on) to operations that should be added. If two gate types provided apply to a target gate, the most specific type will match; if neither type is more specific (e.g. A is a subtype of B, but B defines qubits and A does not) then the first one appering in this dict will match.
prepend whether to add the new moment before the current one.
require_physical_tag whether to only apply noise to operations tagged with PHYSICAL_GATE_TAG.

ops_added Dataclass field
prepend Dataclass field
require_physical_tag Dataclass field

Methods

from_noise_model_like

View source

Transforms an object into a noise model if umambiguously possible.

Args
noise None, a cirq.NoiseModel, or a single qubit operation.

Returns
cirq.NO_NOISE when given None, cirq.ConstantQubitNoiseModel(gate) when given a single qubit gate, or the given value if it is already a cirq.NoiseModel.

Raises
ValueError If noise is a cirq.Gate that acts on more than one qubit.
TypeError The input is not a cirq.NOISE_MODE_LIKE.

is_virtual_moment

View source

Returns true iff the given moment is non-empty and all of its operations are virtual.

Moments for which this method returns True should not have additional noise applied to them.

Args
moment <a href="../../cirq/circuits/Moment"><code>cirq.Moment</code></a> to check for non-virtual operations.

Returns
True if "moment" is non-empty and all operations in "moment" are virtual; false otherwise.

noisy_moment

View source

Adds noise to the operations from a moment.

Args
moment The moment to add noise to.
system_qubits A list of all qubits in the system.

Returns
An OP_TREE corresponding to the noisy operations for the moment.

noisy_moments

View source

Adds possibly stateful noise to a series of moments.

Args
moments The moments to add noise to.
system_qubits A list of all qubits in the system.

Returns
A sequence of OP_TREEs, with the k'th tree corresponding to the noisy operations for the k'th moment.

noisy_operation

View source

Adds noise to an individual operation.

Args
operation The operation to make noisy.

Returns
An OP_TREE corresponding to the noisy operations implementing the noisy version of the given operation.

__eq__

prepend False
require_physical_tag True