Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
161 stars 157 forks source link

Passing coupling map to NoiseLearner fails #1992

Closed jyu00 closed 2 weeks ago

jyu00 commented 1 month ago

Describe the bug

Specifying a coupling map of type CouplingMap to NoiseLearner option fails with

TypeError: Object of type CouplingMap is not JSON serializable

Steps to reproduce

from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.options import SimulatorOptions
from qiskit_ibm_runtime.fake_provider import FakeAlgiers
from qiskit_ibm_runtime.noise_learner import NoiseLearner

service = QiskitRuntimeService()
fake = FakeAlgiers()

sim_options = SimulatorOptions()
sim_options.set_backend(fake)

learner = NoiseLearner(mode=backend)
learner.options.simulator = sim_options
job = learner.run([circuit_to_learn])

Expected behavior

Suggested solutions

Convert CouplingMap to a list, like how it was done for the primitives. Or better, add it to the json encoder.

Additional Information