Example #1
0
 def noisy_moment(self, moment: 'cirq.Moment',
                  system_qubits: Sequence['cirq.Qid']):
     if (_homogeneous_moment_is_measurements(moment)
             or self.is_virtual_moment(moment)):
         return moment
     else:
         gated_qubits = [
             q for q in system_qubits if moment.operates_on_single_qubit(q)
         ]
         return [
             moment,
             ops.Moment(
                 ops.DepolarizingChannel(self.depol_prob_map[q])(q)
                 for q in gated_qubits)
         ]
Example #2
0
 def __init__(
     self,
     depol_prob: float,
     bitflip_prob: float,
     decay_prob: float,
 ):
     """A depolarizing noise model with damped readout error.
     Args:
         depol_prob: Depolarizing probability.
         bitflip_prob: Probability of a bit-flip during measurement.
         decay_prob: Probability of T1 decay during measurement.
             Bitflip noise is applied first, then amplitude decay.
     """
     value.validate_probability(depol_prob, 'depol prob')
     value.validate_probability(bitflip_prob, 'bitflip prob')
     value.validate_probability(decay_prob, 'decay_prob')
     self.qubit_noise_gate = ops.DepolarizingChannel(depol_prob)
     self.readout_noise_gate = ops.BitFlipChannel(bitflip_prob)
     self.readout_decay_gate = ops.AmplitudeDampingChannel(decay_prob)