def test_analyses_instantiate_hcpb(self):
        """Test instantiation of Hcpb in analytic_transmon.py."""
        try:
            Hcpb()
        except Exception:
            self.fail("Hcpb() failed")

        try:
            Hcpb(nlevels=15)
        except Exception:
            self.fail("Hcpb(nlevels=15) failed")

        try:
            Hcpb(nlevels=15, Ej=13971.3)
        except Exception:
            self.fail("Hcpb(nlevels=15, Ej=13971.3) failed")

        try:
            Hcpb(nlevels=15, Ej=13971.3, Ec=295.2)
        except Exception:
            self.fail("Hcpb(nlevels=15, Ej=13971.3, Ec=295.2) failed")

        try:
            Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001)
        except Exception:
            self.fail(
                "Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001) failed")
 def test_analysis_transmon_charge_basis_evaluek(self):
     """Test the evaluek function in the Hcpb class."""
     hcpb = Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001)
     self.assertAlmostEqualRel(hcpb.evalue_k(0),
                               -11175.114908531536,
                               rel_tol=1e-6)
     self.assertAlmostEqualRel(hcpb.evalue_k(2),
                               -653.7652579628739,
                               rel_tol=1e-6)
    def test_analysis_transmon_charge_basis_evec_k(self):
        """Test the evec_k function in the Hcpb class."""
        hcpb = Hcpb(nlevels=2, Ej=13971.3, Ec=295.2, ng=0.001)

        expected = [
            0.434102035, 0.558197591, 0.000417109677, -0.557943545, -0.434361255
        ]
        actual = hcpb.evec_k(1)

        self.assertIterableAlmostEqual(expected, actual, abs_tol=1e-4)
Ejemplo n.º 4
0
 def test_analyses_instantiate_hcpb(self):
     """
     Test instantiation of Hcpb in analytic_transmon.py.
     """
     try:
         Hcpb()
     except Exception:
         self.fail("Hcpb failed")
 def test_analysis_transmon_charge_basis_n_ij(self):
     """Test the n_ij function in the Hcpb class."""
     hcpb = Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001)
     self.assertAlmostEqual(hcpb.n_ij(1, 2), 1.4670047579229986)
 def test_analysis_transmon_charge_basis_anharm(self):
     """Test the anharm function in the Hcpb class."""
     hcpb = Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001)
     self.assertAlmostEqual(hcpb.anharm(), -341.0281674078906)
    def test_analysis_transmon_charge_basis_fij(self):
        """Test the fij function in the Hcpb class."""
        hcpb = Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001)

        self.assertAlmostEqual(hcpb.fij(1, 2), 5090.160741580386)