Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
[pytket-qiskit] Remove characterisation property of backends (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Feb 17, 2022
1 parent d06cd0b commit 6a8d48f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion modules/pytket-qiskit/_metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.22.2"
__extension_version__ = "0.23.0"
__extension_name__ = "pytket-qiskit"
6 changes: 6 additions & 0 deletions modules/pytket-qiskit/docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
~~~~~~~~~

0.23.0 (unreleased)
-------------------

* Removed ``characterisation`` property of backends. (Use `backend_info`
instead.)

0.22.2 (February 2022)
----------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from collections import defaultdict
from logging import warning
from typing import (
Any,
Callable,
Dict,
List,
Expand Down Expand Up @@ -138,11 +137,6 @@ def __init__(self, backend_name: str):
def _result_id_type(self) -> _ResultIdTuple:
return (str, int)

@property
def characterisation(self) -> Optional[Dict[str, Any]]:
char = self._backend_info.get_misc("characterisation")
return cast(Dict[str, Any], char) if char else None

@property
def backend_info(self) -> BackendInfo:
return self._backend_info
Expand Down Expand Up @@ -493,7 +487,7 @@ def default_compilation_pass(self, optimisation_level: int = 1) -> BasePass:
else:
passlist.append(FullPeepholeOptimise())
arch = self._backend_info.architecture
if arch.coupling and self.characterisation:
if arch.coupling and self._backend_info.get_misc("characterisation"):
# architecture is non-trivial
passlist.append(
CXMappingPass(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,6 @@ def _get_provider(

return provider

@property
def characterisation(self) -> Dict[str, Any]:
return cast(Dict[str, Any], self._backend_info.get_misc("characterisation"))

@property
def backend_info(self) -> BackendInfo:
return self._backend_info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import json
from typing import (
cast,
Any,
Dict,
Optional,
List,
Expand Down Expand Up @@ -92,10 +91,6 @@ def __init__(
# cache of results keyed by job id and circuit index
self._ibm_res_cache: Dict[Tuple[str, int], ExperimentResult] = dict()

@property
def characterisation(self) -> Optional[Dict[str, Any]]:
return self._ibmq.characterisation

@property
def backend_info(self) -> BackendInfo:
return self._ibmq.backend_info
Expand Down
4 changes: 2 additions & 2 deletions modules/pytket-qiskit/tests/backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_process_characterisation() -> None:
def test_process_characterisation_no_noise_model() -> None:
my_noise_model = NoiseModel()
back = AerBackend(my_noise_model)
assert back.characterisation is None
assert back.backend_info.get_misc("characterisation") is None

c = Circuit(4).CX(0, 1).H(2).CX(2, 1).H(3).CX(0, 3).H(1).X(0)
c = back.get_compiled_circuit(c)
Expand Down Expand Up @@ -303,7 +303,7 @@ def test_process_characterisation_complete_noise_model() -> None:
)

back = AerBackend(my_noise_model)
char = cast(Dict[str, Any], back.characterisation)
char = cast(Dict[str, Any], back.backend_info.get_misc("characterisation"))

node_errors = cast(Dict, back.backend_info.all_node_gate_errors)
link_errors = cast(Dict, back.backend_info.all_edge_gate_errors)
Expand Down

0 comments on commit 6a8d48f

Please sign in to comment.