Exemple #1
0
    def test_fock(self):
        qubit = Transmon("qubit", levels=3, kerr=-200e-3)
        cavity = Cavity("cavity", levels=10, kerr=-10e-6)
        system = System("system", modes=[qubit, cavity])

        with self.assertRaises(ValueError):
            system.fock(0)

        with self.assertRaises(ValueError):
            system.fock(0, qubit=0)
Exemple #2
0
    def test_rotations_pulse(self):
        q0 = Transmon("q0", levels=2)
        q1 = Transmon("q1", levels=3, kerr=-200e-3)
        q0.gaussian_pulse.sigma = 40
        q1.gaussian_pulse.sigma = 40
        system = System("system", modes=[q0, q1])
        init_state = system.fock()

        for qubit in [q0, q1]:
            for _ in range(1):
                _ = tune_rabi(system,
                              init_state=init_state,
                              mode_name=qubit.name,
                              verify=False)

        angles = np.linspace(-np.pi, np.pi, 5)
        for angle in angles:
            for qubit in [q0, q1]:
                seq = get_sequence(system)
                qubit.rotate_x(angle)
                unitary = qubit.rotate_x(angle, unitary=True)
                result = seq.run(init_state)
                fidelity = qutip.fidelity(result.states[-1],
                                          unitary * init_state)**2
                self.assertGreater(fidelity, 1 - 1e-2)

                seq = get_sequence(system)
                qubit.rotate_y(angle)
                unitary = qubit.rotate_y(angle, unitary=True)
                result = seq.run(init_state)
                fidelity = qutip.fidelity(result.states[-1],
                                          unitary * init_state)**2
                self.assertGreater(fidelity, 1 - 1e-2)
Exemple #3
0
    def setUpClass(cls):
        q0 = Transmon("q0", levels=2)
        q1 = Transmon("q1", levels=2)
        system = System("system", modes=[q0, q1])

        for qubit in [q0, q1]:
            init_state = system.fock()
            for _ in range(1):
                _ = tune_rabi(
                    system, init_state=init_state, mode_name=qubit.name, verify=False
                )

        cls.system = system
Exemple #4
0
 def test_displacement(self):
     c0 = Cavity("c0", levels=10, kerr=-10e-6)
     c1 = Cavity("c1", levels=12, kerr=-10e-6)
     system = System("system", modes=[c0, c1])
     init_state = system.fock()
     for cavity in [c0, c1]:
         for _ in range(1):
             _ = tune_displacement(system,
                                   init_state,
                                   mode_name=cavity.name,
                                   verify=False)
         for alpha in [0, 1, -1, 1j, -1j, 2, -2, 2j, -2j]:
             ideal_state = cavity.tensor_with_zero(
                 qutip.coherent(cavity.levels, alpha))
             seq = get_sequence(system)
             unitary = cavity.displace(alpha, unitary=True)
             cavity.displace(alpha)
             result = seq.run(init_state)
             unitary_fidelity = (qutip.fidelity(unitary * init_state,
                                                ideal_state)**2)
             pulse_fidelity = qutip.fidelity(result.states[-1],
                                             ideal_state)**2
             self.assertGreater(unitary_fidelity, 1 - 1e-4)
             self.assertGreater(pulse_fidelity, 1 - 1e-4)