diff --git a/_metadata.py b/_metadata.py index 323ac76..567207f 100644 --- a/_metadata.py +++ b/_metadata.py @@ -1,2 +1,2 @@ -__extension_version__ = "0.7.0" +__extension_version__ = "0.8.0" __extension_name__ = "pytket-iqm" diff --git a/docs/changelog.rst b/docs/changelog.rst index c34bddf..d3e9177 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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) -------------------- diff --git a/pytket/extensions/iqm/backends/config.py b/pytket/extensions/iqm/backends/config.py index 7c14c5b..fb717b9 100644 --- a/pytket/extensions/iqm/backends/config.py +++ b/pytket/extensions/iqm/backends/config.py @@ -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() diff --git a/pytket/extensions/iqm/backends/iqm.py b/pytket/extensions/iqm/backends/iqm.py index 43585a6..472386f 100644 --- a/pytket/extensions/iqm/backends/iqm.py +++ b/pytket/extensions/iqm/backends/iqm.py @@ -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() @@ -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 @@ -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( @@ -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)): @@ -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( diff --git a/setup.py b/setup.py index 4ce20d9..a4af4aa 100644 --- a/setup.py +++ b/setup.py @@ -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",