Exemplo n.º 1
0
    def test_active_modes(self):
        qubit = Transmon("qubit", levels=3, kerr=-200e-3)
        cavity = Cavity("cavity", levels=10, kerr=-10e-6)
        system = System("system", modes=[qubit])

        system.active_modes = [qubit]

        with self.assertRaises(ValueError):
            system.active_modes = [qubit, cavity]

        system.modes = [qubit, cavity]
        system.active_modes = [qubit, cavity]
        system.modes = [cavity]
        with self.assertRaises(ValueError):
            _ = system.active_modes
Exemplo n.º 2
0
    def test_order_modes(self):
        qubit = Transmon("qubit", levels=3, kerr=-200e-3)
        cavity = Cavity("cavity", levels=10, kerr=-10e-6)

        system = System("system", modes=[qubit, cavity])
        system.order_modes = True
        system.active_modes = [qubit, cavity]
        self.assertEqual(system.modes, [qubit, cavity])
        self.assertEqual(system.active_modes, [qubit, cavity])
        system.active_modes = [cavity, qubit]
        self.assertEqual(system.modes, [qubit, cavity])
        self.assertEqual(system.active_modes, [qubit, cavity])

        system = System("system", modes=[qubit, cavity])
        system.order_modes = False
        system.active_modes = [qubit, cavity]
        self.assertEqual(system.modes, [qubit, cavity])
        self.assertEqual(system.active_modes, [qubit, cavity])
        system.active_modes = [cavity, qubit]
        self.assertEqual(system.modes, [qubit, cavity])
        self.assertEqual(system.active_modes, [cavity, qubit])