コード例 #1
0
ファイル: test_noise.py プロジェクト: jwoehr/qiskit-aer
    def test_reset_gate_noise(self, method, device):
        """Test simulation with reset gate error noise model."""
        backend = self.backend(method=method, device=device)
        shots = 1000
        circuits = ref_reset_noise.reset_gate_error_circuits()
        noise_models = ref_reset_noise.reset_gate_error_noise_models()
        targets = ref_reset_noise.reset_gate_error_counts(shots)

        for circuit, noise_model, target in zip(circuits, noise_models,
                                                targets):
            backend.set_options(noise_model=noise_model)
            result = backend.run(circuit, shots=shots).result()
            self.assertSuccess(result)
            self.compare_counts(result, [circuit], [target], delta=0.05 * shots)
コード例 #2
0
    def test_reset_gate_noise(self):
        """Test simulation with reset gate error noise model."""
        shots = 1000
        circuits = ref_reset_noise.reset_gate_error_circuits()
        noise_models = ref_reset_noise.reset_gate_error_noise_models()
        targets = ref_reset_noise.reset_gate_error_counts(shots)

        for circuit, noise_model, target in zip(circuits, noise_models,
                                                targets):
            qobj = assemble(circuit, self.SIMULATOR, shots=shots)
            result = self.SIMULATOR.run(qobj,
                                        noise_model=noise_model,
                                        **self.BACKEND_OPTS).result()
            self.assertSuccess(result)
            self.compare_counts(result, [circuit], [target],
                                delta=0.05 * shots)
コード例 #3
0
ファイル: qasm_noise.py プロジェクト: ares201005/qiskit-aer
    def test_reset_gate_noise(self):
        """Test simulation with reset gate error noise model."""
        shots = 4000
        circuits = ref_reset_noise.reset_gate_error_circuits()
        noise_models = ref_reset_noise.reset_gate_error_noise_models()
        targets = ref_reset_noise.reset_gate_error_counts(shots)

        for circuit, noise_model, target in zip(circuits, noise_models,
                                                targets):
            qobj = assemble(circuit, self.SIMULATOR, shots=shots)
            result = self.SIMULATOR.run(
                qobj,
                backend_options=self.BACKEND_OPTS,
                noise_model=noise_model).result()
            self.assertTrue(getattr(result, 'success', False))
            self.compare_counts(result, [circuit], [target], delta=0.05 * shots)