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

Improve docs on saving IBM credentials #281

Merged
merged 11 commits into from
Mar 5, 2024
28 changes: 15 additions & 13 deletions docs/intro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ In this section we are assuming that you have set the following variables with t
group = '<your_group_here>'
project = '<your_project_here>'

.. note:: The documentation below is correct as of pytket-qiskit version 0.40.0 and newer. In the 0.40.0 release pytket-qiskit moved to using the `qiskit-ibm-provider <https://github.com/Qiskit/qiskit-ibm-provider>`_. In pytket-qiskit versions 0.39.0 and older the parameters ``hub``, ``group`` and ``project`` were handled separately instead of a single ``instance`` string as in 0.40.0 and newer.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to remove the version tags on purpose? Are both methods supported in the newest version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding qiskit no longer maintains a migration guide from IBMQ to IBMProvider

I think IBMQ provider was archieved some time ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method 1:
---------

::

Expand All @@ -99,11 +100,20 @@ If you are a member of an IBM hub then you can add this information to ``set_ibm

set_ibmq_config(ibmq_api_token=ibm_token, instance=f"{hub}/{group}/{project}")

.. currentmodule:: pytket.extensions.qiskit.backends.config

.. autosummary::
:nosignatures:

QiskitConfig
set_ibmq_config

Method 2:
---------

Alternatively you can use the following qiskit commands to save your credentials
locally without saving the token in pytket config:

.. note:: If using pytket-qiskit 0.39.0 or older you will have to use the deprecated :py:meth:`IBMQ.save_account` instead of :py:meth:`IBMProvider.save_account` in the code below.

::

from qiskit_ibm_provider import IBMProvider
Expand All @@ -122,19 +132,11 @@ To see which devices you can access you can use the ``available_devices`` method
my_instance=f"{hub}/{group}/{project}"
ibm_provider = IBMProvider(instance=my_instance)
backend = IBMQBackend("ibmq_nairobi") # Initialise backend for an IBM device

backendinfo_list = backend.available_devices(instance=my_instance, provider=ibm_provider)
print([backend.device_name for backend in backendinfo_list])


.. currentmodule:: pytket.extensions.qiskit.backends.config

.. autosummary::
:nosignatures:

QiskitConfig
set_ibmq_config


Converting circuits between pytket and qiskit
=============================================

Expand Down Expand Up @@ -192,7 +194,7 @@ Every :py:class:`Backend` in pytket has its own ``default_compilation_pass`` met
- `RemoveRedundancies <https://tket.quantinuum.com/api-docs/passes.html#pytket.passes.RemoveRedundancies>`_

* [1] If no value is specified then ``optimisation_level`` defaults to a value of 2.
* [2] self.rebase_pass is a rebase to the gateset supported by the backend, For IBM quantum devices that is {X, SX, Rz, CX}.
* [2] self.rebase_pass is a rebase to the gateset supported by the backend, For IBM quantum devices and emulators that is either {X, SX, Rz, CX} or {X, SX, Rz, ECR}. The more idealised Aer simulators have a much broader range of supported gates.
* [3] Here :py:class:`CXMappingPass` maps program qubits to the architecture using a `NoiseAwarePlacement <https://tket.quantinuum.com/api-docs/placement.html#pytket.placement.NoiseAwarePlacement>`_


Expand Down