Пример #1
0
    def test_anglecalCX(self):
        """
        Run the angle cal circuit generation and through the
        simulator to make sure there are no errors
        """

        self._circs, xdata = anglecal_cx_circuits(self._maxrep,
                                                  self._qubits,
                                                  self._controls,
                                                  angleerr=0.1)

        initial_theta = 0.18
        initial_c = 0.5

        fit = AngleCalCXFitter(self.run_sim([]), xdata, self._qubits,
                               fit_p0=[initial_theta, initial_c],
                               fit_bounds=([-np.pi, -1],
                                           [np.pi, 1]))

        self.assertAlmostEqual(fit.angle_err(0), 0.1, 2)
        self.assertAlmostEqual(fit.angle_err(1), 0.1, 2)
Пример #2
0
    '''
    Opens and maximizes the current figure.
    '''
    manager = plt.get_current_fig_manager()
    manager.window.showMaximized()


## Angle Error Characterization for CNOT Gates

# Measure angle error in CNOT gate wrt to angle of single qubit gates
qubits = [0, 2]
controls = [1, 3]
max_repetitions = 15
angle_error = 0.1
circuits, delay_times = anglecal_cx_circuits(max_repetitions,
                                             qubits,
                                             controls,
                                             angleerr=angle_error)

# Sets and runs simulator
backend = Aer.get_backend('qasm_simulator')
trials = 1000
result = execute(circuits, backend, shots=trials).result()

# Fits data to an oscillation
plt.figure(figsize=(10, 6))
theta, c = 0.02, 0.5
initial_parameter_bias = [theta, c]
lower_bounds, upper_bounds = [-np.pi, -1], [np.pi, 1]
angle_calibration_cnot_fit = AngleCalCXFitter(result,
                                              delay_times,
                                              qubits,