Open pamulism opened 3 months ago
I am trying to run a small quantum circuit and generate the expectation value of an observable using the BackendEstimator primitive by incorporating the noise model from Fake20QV1 backend. Below is a snippet of the ending parts of the code.
.... my_service = QiskitRuntimeService()
my_service = QiskitRuntimeService()
backend_fake = Fake20QV1() noise_model = noise.NoiseModel.from_backend(backend_fake)
backend_fake = Fake20QV1()
noise_model = noise.NoiseModel.from_backend(backend_fake)
coupling_map = backend_fake.configuration().coupling_map
basis_gates = noise_model.basis_gates
backend = AerSimulator(noise_model=noise_model, coupling_map=coupling_map, basis_gates=basis_gates)
backend = AerSimulator(noise_model=noise_model,
coupling_map=coupling_map,
basis_gates=basis_gates)
with Session(backend=backend): sampler = BackendSampler() estimator = BackendEstimator() result1 = sampler.run(qc).result() print(f"Quasi-probability distribution: {result1.quasi_dists[0]}") result2 = estimator.run(qc, observable).result() print(f"Expectation Value : {result2.values[0]}")
with Session(backend=backend):
sampler = BackendSampler()
estimator = BackendEstimator()
result1 = sampler.run(qc).result()
print(f"Quasi-probability distribution: {result1.quasi_dists[0]}")
result2 = estimator.run(qc, observable).result()
print(f"Expectation Value : {result2.values[0]}")
Generates an error as shown below: .... 541 self._set_backend_config(name)
QiskitBackendNotFoundError: 'No backend matches the criteria.'
Informations
What is the current behavior?
I am trying to run a small quantum circuit and generate the expectation value of an observable using the BackendEstimator primitive by incorporating the noise model from Fake20QV1 backend. Below is a snippet of the ending parts of the code.
....
my_service = QiskitRuntimeService()
backend_fake = Fake20QV1()
noise_model = noise.NoiseModel.from_backend(backend_fake)
coupling_map = backend_fake.configuration().coupling_map
basis_gates = noise_model.basis_gates
backend = AerSimulator(noise_model=noise_model,
coupling_map=coupling_map,
basis_gates=basis_gates)
with Session(backend=backend):
sampler = BackendSampler()
estimator = BackendEstimator()
result1 = sampler.run(qc).result()
print(f"Quasi-probability distribution: {result1.quasi_dists[0]}")
result2 = estimator.run(qc, observable).result()
print(f"Expectation Value : {result2.values[0]}")
Generates an error as shown below: .... 541 self._set_backend_config(name)
QiskitBackendNotFoundError: 'No backend matches the criteria.'
Steps to reproduce the problem
What is the expected behavior?
Suggested solutions
What is the expected behavior?
What is the expected enhancement?