Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CouplingMap to encoder #2026

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions qiskit_ibm_runtime/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
QuantumCircuit,
QuantumRegister,
)
from qiskit.transpiler import CouplingMap
from qiskit.circuit.parametertable import ParameterView
from qiskit.result import Result
from qiskit.version import __version__ as _terra_version_string
Expand Down Expand Up @@ -236,6 +237,8 @@ class RuntimeEncoder(json.JSONEncoder):
"""JSON Encoder used by runtime service."""

def default(self, obj: Any) -> Any: # pylint: disable=arguments-differ
if isinstance(obj, CouplingMap):
return list(obj)
if isinstance(obj, date):
return {"__type__": "datetime", "__value__": obj.isoformat()}
if isinstance(obj, complex):
Expand Down
2 changes: 2 additions & 0 deletions release-notes/unreleased/2026.bug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``CouplingMap`` was added to :class:`~.RuntimeEncoder` so it can now be passed to
the :class:`~.NoiseLearner` program.