def test_connectivity_check_subcircuit_not_connected(self): with self.assertRaises(ValueError): net = core._Network([ core.R(0, 1, 'Z'), core.C(1, 2, 'Z'), core.J(3, 4, 'Z'), core.J(3, 4, 'Z'), core.J(4, 5, 'Z'), ])
def parameters(self, C, L): circuit = core.Network([ core.C(0, 2, C), core.C(1, 3, C), core.J(0, 1, L), core.J(1, 2, L), core.J(2, 3, L), core.J(3, 0, L) ]) return circuit.f_k_A_chi()
def test_open_or_series_check(self): with self.assertRaises(ValueError): net = core._Network([ core.R(0, 1, 'Z'), core.C(1, 2, 'Z'), core.J(2, 3, 'Z'), ])
def test_error_when_trying_to_plot_from_Network_show_normal_modes(self): circuit = core.Network([ core.C(0,1,'C'), core.J(0,1,'Lj') ]) with self.assertRaises(TypeError): circuit.show_normal_mode()
def test_connectivity_check_single_element_not_connected(self): with self.assertRaises(ValueError): net = core._Network([ core.R(0, 1, "Z"), core.C(1, 2, "Z"), core.J(3, 4, "Z"), ])
def test_q_zpf(self): Cj = 100e-15 Lj = 10e-9 junction = core.J(0, 1, Lj) circuit = core.Network([core.C(0, 1, Cj), junction, core.R(0, 1, 1e6)]) Z = np.sqrt(Lj / Cj) q_zpf = np.sqrt(hbar / Z / 2) self.assertRelativelyClose( q_zpf / e, np.absolute(junction.zpf(mode=0, quantity='charge')))
def parameters(self, Cj, Lj, Cc, Cr, Lr): circuit = core.Network([ core.C(0, 1, Cj), core.J(0, 1, Lj), core.C(1, 2, Cc), core.C(0, 2, Cr), core.L(0, 2, Lr) ]) return circuit.f_k_A_chi()
def test_sweeping_LJ_in_fkAchi(self): cir = core.Network([ core.C(0, 1, 100e-15), core.J(0, 1, 'L_J'), core.C(1, 2, 1e-15), core.C(2, 0, 100e-15), core.L(2, 0, 10e-9), core.R(2, 0, 1e6) ]) [cir.f_k_A_chi(L_J=x) for x in [1e-9, 2e-9]]
def test_double_series_capacitor(self): C = 100e-15 Lj = 10e-9 circuit = core.Network( [core.C(0, 1, C * 2), core.C(1, 2, C * 2), core.J(0, 2, Lj)]) f, k, A, chi = circuit.f_k_A_chi() self.assertArrayRelativelyClose( [e**2 / 2. / C / h, 1 / (np.sqrt(C * Lj) * 2. * pi)], [A[0], f[0]])
def test_anharmonicity_using_hamiltonian(self): Cj = 1e-10 circuit = core.Network([core.C(0, 1, Cj), core.J(0, 1, 10e-9)]) H = circuit.hamiltonian(modes=[0], taylor=4, excitations=[10]) ee = H.eigenenergies() A = np.absolute((ee[1] - ee[0]) - (ee[2] - ee[1])) # Due to higher order terms, the mismatch with e**2/2/Cj/h is # (193702.3+0j) != (194712.7+0j) A_expected = 194712.7 self.assertRelativelyClose(A_expected, A)
def test_phi_zpf(self): Cj = 100e-15 Lj = 10e-9 junction = core.J(0, 1, Lj) circuit = core.Network([core.C(0, 1, Cj), junction, core.R(0, 1, 1e6)]) phi_0 = hbar / 2 / e Z = np.sqrt(Lj / Cj) phi_zpf = np.sqrt(hbar * Z / 2) self.assertRelativelyClose(phi_zpf / phi_0, junction.zpf(mode=0, quantity='flux'))
def test_sweeping_CJ_array_in_zpf(self): C_comp = core.C(0, 1, 'C_J') cir = core.Network([ C_comp, core.J(0, 1, 10e-9), core.C(1, 2, 1e-15), core.C(2, 0, 100e-15), core.L(2, 0, 10e-9), core.R(2, 0, 1e6) ]) self.assertRelativelyClose( C_comp.zpf(mode=1, quantity='charge', C_J=1.5e-9), C_comp.zpf(mode=1, quantity='charge', C_J=[1e-9, 1.5e-9, 3e-9])[1])
def parameters(self, C, Lj): circuit = core.Network([core.C(0, 1, C), core.J(0, 1, Lj)]) return circuit.f_k_A_chi()
def test_error_when_trying_to_plot_from_Network_show(self): circuit = core.Network([core.C(0, 1, "C"), core.J(0, 1, "Lj")]) with self.assertRaises(TypeError): circuit.show()