From 2d4e101e456a5da3d6b24d74284969978aef5fd8 Mon Sep 17 00:00:00 2001 From: Divyanshu Singh <55018955+divshacker@users.noreply.github.com> Date: Fri, 14 Jun 2024 10:30:11 +0530 Subject: [PATCH] Updated documents and tutorials which supports Qiskit 1.0 and Primitives V2 (#2160) * making-them-work * making-them-work * reverting-first-tutorial-changes * Reverting_changes_and_updating_it * final_updated_working_file * Update 3_building_noise_models.ipynb * Update 4_custom_gate_noise.ipynb * updated 5_noise_transformation * added_few_things * Update 5_noise_transformation.ipynb * Update 6_extended_stabilizer_tutorial.ipynb * Update 7_matrix_product_state_method.ipynb * updated_setup * fixes_references_issue --------- Co-authored-by: Jun Doi --- .../tutorials/2_device_noise_simulation.ipynb | 12 +++---- docs/tutorials/3_building_noise_models.ipynb | 7 ++-- docs/tutorials/4_custom_gate_noise.ipynb | 7 ++-- docs/tutorials/5_noise_transformation.ipynb | 34 ++++--------------- .../6_extended_stabilizer_tutorial.ipynb | 7 ++-- .../7_matrix_product_state_method.ipynb | 5 ++- qiskit_aer/primitives/__init__.py | 3 ++ setup.py | 2 +- 8 files changed, 26 insertions(+), 51 deletions(-) diff --git a/docs/tutorials/2_device_noise_simulation.ipynb b/docs/tutorials/2_device_noise_simulation.ipynb index 518ee69899..4d17a5e912 100755 --- a/docs/tutorials/2_device_noise_simulation.ipynb +++ b/docs/tutorials/2_device_noise_simulation.ipynb @@ -29,10 +29,9 @@ }, "outputs": [], "source": [ - "from qiskit import IBMQ, transpile\n", - "from qiskit import QuantumCircuit\n", + "from qiskit import QuantumCircuit, transpile\n", "from qiskit_aer import AerSimulator\n", - "from qiskit.tools.visualization import plot_histogram" + "from qiskit.visualization import plot_histogram" ] }, { @@ -64,7 +63,7 @@ }, "outputs": [], "source": [ - "from qiskit.providers.fake_provider import FakeVigo\n", + "from qiskit_ibm_runtime.fake_provider import FakeVigo\n", "device_backend = FakeVigo()" ] }, @@ -233,9 +232,8 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", - "%qiskit_version_table\n", - "%qiskit_copyright" + "import qiskit\n", + "qiskit.__version__\n" ] }, { diff --git a/docs/tutorials/3_building_noise_models.ipynb b/docs/tutorials/3_building_noise_models.ipynb index 572e4564a5..f67ba010ba 100644 --- a/docs/tutorials/3_building_noise_models.ipynb +++ b/docs/tutorials/3_building_noise_models.ipynb @@ -35,7 +35,7 @@ "from qiskit import QuantumCircuit, transpile\n", "from qiskit.quantum_info import Kraus, SuperOp\n", "from qiskit_aer import AerSimulator\n", - "from qiskit.tools.visualization import plot_histogram\n", + "from qiskit.visualization import plot_histogram\n", "\n", "# Import from Qiskit Aer noise module\n", "from qiskit_aer.noise import (NoiseModel, QuantumError, ReadoutError, \n", @@ -868,9 +868,8 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", - "%qiskit_version_table\n", - "%qiskit_copyright" + "import qiskit\n", + "qiskit.__version__\n" ] } ], diff --git a/docs/tutorials/4_custom_gate_noise.ipynb b/docs/tutorials/4_custom_gate_noise.ipynb index 8df57d9b9e..005fb8cad8 100755 --- a/docs/tutorials/4_custom_gate_noise.ipynb +++ b/docs/tutorials/4_custom_gate_noise.ipynb @@ -33,7 +33,7 @@ "from qiskit_aer import AerSimulator\n", "from qiskit_aer.noise import NoiseModel, amplitude_damping_error\n", "\n", - "from qiskit.tools.visualization import plot_histogram" + "from qiskit.visualization import plot_histogram" ] }, { @@ -486,9 +486,8 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", - "%qiskit_version_table\n", - "%qiskit_copyright" + "import qiskit\n", + "qiskit.__version__\n" ] }, { diff --git a/docs/tutorials/5_noise_transformation.ipynb b/docs/tutorials/5_noise_transformation.ipynb index ba8d9034a2..7e7babb7a6 100755 --- a/docs/tutorials/5_noise_transformation.ipynb +++ b/docs/tutorials/5_noise_transformation.ipynb @@ -317,41 +317,19 @@ "outputs": [ { "data": { - "text/html": [ - "

Version Information

Qiskit SoftwareVersion
qiskit0.24.0.dev0+dba2eff
qiskit-aer0.11.2
qiskit-ignis0.7.1
qiskit-ibmq-provider0.20.0
qiskit0.41.0
System information
Python version3.8.11
Python compilerClang 12.0.5 (clang-1205.0.22.11)
Python builddefault, Jul 27 2021 10:46:38
OSDarwin
CPUs8
Memory (Gb)64.0
Wed Feb 15 14:17:23 2023 JST
" - ], "text/plain": [ - "" + "'1.1.0'" ] }, + "execution_count": 7, "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "

This code is a part of Qiskit

© Copyright IBM 2017, 2023.

This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.

Any modifications or derivative works of this code must retain this
copyright notice, and modified files need to carry a notice indicating
that they have been altered from the originals.

" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ - "import qiskit.tools.jupyter\n", - "%qiskit_version_table\n", - "%qiskit_copyright" + "import qiskit\n", + "qiskit.__version__" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -370,7 +348,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.11" + "version": "3.12.3" }, "varInspector": { "cols": { diff --git a/docs/tutorials/6_extended_stabilizer_tutorial.ipynb b/docs/tutorials/6_extended_stabilizer_tutorial.ipynb index 77f0a297a3..1d126d6453 100755 --- a/docs/tutorials/6_extended_stabilizer_tutorial.ipynb +++ b/docs/tutorials/6_extended_stabilizer_tutorial.ipynb @@ -40,7 +40,7 @@ "source": [ "from qiskit import QuantumCircuit, transpile\n", "from qiskit_aer import AerSimulator\n", - "from qiskit.tools.visualization import plot_histogram\n", + "from qiskit.visualization import plot_histogram\n", "\n", "import random" ] @@ -479,9 +479,8 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", - "%qiskit_version_table\n", - "%qiskit_copyright" + "import qiskit\n", + "qiskit.__version__\n" ] }, { diff --git a/docs/tutorials/7_matrix_product_state_method.ipynb b/docs/tutorials/7_matrix_product_state_method.ipynb index 1252efff34..0f252d9123 100644 --- a/docs/tutorials/7_matrix_product_state_method.ipynb +++ b/docs/tutorials/7_matrix_product_state_method.ipynb @@ -244,9 +244,8 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", - "%qiskit_version_table\n", - "%qiskit_copyright" + "import qiskit\n", + "qiskit.__version__\n" ] }, { diff --git a/qiskit_aer/primitives/__init__.py b/qiskit_aer/primitives/__init__.py index 84a2d064d7..6283952fde 100644 --- a/qiskit_aer/primitives/__init__.py +++ b/qiskit_aer/primitives/__init__.py @@ -29,6 +29,9 @@ Sampler Estimator + SamplerV2 + EstimatorV2 + """ import qiskit diff --git a/setup.py b/setup.py index 98dad4e2bb..65ae2f2f7e 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ extras_requirements = {"dask": ["dask", "distributed"]} requirements = [ - "qiskit>=0.45.2", + "qiskit>=1.1.0", "numpy>=1.16.3", "scipy>=1.0", "psutil>=5",