From 7389977b45369fe85248405b8d5938b79cd2cea3 Mon Sep 17 00:00:00 2001 From: "Diego M. Rodriguez" Date: Thu, 7 Dec 2017 17:35:03 +0100 Subject: [PATCH] Update documentation for IBM Q features --- Qconfig.py.default | 20 +++++++++++++----- README.md | 51 ++++++++++++++++++++++++++++++++++++++++------ doc/install.rst | 24 ++++++++++++++++++++-- 3 files changed, 82 insertions(+), 13 deletions(-) diff --git a/Qconfig.py.default b/Qconfig.py.default index e068411f95..127b66a93c 100644 --- a/Qconfig.py.default +++ b/Qconfig.py.default @@ -1,13 +1,23 @@ # Before you can use the jobs API, you need to set up an access token. # Log in to the Quantum Experience. Under "Account", generate a personal -# access token. Replace "None" below with the quoted token string. -# Uncomment the APItoken variable, and you will be ready to go. +# access token. Replace 'PUT_YOUR_API_TOKEN_HERE' below with the quoted +# token string. Uncomment the APItoken variable, and you will be ready to go. -#APItoken = "PUT_YOUR_API_TOKEN_HERE" +#APItoken = 'PUT_YOUR_API_TOKEN_HERE' config = { - "url": 'https://quantumexperience.ng.bluemix.net/api' + 'url': 'https://quantumexperience.ng.bluemix.net/api', + + # If you have access to IBM Q features, you also need to fill the "hub", + # "group", and "project" details. Replace "None" on the lines below + # with your details from Quantum Experience, quoting the strings, for + # example: 'hub': 'my_hub' + # You will also need to update the 'url' above, pointing it to your custom + # URL for IBM Q. + 'hub': None, + 'group': None, + 'project': None } if 'APItoken' not in locals(): - raise Exception("Please set up your access token. See Qconfig.py.") + raise Exception('Please set up your access token. See Qconfig.py.') diff --git a/README.md b/README.md index 650295d0ff..41c107fd5b 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ We are ready to try out some QASM examples, which runs via the local simulator. This is a simple superposition example. ```python -from qiskit import QuantumProgram +from qiskit import QuantumProgram, QISKitError, RegisterSizeError # Creating Programs create your first QuantumProgram object instance. Q_program = QuantumProgram() @@ -105,14 +105,53 @@ COMPLETED {'00': 509, '11': 515} ``` -You can also use QISKit to execute your code on a [real Quantum Chip](https://github.com/QISKit/ibmqx-backend-information). +### Executing your code on a real Quantum chip - First, get your API token: +You can also use QISKit to execute your code on a +[real Quantum Chip](https://github.com/QISKit/ibmqx-backend-information). +In order to do so, you need to configure the SDK for using the credentials for +your Quantum Experience Account: -- Create an [IBM Q experience](https://quantumexperience.ng.bluemix.net) account if you haven't already done so -- Get an API token from the IBM Q experience website under “My Account” > “Personal Access Token” -This API token allows you to execute your programs with the IBM Q experience backends. [Example](doc/example_real_backend.rst). +#### Configure your API token and QE credentials + + +1. Create an [IBM Q experience](https://quantumexperience.ng.bluemix.net)> + account if you haven't already done so +2. Get an API token from the IBM Q experience website under "`My Account`" > + "`Personal Access Token`". This API token allows you to execute your + programs with the IBM Q experience backends. + [Example](doc/example_real_backend.rst). +3. You will insert your API token in a file called `Qconfig.py`. First + copy the default version of this file from the tutorial folder to the + main SDK folder (on Windows, replace `cp` with `copy`): + + ```bash + $ cp Qconfig.py.default Qconfig.py + ``` + +4. Open your Qconfig.py, remove the `#` from the beginning of the API + token line, and copy/paste your API token into the space between the + quotation marks on that line. Save and close the file. + +5. If you have access to the IBM Q features, you also need to setup the + values for your hub, group, and project. You can do so by filling the + `config` variable with the values you can find on your IBM Q account + page. + +For example, a valid and fully configured `Qconfig.py` file would look like: + +```python +APItoken = '123456789abc...' + +config = { + 'url': 'https://quantumexperience.ng.bluemix.net/api', + # The following should only be needed for IBM Q users. + 'hub': 'MY_HUB', + 'group': 'MY_GROUP', + 'project': 'MY_PROJECT' +} +``` More details on this and more information see [our QISKit documentation](doc/qiskit.rst). diff --git a/doc/install.rst b/doc/install.rst index 772a2ba81c..0a337a2c58 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -84,8 +84,8 @@ with QISKit, and install the required dependencies: .\make env -4. Configure your API token ---------------------------- +4. Configure your API token and QE credentials +---------------------------------------------- - Create an `IBM Q experience `__ account if @@ -104,6 +104,26 @@ with QISKit, and install the required dependencies: token line, and copy/paste your API token into the space between the quotation marks on that line. Save and close the file. +- If you have access to the IBM Q features, you also need to setup the + values for your hub, group, and project. You can do so by filling the + ``config`` variable with the values you can find on your IBM Q account + page. + +For example, a valid and fully configured ``Qconfig.py`` file would look like: + +.. code:: python + + APItoken = '123456789abc...' + + config = { + 'url': 'https://quantumexperience.ng.bluemix.net/api', + # The following should only be needed for IBM Q users. + 'hub': 'MY_HUB', + 'group': 'MY_GROUP', + 'project': 'MY_PROJECT' + } + + Install Jupyter-based tutorials ===============================