示例#1
0
def get_default_noise_dict():
    """Returns the current noise parameters"""
    default_noise_dict = {
        'X': ops.depolarize(1e-3),
        'Y': ops.depolarize(1e-3),
        'MS': ops.depolarize(1e-2),
        'crosstalk': 0.03
    }
    return default_noise_dict
示例#2
0
def _apply_depol_noise(pauli_error, moments, system_qubits):

    _sq_inds = np.arange(4)
    pauli_inds = np.array(list(product(_sq_inds, repeat=1)))
    num_inds = len(pauli_inds)
    p_other = pauli_error / (num_inds - 1)  # probability of X, Y, Z gates
    moments.append(ops.Moment(ops.depolarize(p_other)(q) for q in system_qubits))
    def build_noise_models(self) -> List['cirq.NoiseModel']:
        noise_models: List['cirq.NoiseModel'] = []

        if self.t1_ns:
            noise_models.append(
                devices.ThermalNoiseModel(
                    set(self.t1_ns.keys()),
                    self.gate_times_ns,
                    cool_rate_GHz={q: 1 / T1
                                   for q, T1 in self.t1_ns.items()},
                    dephase_rate_GHz={
                        q: 1 / Tp
                        for q, Tp in self.tphi_ns.items()
                    },
                ))

        depolarizing_error = self._depolarizing_error
        added_pauli_errors = {
            op_id: ops.depolarize(p_error, len(op_id.qubits)).on(*op_id.qubits)
            for op_id, p_error in depolarizing_error.items() if p_error > 0
        }

        # This adds per-qubit pauli error after ops on those qubits.
        noise_models.append(
            devices.InsertionNoiseModel(ops_added=added_pauli_errors))

        # This adds per-qubit measurement error BEFORE measurement on those qubits.
        if self.readout_errors:
            added_measure_errors: Dict[noise_utils.OpIdentifier,
                                       'cirq.Operation'] = {}
            for qubit in self.readout_errors:
                p_00, p_11 = self.readout_errors[qubit]
                p = p_11 / (p_00 + p_11)
                gamma = p_11 / p
                added_measure_errors[noise_utils.OpIdentifier(
                    ops.MeasurementGate,
                    qubit)] = ops.generalized_amplitude_damp(p,
                                                             gamma).on(qubit)

            noise_models.append(
                devices.InsertionNoiseModel(ops_added=added_measure_errors,
                                            prepend=True))

        return noise_models