Skip to content

Commit

Permalink
Merge pull request #67 from CQCL/release/1.21.0
Browse files Browse the repository at this point in the history
Release/1.21.0
  • Loading branch information
cqc-melf authored Oct 17, 2023
2 parents 610e1bf + 2c36e4f commit 525eaf5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.7.0"
__extension_version__ = "0.8.0"
__extension_name__ = "pytket-iqm"
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
~~~~~~~~~

0.8.0 (October 2023)
--------------------

* Don't include ``SimplifyInitial`` in default passes; instead make it an option
to ``process_circuits()``.
* Updated pytket version requirement to 1.21.

0.7.0 (October 2023)
--------------------

Expand Down
6 changes: 3 additions & 3 deletions pytket/extensions/iqm/backends/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def set_iqm_config(
"""Set default value for IQM API token."""
config = IQMConfig.from_default_config_file()
if auth_server_url is not None:
config.auth_server_url = auth_server_url # type: ignore
config.auth_server_url = auth_server_url
if username is not None:
config.username = username # type: ignore
config.username = username
if password is not None:
config.password = password # type: ignore
config.password = password
config.update_default_config_file()
25 changes: 15 additions & 10 deletions pytket/extensions/iqm/backends/iqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ def __init__(
config = IQMConfig.from_default_config_file()

if auth_server_url is None:
auth_server_url = config.auth_server_url # type: ignore
auth_server_url = config.auth_server_url
tokens_file = os.getenv("IQM_TOKENS_FILE")
if username is None:
username = config.username # type: ignore
username = config.username
if password is None:
password = config.password # type: ignore
password = config.password
if (username is None or password is None) and tokens_file is None:
raise IqmAuthenticationError()

Expand Down Expand Up @@ -182,12 +182,6 @@ def default_compilation_pass(self, optimisation_level: int = 1) -> BasePass:
passes.append(DelayMeasures())
passes.append(self.rebase_pass())
passes.append(RemoveRedundancies())
if optimisation_level >= 1:
passes.append(
SimplifyInitial(
allow_classical=False, create_all_qubits=True, xcirc=_xcirc
)
)
return SequencePass(passes)

@property
Expand All @@ -203,7 +197,13 @@ def process_circuits(
) -> List[ResultHandle]:
"""
See :py:meth:`pytket.backends.Backend.process_circuits`.
Supported kwargs: `postprocess`.
Supported `kwargs`:
- `postprocess`: apply end-of-circuit simplifications and classical
postprocessing to improve fidelity of results (bool, default False)
- `simplify_initial`: apply the pytket ``SimplifyInitial`` pass to improve
fidelity of results assuming all qubits initialized to zero (bool, default
False)
"""
circuits = list(circuits)
n_shots_list = Backend._get_n_shots_as_list(
Expand All @@ -216,6 +216,7 @@ def process_circuits(
self._check_all_circuits(circuits)

postprocess = kwargs.get("postprocess", False)
simplify_initial = kwargs.get("postprocess", False)

handles = []
for i, (c, n_shots) in enumerate(zip(circuits, n_shots_list)):
Expand All @@ -224,6 +225,10 @@ def process_circuits(
ppcirc_rep = ppcirc.to_dict()
else:
c0, ppcirc_rep = c, None
if simplify_initial:
SimplifyInitial(
allow_classical=False, create_all_qubits=True, xcirc=_xcirc
).apply(c0)
instrs = _translate_iqm(c0)
qm = {str(qb): _as_name(cast(Node, qb)) for qb in c.qubits}
iqmc = IQMCircuit(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
license="Apache 2",
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=["pytket ~= 1.20", "iqm-client ~= 14.0"],
install_requires=["pytket ~= 1.21", "iqm-client ~= 14.0"],
classifiers=[
"Environment :: Console",
"Programming Language :: Python :: 3.9",
Expand Down

0 comments on commit 525eaf5

Please sign in to comment.