コード例 #1
0
 def test_experiment_config(self):
     """Test converting to and from config works"""
     exp = FineDrag(0, Gate("Drag", num_qubits=1, params=[]))
     config = exp.config()
     loaded_exp = FineDrag.from_config(config)
     self.assertNotEqual(exp, loaded_exp)
     self.assertEqual(config, loaded_exp.config())
コード例 #2
0
    def test_circuits(self):
        """Test the circuits of the experiment."""

        drag = FineDrag(0)
        drag.set_experiment_options(schedule=self.schedule)

        for circuit in drag.circuits(FakeArmonk())[1:]:
            for idx, name in enumerate(["Drag", "rz", "Drag", "rz"]):
                self.assertEqual(circuit.data[idx][0].name, name)
コード例 #3
0
    def test_end_to_end(self):
        """A simple test to check if the experiment will run and fit data."""

        drag = FineDrag(0, Gate("Drag", num_qubits=1, params=[]))
        drag.set_experiment_options(schedule=self.schedule)
        drag.set_transpile_options(basis_gates=["rz", "Drag", "sx"])
        exp_data = drag.run(FineDragTestBackend())

        self.assertEqual(exp_data.analysis_results(0).quality, "good")
コード例 #4
0
    def test_circuits(self):
        """Test the circuits of the experiment."""

        drag = FineDrag(0, Gate("Drag", num_qubits=1, params=[]))
        drag.set_experiment_options(schedule=self.schedule)
        drag.backend = FakeArmonk()
        for circuit in drag.circuits()[1:]:
            for idx, name in enumerate(["Drag", "rz", "Drag", "rz"]):
                self.assertEqual(circuit.data[idx][0].name, name)