Exemplo n.º 1
0
    def test_rabi_two_levels(self):
        qubit = Transmon("qubit", levels=2)
        system = System("system", modes=[qubit])
        for _ in range(2):
            _, old_amp, new_amp = tune_rabi(system, qubit.fock(0))
        self.assertLess(abs(old_amp - new_amp), 1e-7)

        init = qubit.fock(0)
        seq = get_sequence(system)
        qubit.rotate_x(np.pi)
        result = seq.run(init)

        target = qubit.Rx(np.pi) * init
        fidelity = qutip.fidelity(result.states[-1], target)**2
        self.assertLess(abs(1 - fidelity), 1e-10)
Exemplo n.º 2
0
    def test_rotations_unitary(self):
        q0 = Transmon("q0", levels=2)
        q1 = Transmon("q1", levels=3)

        for full_space in [True, False]:
            self.assertEqual(
                q0.rotate_x(np.pi / 2, unitary=True, full_space=full_space),
                q0.Rx(np.pi / 2, full_space=full_space),
            )
            self.assertEqual(
                q0.rotate_y(np.pi / 2, unitary=True, full_space=full_space),
                q0.Ry(np.pi / 2, full_space=full_space),
            )
            self.assertEqual(
                q1.rotate_x(np.pi / 2, unitary=True, full_space=full_space),
                q1.Rx(np.pi / 2, full_space=full_space),
            )
            self.assertEqual(
                q1.rotate_y(np.pi / 2, unitary=True, full_space=full_space),
                q1.Ry(np.pi / 2, full_space=full_space),
            )

        q0.space = q1.space = [q1, q0]

        for full_space in [True, False]:
            self.assertEqual(
                q0.rotate_x(np.pi / 2, unitary=True, full_space=full_space),
                q0.Rx(np.pi / 2, full_space=full_space),
            )
            self.assertEqual(
                q0.rotate_y(np.pi / 2, unitary=True, full_space=full_space),
                q0.Ry(np.pi / 2, full_space=full_space),
            )
            self.assertEqual(
                q1.rotate_x(np.pi / 2, unitary=True, full_space=full_space),
                q1.Rx(np.pi / 2, full_space=full_space),
            )
            self.assertEqual(
                q1.rotate_y(np.pi / 2, unitary=True, full_space=full_space),
                q1.Ry(np.pi / 2, full_space=full_space),
            )
Exemplo n.º 3
0
    def test_drag(self):
        qubit = Transmon("qubit", levels=3, kerr=-200e-3)
        qubit.gaussian_pulse.sigma = 10
        system = System("system", modes=[qubit])
        for _ in range(3):
            _, old_amp, new_amp = tune_rabi(system,
                                            qubit.fock(0),
                                            plot=False,
                                            verify=False)
        self.assertLess(abs(old_amp - new_amp), 1e-7)

        _, old_drag, new_drag = tune_drag(system, qubit.fock(0), update=True)
        self.assertNotAlmostEqual(new_drag, 0)

        init = qubit.fock(0)
        seq = get_sequence(system)
        qubit.rotate_x(np.pi)
        result = seq.run(init)

        target = qubit.Rx(np.pi) * init
        fidelity = qutip.fidelity(result.states[-1], target)**2
        self.assertLess(abs(1 - fidelity), 1e-5)