Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit fc8978d

Browse files
diego-plan9jaygambetta
authored andcommitted
Update terra-related tutorials for IBMQProvider 0.3 (#738)
* Update IBMQ instructions in several qiskit/ files * qiskit/aer/device_noise_simulation.ipynb * qiskit/jupyter/jupyter_backend_tools.ipynb * qiskit/terra/backend_monitoring_tools.ipynb * qiskit/terra/calibrating_a_qubit.ipynb * qiskit/terra/device_mapping.ipynb * qiskit/terra/reduced_backends.ipynb * Update 1_getting_started_with_qiskit.ipynb * Update qiskit/basics/2_the_ibmq_provider.ipynb
1 parent ea3588a commit fc8978d

8 files changed

Lines changed: 121 additions & 236 deletions

qiskit/aer/device_noise_simulation.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
],
8585
"source": [
8686
"# Load IBMQ account\n",
87-
"IBMQ.load_accounts(hub=None)\n",
88-
"IBMQ.backends()"
87+
"provider = IBMQ.load_account()\n",
88+
"provider.backends()"
8989
]
9090
},
9191
{
@@ -106,7 +106,7 @@
106106
},
107107
"outputs": [],
108108
"source": [
109-
"device = IBMQ.get_backend('ibmq_16_melbourne')\n",
109+
"device = provider.get_backend('ibmq_16_melbourne')\n",
110110
"properties = device.properties()\n",
111111
"coupling_map = device.configuration().coupling_map"
112112
]
@@ -314,7 +314,7 @@
314314
],
315315
"source": [
316316
"# Select the ibmq_qasm_simulator from the IBMQ provider\n",
317-
"simulator = IBMQ.get_backend('ibmq_qasm_simulator')\n",
317+
"simulator = provider.get_backend('ibmq_qasm_simulator')\n",
318318
"\n",
319319
"# Execute noisy simulation and get counts\n",
320320
"result_noise = execute(circ, simulator, \n",

qiskit/basics/1_getting_started_with_qiskit.ipynb

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@
537537
"## Running circuits using the IBM Q provider <a id='ibmq_provider'></a>\n",
538538
"\n",
539539
"To faciliate access to real quantum computing hardware, we have provided a simple API interface.\n",
540-
"To access IBM Q devices, you'll need an API token. For the public IBM Q devices, you can generate an API token [here](https://quantumexperience.ng.bluemix.net/qx/account/advanced) (create an account if you don't already have one). For Q Network devices, login to the q-console, click your hub, group, and project, and expand \"Get Access\" to generate your API token and access url.\n",
540+
"To access IBM Q devices, you'll need an API token. For the public IBM Q devices, you can generate an API token [here](https://quantum-computing.ibm.com/account) (create an account if you don't already have one). For Q Network devices, login to the q-console, click your hub, group, and project, and expand \"Get Access\" to generate your API token and access url.\n",
541541
"\n",
542542
"Our IBM Q provider lets you run your circuit on real devices or on our HPC simulator. Currently, this provider exists within Qiskit, and can be imported as shown below. For details on the provider, see [The IBM Q Provider](2_the_ibmq_provider.ipynb)."
543543
]
@@ -560,7 +560,7 @@
560560
"cell_type": "markdown",
561561
"metadata": {},
562562
"source": [
563-
"After generating your API token, call: `IBMQ.save_account('MY_TOKEN')`. For Q Network users, you'll also need to include your access url: `IBMQ.save_account('MY_TOKEN', 'URL')`\n",
563+
"After generating your API token, call: `IBMQ.save_account('MY_TOKEN')`.\n",
564564
"\n",
565565
"This will store your IBM Q credentials in a local file. Unless your registration information has changed, you only need to do this once. You may now load your accounts by calling,"
566566
]
@@ -576,14 +576,17 @@
576576
},
577577
"outputs": [],
578578
"source": [
579-
"IBMQ.load_accounts(hub=None)"
579+
"provider = IBMQ.load_account()"
580580
]
581581
},
582582
{
583583
"cell_type": "markdown",
584584
"metadata": {},
585585
"source": [
586-
"Once your account has been loaded, you can view the list of backends available to you."
586+
"Once your account has been loaded, you can view the list of backends available to you using the `provider` instance.\n",
587+
"\n",
588+
"<div class=\"alert alert-block alert-info\">\n",
589+
"<b>Note:</b> The use of `provider` instances is the default way of retrieving backends from Qiskit 0.11 onwards - if you have been using earlier versions of Qiskit, check the next notebook for more detailed instructions on updating and using the different options.</div>"
587590
]
588591
},
589592
{
@@ -614,7 +617,7 @@
614617
],
615618
"source": [
616619
"print(\"Available backends:\")\n",
617-
"IBMQ.backends()"
620+
"provider.backends()"
618621
]
619622
},
620623
{
@@ -654,8 +657,8 @@
654657
"source": [
655658
"from qiskit.providers.ibmq import least_busy\n",
656659
"\n",
657-
"large_enough_devices = IBMQ.backends(filters=lambda x: x.configuration().n_qubits < 10 and\n",
658-
" not x.configuration().simulator)\n",
660+
"large_enough_devices = provider.backends(filters=lambda x: x.configuration().n_qubits < 10 and\n",
661+
" not x.configuration().simulator)\n",
659662
"backend = least_busy(large_enough_devices)\n",
660663
"print(\"The best backend is \" + backend.name())"
661664
]
@@ -770,7 +773,7 @@
770773
"metadata": {},
771774
"outputs": [],
772775
"source": [
773-
"simulator_backend = IBMQ.get_backend('ibmq_qasm_simulator', hub=None)"
776+
"simulator_backend = provider.get_backend('ibmq_qasm_simulator')"
774777
]
775778
},
776779
{
@@ -846,9 +849,9 @@
846849
}
847850
],
848851
"source": [
849-
"jobID = job_exp.job_id()\n",
852+
"job_id = job_exp.job_id()\n",
850853
"\n",
851-
"print('JOB ID: {}'.format(jobID)) "
854+
"print('JOB ID: {}'.format(job_id))"
852855
]
853856
},
854857
{
@@ -864,7 +867,7 @@
864867
"metadata": {},
865868
"outputs": [],
866869
"source": [
867-
"job_get=backend.retrieve_job(jobID)"
870+
"retrieved_job = backend.retrieve_job(job_id)"
868871
]
869872
},
870873
{
@@ -898,7 +901,7 @@
898901
}
899902
],
900903
"source": [
901-
"job_get.result().get_counts(qc)"
904+
"retrieved_job.result().get_counts(qc)"
902905
]
903906
},
904907
{

0 commit comments

Comments
 (0)