From 5edf643bf7c22faafe2a8365eeca4fe787c52297 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 11:04:38 -0600 Subject: [PATCH 01/27] Add alt text to images --- qiskit/circuit/controlledgate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qiskit/circuit/controlledgate.py b/qiskit/circuit/controlledgate.py index a2038be9bb0..a7d79e837aa 100644 --- a/qiskit/circuit/controlledgate.py +++ b/qiskit/circuit/controlledgate.py @@ -70,6 +70,7 @@ def __init__( Create a controlled standard gate and apply it to a circuit. .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit import QuantumCircuit, QuantumRegister @@ -84,6 +85,7 @@ def __init__( Create a controlled custom gate and apply it to a circuit. .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit import QuantumCircuit, QuantumRegister From 4474eb6313bc5519de62b129e18c7cb63ce81e4b Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 11:08:10 -0600 Subject: [PATCH 02/27] Update operation.py --- qiskit/circuit/operation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qiskit/circuit/operation.py b/qiskit/circuit/operation.py index 8856222b266..b7adb42ce4e 100644 --- a/qiskit/circuit/operation.py +++ b/qiskit/circuit/operation.py @@ -34,6 +34,7 @@ class Operation(ABC): Add a Clifford and a Toffoli gate to a :class:`QuantumCircuit`. .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit import QuantumCircuit From 4ad57aca55ff002288d11f91db522be1777739cc Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 11:12:01 -0600 Subject: [PATCH 03/27] Update parameter.py --- qiskit/circuit/parameter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qiskit/circuit/parameter.py b/qiskit/circuit/parameter.py index 8723445cdef..1a045538392 100644 --- a/qiskit/circuit/parameter.py +++ b/qiskit/circuit/parameter.py @@ -41,6 +41,7 @@ class Parameter(ParameterExpression): Construct a variable-rotation X gate using circuit parameters. .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit import QuantumCircuit, Parameter From b10af93b85ba5f33285d57f28a698cc03691e20d Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 11:25:29 -0600 Subject: [PATCH 04/27] Update quantumcircuit.py --- qiskit/circuit/quantumcircuit.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index dee2f3e7227..5d0bb93f4eb 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -835,6 +835,7 @@ class QuantumCircuit: Consider the following circuit: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit import QuantumCircuit @@ -901,6 +902,7 @@ class QuantumCircuit: graphically: .. image:: /source_images/depth.gif + :alt: [Rotate the circuit and let each gate fall as far as possible. The gates fall into "layers". The depth of the circuit is the number of layers.] We can verify our graphical result using :meth:`QuantumCircuit.depth`:: @@ -2169,7 +2171,8 @@ def tensor(self, other: "QuantumCircuit", inplace: bool = False) -> Optional["Qu Examples: .. plot:: - :include-source: + :alt: [Circuit diagram output by the previous code.] + :include-source from qiskit import QuantumCircuit top = QuantumCircuit(1) @@ -3425,7 +3428,8 @@ def draw( Example: .. plot:: - :include-source: + :alt: [Circuit diagram output by the previous code.] + :include-source from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit qc = QuantumCircuit(1, 1) @@ -4327,7 +4331,8 @@ def assign_parameters( # pylint: disable=missing-raises-doc Create a parameterized circuit and assign the parameters in-place. .. plot:: - :include-source: + :alt: [Circuit diagram output by the previous code.] + :include-source from qiskit.circuit import QuantumCircuit, Parameter @@ -4342,7 +4347,8 @@ def assign_parameters( # pylint: disable=missing-raises-doc Bind the values out-of-place by list and get a copy of the original circuit. .. plot:: - :include-source: + :alt: [Circuit diagram output by the previous code.] + :include-source from qiskit.circuit import QuantumCircuit, ParameterVector From c38a3c707fa6b0132092039a7d71b368523827fb Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 13:04:36 -0600 Subject: [PATCH 05/27] try breaking line --- qiskit/circuit/quantumcircuit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index 5d0bb93f4eb..7f52299089e 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -902,7 +902,8 @@ class QuantumCircuit: graphically: .. image:: /source_images/depth.gif - :alt: [Rotate the circuit and let each gate fall as far as possible. The gates fall into "layers". The depth of the circuit is the number of layers.] + :alt: [Rotate the circuit and let each gate fall as far as possible. The gates fall + into "layers". The depth of the circuit is the number of layers.] We can verify our graphical result using :meth:`QuantumCircuit.depth`:: From 833d0091dfc582c205c194a6cb8e488fb036bf44 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 13:56:47 -0600 Subject: [PATCH 06/27] Update __init__.py --- qiskit/circuit/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qiskit/circuit/__init__.py b/qiskit/circuit/__init__.py index f4d533b7a2f..237bcf6939d 100644 --- a/qiskit/circuit/__init__.py +++ b/qiskit/circuit/__init__.py @@ -64,6 +64,7 @@ .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit import QuantumCircuit @@ -1144,6 +1145,7 @@ def __array__(self, dtype=None, copy=None): drawing: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: :show-source-link: False From e27d873a6cfd68ee88825de8cc4cf6a95fef65e8 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 14:09:37 -0600 Subject: [PATCH 07/27] Update fourier_checking.py --- qiskit/circuit/library/fourier_checking.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qiskit/circuit/library/fourier_checking.py b/qiskit/circuit/library/fourier_checking.py index b5012b4beee..1e9f182c0d8 100644 --- a/qiskit/circuit/library/fourier_checking.py +++ b/qiskit/circuit/library/fourier_checking.py @@ -70,6 +70,7 @@ def __init__(self, f: Sequence[int], g: Sequence[int]) -> None: Reference Circuit: .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import FourierChecking from qiskit.visualization.library import _generate_circuit_library_visualization @@ -123,12 +124,13 @@ def fourier_checking(f: Sequence[int], g: Sequence[int]) -> QuantumCircuit: **Reference Circuit:** - .. plot:: - :include-source: + .. plot:: + :alt: [Circuit diagram output by the previous code.] + :include-source: - from qiskit.circuit.library import fourier_checking - circuit = fourier_checking([1, -1, -1, -1], [1, 1, -1, -1]) - circuit.draw('mpl') + from qiskit.circuit.library import fourier_checking + circuit = fourier_checking([1, -1, -1, -1], [1, 1, -1, -1]) + circuit.draw('mpl') **Reference:** From d0fbad4ea1460a22faa3e1082aa0470fd6d784bf Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 14:23:57 -0600 Subject: [PATCH 08/27] Update graph_state.py --- qiskit/circuit/library/graph_state.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qiskit/circuit/library/graph_state.py b/qiskit/circuit/library/graph_state.py index 79c0dfbc864..5a7226c3176 100644 --- a/qiskit/circuit/library/graph_state.py +++ b/qiskit/circuit/library/graph_state.py @@ -41,6 +41,7 @@ class GraphState(QuantumCircuit): **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import GraphState from qiskit.visualization.library import _generate_circuit_library_visualization @@ -105,6 +106,7 @@ class GraphStateGate(Gate): **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit import QuantumCircuit From 886c3313e005864ab471e24fc0bbb75609ef6019 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 14:25:49 -0600 Subject: [PATCH 09/27] Update grover_operator.py --- qiskit/circuit/library/grover_operator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qiskit/circuit/library/grover_operator.py b/qiskit/circuit/library/grover_operator.py index d55a59249a3..4bc93d63bb2 100644 --- a/qiskit/circuit/library/grover_operator.py +++ b/qiskit/circuit/library/grover_operator.py @@ -103,6 +103,7 @@ def grover_operator( We can construct a Grover operator just from the phase oracle: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -117,6 +118,7 @@ def grover_operator( We can also modify the state preparation: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -132,6 +134,7 @@ def grover_operator( the oracle: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -149,6 +152,7 @@ def grover_operator( objects: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: From 8a5ee1f9c81a4b11e45b5218568c09b69524f376 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 14:32:56 -0600 Subject: [PATCH 10/27] add more alt text and some missing directives --- qiskit/circuit/library/graph_state.py | 1 + qiskit/circuit/library/hidden_linear_function.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/qiskit/circuit/library/graph_state.py b/qiskit/circuit/library/graph_state.py index 5a7226c3176..d469c9f5a00 100644 --- a/qiskit/circuit/library/graph_state.py +++ b/qiskit/circuit/library/graph_state.py @@ -42,6 +42,7 @@ class GraphState(QuantumCircuit): .. plot:: :alt: [Circuit diagram output by the previous code.] + :include-source: from qiskit.circuit.library import GraphState from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/hidden_linear_function.py b/qiskit/circuit/library/hidden_linear_function.py index 7acaaa7aa72..bbed8d25da7 100644 --- a/qiskit/circuit/library/hidden_linear_function.py +++ b/qiskit/circuit/library/hidden_linear_function.py @@ -55,6 +55,8 @@ class HiddenLinearFunction(QuantumCircuit): **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] + :include-source: from qiskit.circuit.library import HiddenLinearFunction from qiskit.visualization.library import _generate_circuit_library_visualization @@ -123,6 +125,7 @@ def hidden_linear_function(adjacency_matrix: list | np.ndarray) -> QuantumCircui **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit.library import hidden_linear_function From c5cf51bdf384e343f2d2b6a2c71fa15ffc9e4fb1 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 14:46:56 -0600 Subject: [PATCH 11/27] add nofigs for missing figures --- qiskit/circuit/library/graph_state.py | 3 +-- qiskit/circuit/library/hidden_linear_function.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/qiskit/circuit/library/graph_state.py b/qiskit/circuit/library/graph_state.py index d469c9f5a00..872c88b70d3 100644 --- a/qiskit/circuit/library/graph_state.py +++ b/qiskit/circuit/library/graph_state.py @@ -41,8 +41,7 @@ class GraphState(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] - :include-source: + :nofigs: from qiskit.circuit.library import GraphState from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/hidden_linear_function.py b/qiskit/circuit/library/hidden_linear_function.py index bbed8d25da7..47a1c89daa2 100644 --- a/qiskit/circuit/library/hidden_linear_function.py +++ b/qiskit/circuit/library/hidden_linear_function.py @@ -55,8 +55,7 @@ class HiddenLinearFunction(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] - :include-source: + :nofigs: from qiskit.circuit.library import HiddenLinearFunction from qiskit.visualization.library import _generate_circuit_library_visualization From 2c7b8772a21724699ac8c89be4238dff49933110 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 14:57:32 -0600 Subject: [PATCH 12/27] Add more alt text --- qiskit/circuit/library/graph_state.py | 2 +- qiskit/circuit/library/hidden_linear_function.py | 2 +- qiskit/circuit/library/iqp.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qiskit/circuit/library/graph_state.py b/qiskit/circuit/library/graph_state.py index 872c88b70d3..5a7226c3176 100644 --- a/qiskit/circuit/library/graph_state.py +++ b/qiskit/circuit/library/graph_state.py @@ -41,7 +41,7 @@ class GraphState(QuantumCircuit): **Reference Circuit:** .. plot:: - :nofigs: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import GraphState from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/hidden_linear_function.py b/qiskit/circuit/library/hidden_linear_function.py index 47a1c89daa2..b9aa0d91361 100644 --- a/qiskit/circuit/library/hidden_linear_function.py +++ b/qiskit/circuit/library/hidden_linear_function.py @@ -55,7 +55,7 @@ class HiddenLinearFunction(QuantumCircuit): **Reference Circuit:** .. plot:: - :nofigs: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import HiddenLinearFunction from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/iqp.py b/qiskit/circuit/library/iqp.py index 62082fd5c44..95fbdb1fc8a 100644 --- a/qiskit/circuit/library/iqp.py +++ b/qiskit/circuit/library/iqp.py @@ -38,6 +38,7 @@ class IQP(QuantumCircuit): **Reference Circuit:** .. plot:: + from qiskit.circuit.library import IQP A = [[6, 5, 3], [5, 4, 5], [3, 5, 1]] @@ -47,6 +48,7 @@ class IQP(QuantumCircuit): **Expanded Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import IQP from qiskit.visualization.library import _generate_circuit_library_visualization @@ -154,6 +156,7 @@ def random_iqp( Example: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit.library import random_iqp From b4475090d9f181736db44aaf0104b7e8c2dd8397 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 15:08:13 -0600 Subject: [PATCH 13/27] next set --- qiskit/circuit/library/__init__.py | 1 + qiskit/circuit/library/iqp.py | 2 +- qiskit/circuit/library/overlap.py | 1 + qiskit/circuit/library/phase_estimation.py | 2 ++ qiskit/circuit/library/quantum_volume.py | 3 +++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qiskit/circuit/library/__init__.py b/qiskit/circuit/library/__init__.py index 969ccfc5e5a..92c92cb3ed0 100644 --- a/qiskit/circuit/library/__init__.py +++ b/qiskit/circuit/library/__init__.py @@ -26,6 +26,7 @@ For example, to append a multi-controlled CNOT: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit.library import MCXGate diff --git a/qiskit/circuit/library/iqp.py b/qiskit/circuit/library/iqp.py index 95fbdb1fc8a..c8a1b71077f 100644 --- a/qiskit/circuit/library/iqp.py +++ b/qiskit/circuit/library/iqp.py @@ -38,7 +38,7 @@ class IQP(QuantumCircuit): **Reference Circuit:** .. plot:: - + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import IQP A = [[6, 5, 3], [5, 4, 5], [3, 5, 1]] diff --git a/qiskit/circuit/library/overlap.py b/qiskit/circuit/library/overlap.py index 6f444bebf0f..4806e93b7d6 100644 --- a/qiskit/circuit/library/overlap.py +++ b/qiskit/circuit/library/overlap.py @@ -128,6 +128,7 @@ def unitary_overlap( **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: import numpy as np diff --git a/qiskit/circuit/library/phase_estimation.py b/qiskit/circuit/library/phase_estimation.py index 8ff441eb705..cdfc09d0af9 100644 --- a/qiskit/circuit/library/phase_estimation.py +++ b/qiskit/circuit/library/phase_estimation.py @@ -76,6 +76,7 @@ def __init__( Reference Circuit: .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import PhaseEstimation @@ -131,6 +132,7 @@ def phase_estimation( **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit import QuantumCircuit diff --git a/qiskit/circuit/library/quantum_volume.py b/qiskit/circuit/library/quantum_volume.py index 644a85d9af1..acec94b66f7 100644 --- a/qiskit/circuit/library/quantum_volume.py +++ b/qiskit/circuit/library/quantum_volume.py @@ -35,6 +35,7 @@ class QuantumVolume(QuantumCircuit): **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import QuantumVolume circuit = QuantumVolume(5, 6, seed=10) @@ -43,6 +44,7 @@ class QuantumVolume(QuantumCircuit): **Expanded Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import QuantumVolume from qiskit.visualization.library import _generate_circuit_library_visualization @@ -150,6 +152,7 @@ def quantum_volume( **Reference Circuit:** .. plot:: + :alt: [Circuit diagram output by the previous code.] from qiskit.circuit.library import quantum_volume circuit = quantum_volume(5, 6, seed=10) From b9a59d60e7d0a21ba14a9345a726433f418aa97f Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 15:22:34 -0600 Subject: [PATCH 14/27] need different text when there's no code --- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py | 1 + qiskit/circuit/library/basis_change/qft.py | 3 +++ qiskit/circuit/library/boolean_logic/inner_product.py | 2 ++ qiskit/circuit/library/phase_estimation.py | 2 +- qiskit/circuit/library/quantum_volume.py | 6 +++--- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py b/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py index cc34d3631f5..025e4bb46a7 100644 --- a/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +++ b/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py @@ -37,6 +37,7 @@ class PiecewiseChebyshev(BlueprintCircuit): Examples: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: import numpy as np diff --git a/qiskit/circuit/library/basis_change/qft.py b/qiskit/circuit/library/basis_change/qft.py index cb14977b446..512082ae102 100644 --- a/qiskit/circuit/library/basis_change/qft.py +++ b/qiskit/circuit/library/basis_change/qft.py @@ -38,6 +38,7 @@ class QFT(BlueprintCircuit): For 4 qubits, the circuit that implements this transformation is: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import QFT from qiskit.visualization.library import _generate_circuit_library_visualization @@ -48,6 +49,7 @@ class QFT(BlueprintCircuit): The respective circuit diagram is: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import QFT from qiskit.visualization.library import _generate_circuit_library_visualization @@ -64,6 +66,7 @@ class QFT(BlueprintCircuit): on 5 qubits with approximation degree 2 yields (the barriers are dropped in this example): .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import QFT from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/boolean_logic/inner_product.py b/qiskit/circuit/library/boolean_logic/inner_product.py index 84b3807fb56..b4ee9a8dcdc 100644 --- a/qiskit/circuit/library/boolean_logic/inner_product.py +++ b/qiskit/circuit/library/boolean_logic/inner_product.py @@ -55,6 +55,7 @@ class InnerProduct(QuantumCircuit): Reference Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import InnerProduct from qiskit.visualization.library import _generate_circuit_library_visualization @@ -121,6 +122,7 @@ class InnerProductGate(Gate): Reference Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import InnerProductGate diff --git a/qiskit/circuit/library/phase_estimation.py b/qiskit/circuit/library/phase_estimation.py index cdfc09d0af9..70546741460 100644 --- a/qiskit/circuit/library/phase_estimation.py +++ b/qiskit/circuit/library/phase_estimation.py @@ -76,7 +76,7 @@ def __init__( Reference Circuit: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import PhaseEstimation diff --git a/qiskit/circuit/library/quantum_volume.py b/qiskit/circuit/library/quantum_volume.py index acec94b66f7..932a04b5c92 100644 --- a/qiskit/circuit/library/quantum_volume.py +++ b/qiskit/circuit/library/quantum_volume.py @@ -35,7 +35,7 @@ class QuantumVolume(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import QuantumVolume circuit = QuantumVolume(5, 6, seed=10) @@ -44,7 +44,7 @@ class QuantumVolume(QuantumCircuit): **Expanded Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import QuantumVolume from qiskit.visualization.library import _generate_circuit_library_visualization @@ -152,7 +152,7 @@ def quantum_volume( **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import quantum_volume circuit = quantum_volume(5, 6, seed=10) From 8c1cbbc613a481af81e8f027a04377b92ab95875 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 15:25:35 -0600 Subject: [PATCH 15/27] fix text when no code --- qiskit/circuit/library/fourier_checking.py | 2 +- qiskit/circuit/library/graph_state.py | 2 +- qiskit/circuit/library/hidden_linear_function.py | 2 +- qiskit/circuit/library/iqp.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qiskit/circuit/library/fourier_checking.py b/qiskit/circuit/library/fourier_checking.py index 1e9f182c0d8..15b021dd75b 100644 --- a/qiskit/circuit/library/fourier_checking.py +++ b/qiskit/circuit/library/fourier_checking.py @@ -70,7 +70,7 @@ def __init__(self, f: Sequence[int], g: Sequence[int]) -> None: Reference Circuit: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import FourierChecking from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/graph_state.py b/qiskit/circuit/library/graph_state.py index 5a7226c3176..f1636299da6 100644 --- a/qiskit/circuit/library/graph_state.py +++ b/qiskit/circuit/library/graph_state.py @@ -41,7 +41,7 @@ class GraphState(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import GraphState from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/hidden_linear_function.py b/qiskit/circuit/library/hidden_linear_function.py index b9aa0d91361..8ff07a69a24 100644 --- a/qiskit/circuit/library/hidden_linear_function.py +++ b/qiskit/circuit/library/hidden_linear_function.py @@ -55,7 +55,7 @@ class HiddenLinearFunction(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import HiddenLinearFunction from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/iqp.py b/qiskit/circuit/library/iqp.py index c8a1b71077f..500e3346833 100644 --- a/qiskit/circuit/library/iqp.py +++ b/qiskit/circuit/library/iqp.py @@ -38,7 +38,7 @@ class IQP(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import IQP A = [[6, 5, 3], [5, 4, 5], [3, 5, 1]] @@ -48,7 +48,7 @@ class IQP(QuantumCircuit): **Expanded Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import IQP from qiskit.visualization.library import _generate_circuit_library_visualization From d2a1c54920ce70b66813883a79866252dc87eeab Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 11 Dec 2024 15:52:53 -0600 Subject: [PATCH 16/27] more alt text --- qiskit/circuit/library/boolean_logic/quantum_and.py | 4 ++++ qiskit/circuit/library/boolean_logic/quantum_or.py | 4 ++++ qiskit/circuit/library/boolean_logic/quantum_xor.py | 2 ++ qiskit/circuit/library/generalized_gates/gms.py | 1 + qiskit/circuit/library/generalized_gates/gr.py | 1 + qiskit/circuit/library/generalized_gates/mcmt.py | 1 + qiskit/circuit/library/generalized_gates/permutation.py | 4 ++++ qiskit/circuit/library/n_local/efficient_su2.py | 2 ++ qiskit/circuit/library/n_local/evolved_operator_ansatz.py | 3 +++ qiskit/circuit/library/n_local/excitation_preserving.py | 2 ++ qiskit/circuit/library/n_local/n_local.py | 7 ++++++- qiskit/circuit/library/n_local/pauli_two_design.py | 2 ++ qiskit/circuit/library/n_local/qaoa_ansatz.py | 1 + qiskit/circuit/library/n_local/real_amplitudes.py | 4 ++++ qiskit/circuit/quantumcircuit.py | 2 +- 15 files changed, 38 insertions(+), 2 deletions(-) diff --git a/qiskit/circuit/library/boolean_logic/quantum_and.py b/qiskit/circuit/library/boolean_logic/quantum_and.py index 53099aa7be8..ad13a7cc619 100644 --- a/qiskit/circuit/library/boolean_logic/quantum_and.py +++ b/qiskit/circuit/library/boolean_logic/quantum_and.py @@ -32,6 +32,7 @@ class AND(QuantumCircuit): The AND gate without special flags equals the multi-controlled-X gate: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import AND from qiskit.visualization.library import _generate_circuit_library_visualization @@ -43,6 +44,7 @@ class AND(QuantumCircuit): ``[-1, 0, 0, 1, 1]``. .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import AND from qiskit.visualization.library import _generate_circuit_library_visualization @@ -116,6 +118,7 @@ class AndGate(Gate): The AndGate gate without special flags equals the multi-controlled-X gate: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import AndGate @@ -129,6 +132,7 @@ class AndGate(Gate): ``[-1, 0, 0, 1, 1]``. .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import AndGate diff --git a/qiskit/circuit/library/boolean_logic/quantum_or.py b/qiskit/circuit/library/boolean_logic/quantum_or.py index 95b346b3484..3ee48e625b2 100644 --- a/qiskit/circuit/library/boolean_logic/quantum_or.py +++ b/qiskit/circuit/library/boolean_logic/quantum_or.py @@ -33,6 +33,7 @@ class OR(QuantumCircuit): The OR gate without special flags: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import OR from qiskit.visualization.library import _generate_circuit_library_visualization @@ -44,6 +45,7 @@ class OR(QuantumCircuit): flags ``[-1, 0, 0, 1, 1]``. .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import OR from qiskit.visualization.library import _generate_circuit_library_visualization @@ -117,6 +119,7 @@ class OrGate(Gate): The OrGate gate without special flags: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import OrGate @@ -130,6 +133,7 @@ class OrGate(Gate): flags ``[-1, 0, 0, 1, 1]``. .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import OrGate diff --git a/qiskit/circuit/library/boolean_logic/quantum_xor.py b/qiskit/circuit/library/boolean_logic/quantum_xor.py index 73a2178830b..470807314b9 100644 --- a/qiskit/circuit/library/boolean_logic/quantum_xor.py +++ b/qiskit/circuit/library/boolean_logic/quantum_xor.py @@ -53,6 +53,7 @@ def __init__( Reference Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import XOR from qiskit.visualization.library import _generate_circuit_library_visualization @@ -88,6 +89,7 @@ class BitwiseXorGate(Gate): Reference Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import BitwiseXorGate diff --git a/qiskit/circuit/library/generalized_gates/gms.py b/qiskit/circuit/library/generalized_gates/gms.py index bdf01757abd..32d004631e2 100644 --- a/qiskit/circuit/library/generalized_gates/gms.py +++ b/qiskit/circuit/library/generalized_gates/gms.py @@ -45,6 +45,7 @@ class GMS(QuantumCircuit): **Expanded Circuit:** .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import GMS from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/generalized_gates/gr.py b/qiskit/circuit/library/generalized_gates/gr.py index 3ababe25f3d..34367baaad9 100644 --- a/qiskit/circuit/library/generalized_gates/gr.py +++ b/qiskit/circuit/library/generalized_gates/gr.py @@ -45,6 +45,7 @@ class GR(QuantumCircuit): **Expanded Circuit:** .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import GR from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/generalized_gates/mcmt.py b/qiskit/circuit/library/generalized_gates/mcmt.py index 496b391d38e..69bbc94309b 100644 --- a/qiskit/circuit/library/generalized_gates/mcmt.py +++ b/qiskit/circuit/library/generalized_gates/mcmt.py @@ -129,6 +129,7 @@ class MCMTVChain(MCMT): **Expanded Circuit:** .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import MCMTVChain, ZGate from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/generalized_gates/permutation.py b/qiskit/circuit/library/generalized_gates/permutation.py index bea863f7824..418ae4681bb 100644 --- a/qiskit/circuit/library/generalized_gates/permutation.py +++ b/qiskit/circuit/library/generalized_gates/permutation.py @@ -54,6 +54,7 @@ def __init__( Reference Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import Permutation A = [2,4,3,0,1] @@ -62,6 +63,7 @@ def __init__( Expanded Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.library import Permutation from qiskit.visualization.library import _generate_circuit_library_visualization @@ -116,6 +118,7 @@ def __init__( Reference Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.library import PermutationGate @@ -127,6 +130,7 @@ def __init__( Expanded Circuit: .. plot:: + :alt: [Diagram illustrating the previously described circuit.] from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.library import PermutationGate diff --git a/qiskit/circuit/library/n_local/efficient_su2.py b/qiskit/circuit/library/n_local/efficient_su2.py index 53698a3e18a..fd41a7f3e70 100644 --- a/qiskit/circuit/library/n_local/efficient_su2.py +++ b/qiskit/circuit/library/n_local/efficient_su2.py @@ -71,6 +71,7 @@ def efficient_su2( CX gates, is equivalent to an all-to-all entanglement: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -84,6 +85,7 @@ def efficient_su2( For example: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: diff --git a/qiskit/circuit/library/n_local/evolved_operator_ansatz.py b/qiskit/circuit/library/n_local/evolved_operator_ansatz.py index 086bbda3174..8ffe38f2599 100644 --- a/qiskit/circuit/library/n_local/evolved_operator_ansatz.py +++ b/qiskit/circuit/library/n_local/evolved_operator_ansatz.py @@ -61,6 +61,7 @@ def evolved_operator_ansatz( Examples: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit.library import evolved_operator_ansatz @@ -213,6 +214,7 @@ def hamiltonian_variational_ansatz( A single operator will be split into commuting terms automatically: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.quantum_info import SparsePauliOp @@ -226,6 +228,7 @@ def hamiltonian_variational_ansatz( Alternatively, we can directly provide the terms: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.quantum_info import SparsePauliOp diff --git a/qiskit/circuit/library/n_local/excitation_preserving.py b/qiskit/circuit/library/n_local/excitation_preserving.py index 49bfdb07f01..e41f1a56ad9 100644 --- a/qiskit/circuit/library/n_local/excitation_preserving.py +++ b/qiskit/circuit/library/n_local/excitation_preserving.py @@ -70,6 +70,7 @@ def excitation_preserving( With linear entanglement, this circuit is given by: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -83,6 +84,7 @@ def excitation_preserving( in each block: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: diff --git a/qiskit/circuit/library/n_local/n_local.py b/qiskit/circuit/library/n_local/n_local.py index 8c0b4d28508..ea4fbe88416 100644 --- a/qiskit/circuit/library/n_local/n_local.py +++ b/qiskit/circuit/library/n_local/n_local.py @@ -148,6 +148,7 @@ def n_local( are made up of a single block per layer: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -160,6 +161,7 @@ def n_local( Pauli-Y and Pauli-Z rotations in the rotation layer: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -169,6 +171,7 @@ def n_local( To omit rotation or entanglement layers, the block can be set to an empty list: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -178,6 +181,7 @@ def n_local( The entanglement can be set explicitly via the ``entanglement`` argument: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -189,7 +193,8 @@ def n_local( as input the current layer index, and returns the entanglement structure. For example, the following uses different entanglements for odd and even layers: - .. plot: + .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: diff --git a/qiskit/circuit/library/n_local/pauli_two_design.py b/qiskit/circuit/library/n_local/pauli_two_design.py index f0deeb68b28..7f2c12ba1af 100644 --- a/qiskit/circuit/library/n_local/pauli_two_design.py +++ b/qiskit/circuit/library/n_local/pauli_two_design.py @@ -59,6 +59,7 @@ def pauli_two_design( Examples: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit.library import pauli_two_design @@ -147,6 +148,7 @@ class PauliTwoDesign(TwoLocal): Examples: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.circuit.library import PauliTwoDesign diff --git a/qiskit/circuit/library/n_local/qaoa_ansatz.py b/qiskit/circuit/library/n_local/qaoa_ansatz.py index b200d7ea7e1..bc6160b9dd7 100644 --- a/qiskit/circuit/library/n_local/qaoa_ansatz.py +++ b/qiskit/circuit/library/n_local/qaoa_ansatz.py @@ -47,6 +47,7 @@ def qaoa_ansatz( optimization problem: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: from qiskit.quantum_info import SparsePauliOp diff --git a/qiskit/circuit/library/n_local/real_amplitudes.py b/qiskit/circuit/library/n_local/real_amplitudes.py index f1ba10604e9..e2b3a51bf98 100644 --- a/qiskit/circuit/library/n_local/real_amplitudes.py +++ b/qiskit/circuit/library/n_local/real_amplitudes.py @@ -68,6 +68,7 @@ def real_amplitudes( Examples: .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -77,6 +78,7 @@ def real_amplitudes( ansatz.draw("mpl") .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -84,6 +86,7 @@ def real_amplitudes( ansatz.draw("mpl") .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: @@ -91,6 +94,7 @@ def real_amplitudes( ansatz.draw("mpl") .. plot:: + :alt: [Circuit diagram output by the previous code.] :include-source: :context: diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index 7f52299089e..ffe083799df 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -902,7 +902,7 @@ class QuantumCircuit: graphically: .. image:: /source_images/depth.gif - :alt: [Rotate the circuit and let each gate fall as far as possible. The gates fall + :alt: [Rotate the circuit and let each gate fall as far as possible. The gates fall \ into "layers". The depth of the circuit is the number of layers.] We can verify our graphical result using :meth:`QuantumCircuit.depth`:: From fe25141a2bf74d73ae686a5a1d22d50fc67f23b3 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Thu, 12 Dec 2024 10:07:31 -0600 Subject: [PATCH 17/27] remove brackets --- qiskit/circuit/__init__.py | 4 ++-- qiskit/circuit/controlledgate.py | 4 ++-- qiskit/circuit/library/__init__.py | 2 +- .../library/arithmetic/piecewise_chebyshev.py | 2 +- qiskit/circuit/library/basis_change/qft.py | 6 +++--- .../circuit/library/boolean_logic/inner_product.py | 4 ++-- .../circuit/library/boolean_logic/quantum_and.py | 8 ++++---- qiskit/circuit/library/boolean_logic/quantum_or.py | 8 ++++---- .../circuit/library/boolean_logic/quantum_xor.py | 4 ++-- qiskit/circuit/library/fourier_checking.py | 4 ++-- qiskit/circuit/library/generalized_gates/gms.py | 2 +- qiskit/circuit/library/generalized_gates/gr.py | 2 +- qiskit/circuit/library/generalized_gates/mcmt.py | 2 +- .../library/generalized_gates/permutation.py | 8 ++++---- qiskit/circuit/library/graph_state.py | 4 ++-- qiskit/circuit/library/grover_operator.py | 8 ++++---- qiskit/circuit/library/hidden_linear_function.py | 4 ++-- qiskit/circuit/library/iqp.py | 6 +++--- qiskit/circuit/library/n_local/efficient_su2.py | 4 ++-- .../library/n_local/evolved_operator_ansatz.py | 6 +++--- .../library/n_local/excitation_preserving.py | 4 ++-- qiskit/circuit/library/n_local/n_local.py | 10 +++++----- qiskit/circuit/library/n_local/pauli_two_design.py | 4 ++-- qiskit/circuit/library/n_local/qaoa_ansatz.py | 2 +- qiskit/circuit/library/n_local/real_amplitudes.py | 8 ++++---- qiskit/circuit/library/overlap.py | 2 +- qiskit/circuit/library/phase_estimation.py | 4 ++-- qiskit/circuit/library/quantum_volume.py | 6 +++--- qiskit/circuit/operation.py | 2 +- qiskit/circuit/parameter.py | 2 +- qiskit/circuit/quantumcircuit.py | 14 +++++++------- qiskit/circuit/random/utils.py | 2 ++ qiskit/converters/dag_to_circuit.py | 1 + qiskit/primitives/statevector_estimator.py | 1 + qiskit/providers/fake_provider/__init__.py | 1 + 35 files changed, 80 insertions(+), 75 deletions(-) diff --git a/qiskit/circuit/__init__.py b/qiskit/circuit/__init__.py index 237bcf6939d..fc9e7a9af80 100644 --- a/qiskit/circuit/__init__.py +++ b/qiskit/circuit/__init__.py @@ -64,7 +64,7 @@ .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit @@ -1145,7 +1145,7 @@ def __array__(self, dtype=None, copy=None): drawing: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: :show-source-link: False diff --git a/qiskit/circuit/controlledgate.py b/qiskit/circuit/controlledgate.py index a7d79e837aa..54d0cd817d2 100644 --- a/qiskit/circuit/controlledgate.py +++ b/qiskit/circuit/controlledgate.py @@ -70,7 +70,7 @@ def __init__( Create a controlled standard gate and apply it to a circuit. .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit, QuantumRegister @@ -85,7 +85,7 @@ def __init__( Create a controlled custom gate and apply it to a circuit. .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit, QuantumRegister diff --git a/qiskit/circuit/library/__init__.py b/qiskit/circuit/library/__init__.py index 92c92cb3ed0..7033d7eb758 100644 --- a/qiskit/circuit/library/__init__.py +++ b/qiskit/circuit/library/__init__.py @@ -26,7 +26,7 @@ For example, to append a multi-controlled CNOT: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import MCXGate diff --git a/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py b/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py index 025e4bb46a7..666f05c0323 100644 --- a/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +++ b/qiskit/circuit/library/arithmetic/piecewise_chebyshev.py @@ -37,7 +37,7 @@ class PiecewiseChebyshev(BlueprintCircuit): Examples: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: import numpy as np diff --git a/qiskit/circuit/library/basis_change/qft.py b/qiskit/circuit/library/basis_change/qft.py index 512082ae102..42cc43ced17 100644 --- a/qiskit/circuit/library/basis_change/qft.py +++ b/qiskit/circuit/library/basis_change/qft.py @@ -38,7 +38,7 @@ class QFT(BlueprintCircuit): For 4 qubits, the circuit that implements this transformation is: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import QFT from qiskit.visualization.library import _generate_circuit_library_visualization @@ -49,7 +49,7 @@ class QFT(BlueprintCircuit): The respective circuit diagram is: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import QFT from qiskit.visualization.library import _generate_circuit_library_visualization @@ -66,7 +66,7 @@ class QFT(BlueprintCircuit): on 5 qubits with approximation degree 2 yields (the barriers are dropped in this example): .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import QFT from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/boolean_logic/inner_product.py b/qiskit/circuit/library/boolean_logic/inner_product.py index b4ee9a8dcdc..757cfe3a48d 100644 --- a/qiskit/circuit/library/boolean_logic/inner_product.py +++ b/qiskit/circuit/library/boolean_logic/inner_product.py @@ -55,7 +55,7 @@ class InnerProduct(QuantumCircuit): Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import InnerProduct from qiskit.visualization.library import _generate_circuit_library_visualization @@ -122,7 +122,7 @@ class InnerProductGate(Gate): Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import InnerProductGate diff --git a/qiskit/circuit/library/boolean_logic/quantum_and.py b/qiskit/circuit/library/boolean_logic/quantum_and.py index ad13a7cc619..9f3033fc302 100644 --- a/qiskit/circuit/library/boolean_logic/quantum_and.py +++ b/qiskit/circuit/library/boolean_logic/quantum_and.py @@ -32,7 +32,7 @@ class AND(QuantumCircuit): The AND gate without special flags equals the multi-controlled-X gate: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import AND from qiskit.visualization.library import _generate_circuit_library_visualization @@ -44,7 +44,7 @@ class AND(QuantumCircuit): ``[-1, 0, 0, 1, 1]``. .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import AND from qiskit.visualization.library import _generate_circuit_library_visualization @@ -118,7 +118,7 @@ class AndGate(Gate): The AndGate gate without special flags equals the multi-controlled-X gate: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import AndGate @@ -132,7 +132,7 @@ class AndGate(Gate): ``[-1, 0, 0, 1, 1]``. .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import AndGate diff --git a/qiskit/circuit/library/boolean_logic/quantum_or.py b/qiskit/circuit/library/boolean_logic/quantum_or.py index 3ee48e625b2..5a4f4d06b86 100644 --- a/qiskit/circuit/library/boolean_logic/quantum_or.py +++ b/qiskit/circuit/library/boolean_logic/quantum_or.py @@ -33,7 +33,7 @@ class OR(QuantumCircuit): The OR gate without special flags: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import OR from qiskit.visualization.library import _generate_circuit_library_visualization @@ -45,7 +45,7 @@ class OR(QuantumCircuit): flags ``[-1, 0, 0, 1, 1]``. .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import OR from qiskit.visualization.library import _generate_circuit_library_visualization @@ -119,7 +119,7 @@ class OrGate(Gate): The OrGate gate without special flags: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import OrGate @@ -133,7 +133,7 @@ class OrGate(Gate): flags ``[-1, 0, 0, 1, 1]``. .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import OrGate diff --git a/qiskit/circuit/library/boolean_logic/quantum_xor.py b/qiskit/circuit/library/boolean_logic/quantum_xor.py index 470807314b9..9d4f459be4d 100644 --- a/qiskit/circuit/library/boolean_logic/quantum_xor.py +++ b/qiskit/circuit/library/boolean_logic/quantum_xor.py @@ -53,7 +53,7 @@ def __init__( Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import XOR from qiskit.visualization.library import _generate_circuit_library_visualization @@ -89,7 +89,7 @@ class BitwiseXorGate(Gate): Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import BitwiseXorGate diff --git a/qiskit/circuit/library/fourier_checking.py b/qiskit/circuit/library/fourier_checking.py index 15b021dd75b..667212f4be5 100644 --- a/qiskit/circuit/library/fourier_checking.py +++ b/qiskit/circuit/library/fourier_checking.py @@ -70,7 +70,7 @@ def __init__(self, f: Sequence[int], g: Sequence[int]) -> None: Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import FourierChecking from qiskit.visualization.library import _generate_circuit_library_visualization @@ -125,7 +125,7 @@ def fourier_checking(f: Sequence[int], g: Sequence[int]) -> QuantumCircuit: **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import fourier_checking diff --git a/qiskit/circuit/library/generalized_gates/gms.py b/qiskit/circuit/library/generalized_gates/gms.py index 32d004631e2..d79b9bf79fc 100644 --- a/qiskit/circuit/library/generalized_gates/gms.py +++ b/qiskit/circuit/library/generalized_gates/gms.py @@ -45,7 +45,7 @@ class GMS(QuantumCircuit): **Expanded Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import GMS from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/generalized_gates/gr.py b/qiskit/circuit/library/generalized_gates/gr.py index 34367baaad9..6e9eddc58b2 100644 --- a/qiskit/circuit/library/generalized_gates/gr.py +++ b/qiskit/circuit/library/generalized_gates/gr.py @@ -45,7 +45,7 @@ class GR(QuantumCircuit): **Expanded Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import GR from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/generalized_gates/mcmt.py b/qiskit/circuit/library/generalized_gates/mcmt.py index 69bbc94309b..8e649b6a36c 100644 --- a/qiskit/circuit/library/generalized_gates/mcmt.py +++ b/qiskit/circuit/library/generalized_gates/mcmt.py @@ -129,7 +129,7 @@ class MCMTVChain(MCMT): **Expanded Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import MCMTVChain, ZGate from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/generalized_gates/permutation.py b/qiskit/circuit/library/generalized_gates/permutation.py index 418ae4681bb..aa27a6b20fd 100644 --- a/qiskit/circuit/library/generalized_gates/permutation.py +++ b/qiskit/circuit/library/generalized_gates/permutation.py @@ -54,7 +54,7 @@ def __init__( Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import Permutation A = [2,4,3,0,1] @@ -63,7 +63,7 @@ def __init__( Expanded Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import Permutation from qiskit.visualization.library import _generate_circuit_library_visualization @@ -118,7 +118,7 @@ def __init__( Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.library import PermutationGate @@ -130,7 +130,7 @@ def __init__( Expanded Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.library import PermutationGate diff --git a/qiskit/circuit/library/graph_state.py b/qiskit/circuit/library/graph_state.py index f1636299da6..9f84f6fcbb4 100644 --- a/qiskit/circuit/library/graph_state.py +++ b/qiskit/circuit/library/graph_state.py @@ -41,7 +41,7 @@ class GraphState(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import GraphState from qiskit.visualization.library import _generate_circuit_library_visualization @@ -106,7 +106,7 @@ class GraphStateGate(Gate): **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit import QuantumCircuit diff --git a/qiskit/circuit/library/grover_operator.py b/qiskit/circuit/library/grover_operator.py index 4bc93d63bb2..eea24323071 100644 --- a/qiskit/circuit/library/grover_operator.py +++ b/qiskit/circuit/library/grover_operator.py @@ -103,7 +103,7 @@ def grover_operator( We can construct a Grover operator just from the phase oracle: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -118,7 +118,7 @@ def grover_operator( We can also modify the state preparation: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -134,7 +134,7 @@ def grover_operator( the oracle: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -152,7 +152,7 @@ def grover_operator( objects: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: diff --git a/qiskit/circuit/library/hidden_linear_function.py b/qiskit/circuit/library/hidden_linear_function.py index 8ff07a69a24..c3bfad38c54 100644 --- a/qiskit/circuit/library/hidden_linear_function.py +++ b/qiskit/circuit/library/hidden_linear_function.py @@ -55,7 +55,7 @@ class HiddenLinearFunction(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import HiddenLinearFunction from qiskit.visualization.library import _generate_circuit_library_visualization @@ -124,7 +124,7 @@ def hidden_linear_function(adjacency_matrix: list | np.ndarray) -> QuantumCircui **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import hidden_linear_function diff --git a/qiskit/circuit/library/iqp.py b/qiskit/circuit/library/iqp.py index 500e3346833..cc9343d58a3 100644 --- a/qiskit/circuit/library/iqp.py +++ b/qiskit/circuit/library/iqp.py @@ -38,7 +38,7 @@ class IQP(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import IQP A = [[6, 5, 3], [5, 4, 5], [3, 5, 1]] @@ -48,7 +48,7 @@ class IQP(QuantumCircuit): **Expanded Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import IQP from qiskit.visualization.library import _generate_circuit_library_visualization @@ -156,7 +156,7 @@ def random_iqp( Example: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import random_iqp diff --git a/qiskit/circuit/library/n_local/efficient_su2.py b/qiskit/circuit/library/n_local/efficient_su2.py index fd41a7f3e70..ac743b5f5cf 100644 --- a/qiskit/circuit/library/n_local/efficient_su2.py +++ b/qiskit/circuit/library/n_local/efficient_su2.py @@ -71,7 +71,7 @@ def efficient_su2( CX gates, is equivalent to an all-to-all entanglement: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -85,7 +85,7 @@ def efficient_su2( For example: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: diff --git a/qiskit/circuit/library/n_local/evolved_operator_ansatz.py b/qiskit/circuit/library/n_local/evolved_operator_ansatz.py index 8ffe38f2599..386d05f16f7 100644 --- a/qiskit/circuit/library/n_local/evolved_operator_ansatz.py +++ b/qiskit/circuit/library/n_local/evolved_operator_ansatz.py @@ -61,7 +61,7 @@ def evolved_operator_ansatz( Examples: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import evolved_operator_ansatz @@ -214,7 +214,7 @@ def hamiltonian_variational_ansatz( A single operator will be split into commuting terms automatically: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.quantum_info import SparsePauliOp @@ -228,7 +228,7 @@ def hamiltonian_variational_ansatz( Alternatively, we can directly provide the terms: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.quantum_info import SparsePauliOp diff --git a/qiskit/circuit/library/n_local/excitation_preserving.py b/qiskit/circuit/library/n_local/excitation_preserving.py index e41f1a56ad9..3f37f2fe010 100644 --- a/qiskit/circuit/library/n_local/excitation_preserving.py +++ b/qiskit/circuit/library/n_local/excitation_preserving.py @@ -70,7 +70,7 @@ def excitation_preserving( With linear entanglement, this circuit is given by: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -84,7 +84,7 @@ def excitation_preserving( in each block: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: diff --git a/qiskit/circuit/library/n_local/n_local.py b/qiskit/circuit/library/n_local/n_local.py index ea4fbe88416..f9fdbe55df5 100644 --- a/qiskit/circuit/library/n_local/n_local.py +++ b/qiskit/circuit/library/n_local/n_local.py @@ -148,7 +148,7 @@ def n_local( are made up of a single block per layer: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -161,7 +161,7 @@ def n_local( Pauli-Y and Pauli-Z rotations in the rotation layer: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -171,7 +171,7 @@ def n_local( To omit rotation or entanglement layers, the block can be set to an empty list: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -181,7 +181,7 @@ def n_local( The entanglement can be set explicitly via the ``entanglement`` argument: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -194,7 +194,7 @@ def n_local( the following uses different entanglements for odd and even layers: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: diff --git a/qiskit/circuit/library/n_local/pauli_two_design.py b/qiskit/circuit/library/n_local/pauli_two_design.py index 7f2c12ba1af..d063815301e 100644 --- a/qiskit/circuit/library/n_local/pauli_two_design.py +++ b/qiskit/circuit/library/n_local/pauli_two_design.py @@ -59,7 +59,7 @@ def pauli_two_design( Examples: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import pauli_two_design @@ -148,7 +148,7 @@ class PauliTwoDesign(TwoLocal): Examples: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.library import PauliTwoDesign diff --git a/qiskit/circuit/library/n_local/qaoa_ansatz.py b/qiskit/circuit/library/n_local/qaoa_ansatz.py index bc6160b9dd7..50884039144 100644 --- a/qiskit/circuit/library/n_local/qaoa_ansatz.py +++ b/qiskit/circuit/library/n_local/qaoa_ansatz.py @@ -47,7 +47,7 @@ def qaoa_ansatz( optimization problem: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.quantum_info import SparsePauliOp diff --git a/qiskit/circuit/library/n_local/real_amplitudes.py b/qiskit/circuit/library/n_local/real_amplitudes.py index e2b3a51bf98..df6c065ad31 100644 --- a/qiskit/circuit/library/n_local/real_amplitudes.py +++ b/qiskit/circuit/library/n_local/real_amplitudes.py @@ -68,7 +68,7 @@ def real_amplitudes( Examples: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -78,7 +78,7 @@ def real_amplitudes( ansatz.draw("mpl") .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -86,7 +86,7 @@ def real_amplitudes( ansatz.draw("mpl") .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: @@ -94,7 +94,7 @@ def real_amplitudes( ansatz.draw("mpl") .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: :context: diff --git a/qiskit/circuit/library/overlap.py b/qiskit/circuit/library/overlap.py index 4806e93b7d6..e386677c9f8 100644 --- a/qiskit/circuit/library/overlap.py +++ b/qiskit/circuit/library/overlap.py @@ -128,7 +128,7 @@ def unitary_overlap( **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: import numpy as np diff --git a/qiskit/circuit/library/phase_estimation.py b/qiskit/circuit/library/phase_estimation.py index 70546741460..f5f3abc22c9 100644 --- a/qiskit/circuit/library/phase_estimation.py +++ b/qiskit/circuit/library/phase_estimation.py @@ -76,7 +76,7 @@ def __init__( Reference Circuit: .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import PhaseEstimation @@ -132,7 +132,7 @@ def phase_estimation( **Reference Circuit:** .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit import QuantumCircuit diff --git a/qiskit/circuit/library/quantum_volume.py b/qiskit/circuit/library/quantum_volume.py index 932a04b5c92..1ff480e7ef0 100644 --- a/qiskit/circuit/library/quantum_volume.py +++ b/qiskit/circuit/library/quantum_volume.py @@ -35,7 +35,7 @@ class QuantumVolume(QuantumCircuit): **Reference Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import QuantumVolume circuit = QuantumVolume(5, 6, seed=10) @@ -44,7 +44,7 @@ class QuantumVolume(QuantumCircuit): **Expanded Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import QuantumVolume from qiskit.visualization.library import _generate_circuit_library_visualization @@ -152,7 +152,7 @@ def quantum_volume( **Reference Circuit:** .. plot:: - :alt: [Diagram illustrating the previously described circuit.] + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import quantum_volume circuit = quantum_volume(5, 6, seed=10) diff --git a/qiskit/circuit/operation.py b/qiskit/circuit/operation.py index b7adb42ce4e..6a00a2a2811 100644 --- a/qiskit/circuit/operation.py +++ b/qiskit/circuit/operation.py @@ -34,7 +34,7 @@ class Operation(ABC): Add a Clifford and a Toffoli gate to a :class:`QuantumCircuit`. .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit diff --git a/qiskit/circuit/parameter.py b/qiskit/circuit/parameter.py index 1a045538392..1ccfb103412 100644 --- a/qiskit/circuit/parameter.py +++ b/qiskit/circuit/parameter.py @@ -41,7 +41,7 @@ class Parameter(ParameterExpression): Construct a variable-rotation X gate using circuit parameters. .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit import QuantumCircuit, Parameter diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index ffe083799df..53d3c1e9dea 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -835,7 +835,7 @@ class QuantumCircuit: Consider the following circuit: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit @@ -902,8 +902,8 @@ class QuantumCircuit: graphically: .. image:: /source_images/depth.gif - :alt: [Rotate the circuit and let each gate fall as far as possible. The gates fall \ - into "layers". The depth of the circuit is the number of layers.] + :alt: Rotate the circuit and let each gate fall as far as possible. The gates fall \ + into "layers". The depth of the circuit is the number of layers. We can verify our graphical result using :meth:`QuantumCircuit.depth`:: @@ -2172,7 +2172,7 @@ def tensor(self, other: "QuantumCircuit", inplace: bool = False) -> Optional["Qu Examples: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source from qiskit import QuantumCircuit @@ -3429,7 +3429,7 @@ def draw( Example: .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit @@ -4332,7 +4332,7 @@ def assign_parameters( # pylint: disable=missing-raises-doc Create a parameterized circuit and assign the parameters in-place. .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source from qiskit.circuit import QuantumCircuit, Parameter @@ -4348,7 +4348,7 @@ def assign_parameters( # pylint: disable=missing-raises-doc Bind the values out-of-place by list and get a copy of the original circuit. .. plot:: - :alt: [Circuit diagram output by the previous code.] + :alt: Circuit diagram output by the previous code. :include-source from qiskit.circuit import QuantumCircuit, ParameterVector diff --git a/qiskit/circuit/random/utils.py b/qiskit/circuit/random/utils.py index 5caba8ca2ae..7ce48bed01e 100644 --- a/qiskit/circuit/random/utils.py +++ b/qiskit/circuit/random/utils.py @@ -37,6 +37,7 @@ def random_circuit( from the set of standard gates in :mod:`qiskit.circuit.library.standard_gates`. For example: .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.random import random_circuit @@ -295,6 +296,7 @@ def random_clifford_circuit(num_qubits, num_gates, gates="all", seed=None): gates from the set of standard gates in :mod:`qiskit.circuit.library.standard_gates`. For example: .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit.random import random_clifford_circuit diff --git a/qiskit/converters/dag_to_circuit.py b/qiskit/converters/dag_to_circuit.py index 6ffa74527aa..5c81dd07a6b 100644 --- a/qiskit/converters/dag_to_circuit.py +++ b/qiskit/converters/dag_to_circuit.py @@ -34,6 +34,7 @@ def dag_to_circuit(dag, copy_operations=True): Example: .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit diff --git a/qiskit/primitives/statevector_estimator.py b/qiskit/primitives/statevector_estimator.py index f96d409631a..bdfc2c4df72 100644 --- a/qiskit/primitives/statevector_estimator.py +++ b/qiskit/primitives/statevector_estimator.py @@ -49,6 +49,7 @@ class StatevectorEstimator(BaseEstimatorV2): ``StatevectorEstimator(seed=123)``. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.circuit import Parameter, QuantumCircuit diff --git a/qiskit/providers/fake_provider/__init__.py b/qiskit/providers/fake_provider/__init__.py index 9526793f0e1..a119f8b77e9 100644 --- a/qiskit/providers/fake_provider/__init__.py +++ b/qiskit/providers/fake_provider/__init__.py @@ -29,6 +29,7 @@ Here is an example of using a simulated backend for transpilation and running. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile From 6324af5bd4f76190527a03da7c4b3d008ddf8be8 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Thu, 12 Dec 2024 11:20:04 -0600 Subject: [PATCH 18/27] More alt text and some fixes --- qiskit/circuit/quantumcircuit.py | 8 ++++---- qiskit/pulse/builder.py | 8 ++++++++ qiskit/pulse/instruction_schedule_map.py | 2 +- qiskit/pulse/library/symbolic_pulses.py | 1 + qiskit/qasm3/__init__.py | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index 53d3c1e9dea..5a16589ac26 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -2173,7 +2173,7 @@ def tensor(self, other: "QuantumCircuit", inplace: bool = False) -> Optional["Qu .. plot:: :alt: Circuit diagram output by the previous code. - :include-source + :include-source: from qiskit import QuantumCircuit top = QuantumCircuit(1) @@ -3430,7 +3430,7 @@ def draw( Example: .. plot:: :alt: Circuit diagram output by the previous code. - :include-source + :include-source: from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit qc = QuantumCircuit(1, 1) @@ -4333,7 +4333,7 @@ def assign_parameters( # pylint: disable=missing-raises-doc .. plot:: :alt: Circuit diagram output by the previous code. - :include-source + :include-source: from qiskit.circuit import QuantumCircuit, Parameter @@ -4349,7 +4349,7 @@ def assign_parameters( # pylint: disable=missing-raises-doc .. plot:: :alt: Circuit diagram output by the previous code. - :include-source + :include-source: from qiskit.circuit import QuantumCircuit, ParameterVector diff --git a/qiskit/pulse/builder.py b/qiskit/pulse/builder.py index 9b2c9208ac7..bc057980cf0 100644 --- a/qiskit/pulse/builder.py +++ b/qiskit/pulse/builder.py @@ -39,6 +39,7 @@ .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import pulse @@ -61,6 +62,7 @@ a pulse: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import pulse @@ -90,6 +92,7 @@ automatically lowered to be run as a pulse program: .. plot:: + :alt: Output from the previous code. :include-source: from math import pi @@ -277,6 +280,7 @@ Pulse instructions are available within the builder interface. Here's an example: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import pulse @@ -325,6 +329,7 @@ be used to align all pulses as late as possible in a pulse program. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import pulse @@ -1188,6 +1193,7 @@ def align_equispaced(duration: int | ParameterExpression) -> Generator[None, Non Examples: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import pulse @@ -1242,6 +1248,7 @@ def align_func( Examples: .. plot:: + :alt: Output from the previous code. :include-source: import numpy as np @@ -2116,6 +2123,7 @@ def macro(func: Callable): Examples: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import pulse diff --git a/qiskit/pulse/instruction_schedule_map.py b/qiskit/pulse/instruction_schedule_map.py index 75ce3b8ef75..3cd016a7448 100644 --- a/qiskit/pulse/instruction_schedule_map.py +++ b/qiskit/pulse/instruction_schedule_map.py @@ -52,7 +52,7 @@ class InstructionScheduleMap: """Mapping from :py:class:`~qiskit.circuit.QuantumCircuit` :py:class:`qiskit.circuit.Instruction` names and qubits to - :py:class:`~qiskit.pulse.Schedule` s. In particular, the mapping is formatted as type:: + :py:class:`~qiskit.pulse.Schedule` s. In particular, the mapping is formatted as type Dict[str, Dict[Tuple[int], Schedule]] diff --git a/qiskit/pulse/library/symbolic_pulses.py b/qiskit/pulse/library/symbolic_pulses.py index f18a1080573..560e1d52995 100644 --- a/qiskit/pulse/library/symbolic_pulses.py +++ b/qiskit/pulse/library/symbolic_pulses.py @@ -330,6 +330,7 @@ class SymbolicPulse(Pulse): without knowing the envelope definition. Now you need to provide the envelope. .. plot:: + :alt: Output from the previous code. :include-source: import sympy diff --git a/qiskit/qasm3/__init__.py b/qiskit/qasm3/__init__.py index 8f2ef60369b..5bf82f8136b 100644 --- a/qiskit/qasm3/__init__.py +++ b/qiskit/qasm3/__init__.py @@ -130,6 +130,7 @@ convert it into a :class:`.QuantumCircuit`: .. plot:: + :alt: Output from the previous code. :include-source: import qiskit.qasm3 From c77efe2cccbfd825d6d74a81a0161f6711ec77ed Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Thu, 12 Dec 2024 18:03:54 -0600 Subject: [PATCH 19/27] Adding more text --- qiskit/quantum_info/states/statevector.py | 1 + .../multipliers/hrs_cumulative_multiplier.py | 1 + .../multipliers/rg_qft_multiplier.py | 1 + qiskit/transpiler/__init__.py | 24 +++++++++++++++++-- qiskit/transpiler/layout.py | 3 +++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/qiskit/quantum_info/states/statevector.py b/qiskit/quantum_info/states/statevector.py index 087d942cba4..15519fb2e24 100644 --- a/qiskit/quantum_info/states/statevector.py +++ b/qiskit/quantum_info/states/statevector.py @@ -181,6 +181,7 @@ def draw(self, output: str | None = None, **drawer_args): Plot one of the Bell states .. plot:: + :alt: Output from the previous code. :include-source: from numpy import sqrt diff --git a/qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py b/qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py index 676d57ce434..6387edbb496 100644 --- a/qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py +++ b/qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py @@ -27,6 +27,7 @@ def multiplier_cumulative_h18( performs a non-modular multiplication on two 3-qubit sized registers is: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.synthesis.arithmetic import multiplier_cumulative_h18 diff --git a/qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py b/qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py index 550fc44694d..90a1bb665f6 100644 --- a/qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py +++ b/qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py @@ -35,6 +35,7 @@ def multiplier_qft_r17( For example, on 3 state qubits, a full multiplier is given by: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.synthesis.arithmetic import multiplier_qft_r17 diff --git a/qiskit/transpiler/__init__.py b/qiskit/transpiler/__init__.py index 7924d4034ae..8dc664727c6 100644 --- a/qiskit/transpiler/__init__.py +++ b/qiskit/transpiler/__init__.py @@ -33,6 +33,8 @@ compilation flow follows the structure given below: .. image:: /source_images/transpiling_core_steps.png + :alt: The transpilation process takes the input circuit, applies the transpilation \ + passes, then produces the output circuit. .. raw:: html @@ -335,8 +337,9 @@ example 3 qubit :class:`~.Target` above: .. plot:: - :include-source: + :include-source: + :alt: Output from the previous code. from qiskit.circuit import Parameter, Measure from qiskit.transpiler import Target, InstructionProperties from qiskit.circuit.library import UGate, RZGate, RXGate, RYGate, CXGate, CZGate @@ -395,6 +398,7 @@ :meth:`.CouplingMap.build_coupling_map`: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.circuit import Parameter, Measure @@ -450,6 +454,7 @@ target.build_coupling_map('cx').draw() .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.circuit import Parameter, Measure @@ -564,6 +569,7 @@ a fake backend with a specified number of qubits for test purposes): .. plot:: + :alt: Output from the previous code. :include-source: :context: reset @@ -621,6 +627,7 @@ ['id', 'rz', 'sx', 'x', 'cx', 'measure', 'delay'] .. plot: + :alt: Output from the previous code. :include-source: from qiskit.circuit import QuantumCircuit @@ -641,6 +648,7 @@ this gate must be decomposed. This decomposition is quite costly: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.circuit import QuantumCircuit @@ -665,7 +673,8 @@ qubits used in computations. We need to be able to map these virtual qubits in a one-to-one manner to the "physical" qubits in an actual quantum device. -.. image:: /source_images/mapping.png +.. image:: /source_images/ + :alt: Diagram illustrating how virtual qubits are mapped to physical qubits. By default, qiskit will do this mapping for you. The choice of mapping depends on the @@ -713,6 +722,7 @@ :func:`qiskit.visualization.plot_circuit_layout`: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile @@ -731,6 +741,7 @@ - **Layout Using Optimization Level 0** .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile @@ -750,6 +761,7 @@ - **Layout Using Optimization Level 3** .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile @@ -773,6 +785,7 @@ corresponding value is the label for the physical qubit to map onto: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile @@ -820,6 +833,7 @@ ``initial_layout`` in a heavy hex coupling map: .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit import QuantumCircuit, transpile @@ -829,6 +843,7 @@ ghz.draw(output='mpl') .. plot:: + :alt: Output from the previous code. :include-source: import matplotlib.pyplot as plt @@ -901,6 +916,7 @@ .. plot:: + :alt: Diagram illustrating the previously described circuit. import matplotlib.pyplot as plt from qiskit import QuantumCircuit, transpile @@ -913,6 +929,7 @@ ghz.draw(output='mpl') .. plot:: + :alt: Output from the previous code. :include-source: import matplotlib.pyplot as plt @@ -959,6 +976,7 @@ circuit such as: .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit import QuantumCircuit @@ -970,6 +988,7 @@ we can then call :func:`~.transpile` on it with ``scheduling_method`` set: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile @@ -989,6 +1008,7 @@ also look at it with the :func:`.timeline.draw` function: .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit.visualization.timeline import draw as timeline_draw diff --git a/qiskit/transpiler/layout.py b/qiskit/transpiler/layout.py index bece1967179..7011a20ece6 100644 --- a/qiskit/transpiler/layout.py +++ b/qiskit/transpiler/layout.py @@ -455,6 +455,7 @@ class TranspileLayout: let the input circuit be: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.circuit import QuantumCircuit, QuantumRegister @@ -470,6 +471,7 @@ class TranspileLayout: Suppose that during the layout stage the transpiler reorders the qubits to be: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit @@ -498,6 +500,7 @@ class TranspileLayout: becomes: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit From 2dea8840d89311804a3e6246b2b5f732fcd9b73d Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Mon, 16 Dec 2024 13:27:10 -0600 Subject: [PATCH 20/27] more alt text --- .../transpiler/passes/routing/star_prerouting.py | 1 + .../passes/scheduling/dynamical_decoupling.py | 1 + .../scheduling/padding/dynamical_decoupling.py | 1 + qiskit/transpiler/passes/utils/filter_op_nodes.py | 3 ++- qiskit/transpiler/passes/utils/remove_barriers.py | 1 + qiskit/visualization/__init__.py | 6 ++++++ .../circuit/circuit_visualization.py | 1 + qiskit/visualization/counts_visualization.py | 2 ++ qiskit/visualization/dag_visualization.py | 1 + qiskit/visualization/gate_map.py | 10 +++++++--- qiskit/visualization/pulse_v2/interface.py | 5 ++++- qiskit/visualization/state_visualization.py | 15 +++++++++++++-- qiskit/visualization/timeline/interface.py | 9 ++++++--- 13 files changed, 46 insertions(+), 10 deletions(-) diff --git a/qiskit/transpiler/passes/routing/star_prerouting.py b/qiskit/transpiler/passes/routing/star_prerouting.py index 259d79ba636..aa09e0a3fe4 100644 --- a/qiskit/transpiler/passes/routing/star_prerouting.py +++ b/qiskit/transpiler/passes/routing/star_prerouting.py @@ -89,6 +89,7 @@ class StarPreRouting(TransformationPass): For example: .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit.circuit import QuantumCircuit diff --git a/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py b/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py index 7ae27ddf03d..08371c48842 100644 --- a/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +++ b/qiskit/transpiler/passes/scheduling/dynamical_decoupling.py @@ -47,6 +47,7 @@ class DynamicalDecoupling(TransformationPass): (including global phase). .. plot:: + :alt: Output from the previous code. :include-source: import numpy as np diff --git a/qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py b/qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py index 0a692a85621..6159253e93e 100644 --- a/qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +++ b/qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py @@ -53,6 +53,7 @@ class PadDynamicalDecoupling(BasePadding): (including global phase). .. plot:: + :alt: Output from the previous code. :include-source: import numpy as np diff --git a/qiskit/transpiler/passes/utils/filter_op_nodes.py b/qiskit/transpiler/passes/utils/filter_op_nodes.py index 75b824332ae..4da15d45385 100644 --- a/qiskit/transpiler/passes/utils/filter_op_nodes.py +++ b/qiskit/transpiler/passes/utils/filter_op_nodes.py @@ -35,9 +35,10 @@ class FilterOpNodes(TransformationPass): Example: - Filter out operations that are labelled ``"foo"`` + Filter out operations that are labeled ``"foo"`` .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit diff --git a/qiskit/transpiler/passes/utils/remove_barriers.py b/qiskit/transpiler/passes/utils/remove_barriers.py index 53b500ff31c..cf374435c8e 100644 --- a/qiskit/transpiler/passes/utils/remove_barriers.py +++ b/qiskit/transpiler/passes/utils/remove_barriers.py @@ -25,6 +25,7 @@ class RemoveBarriers(TransformationPass): Example: .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit diff --git a/qiskit/visualization/__init__.py b/qiskit/visualization/__init__.py index 3fdaa9ffaa5..6d1b4e86622 100644 --- a/qiskit/visualization/__init__.py +++ b/qiskit/visualization/__init__.py @@ -47,6 +47,7 @@ The following example demonstrates the common usage of these arguments: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.visualization import plot_histogram @@ -60,6 +61,7 @@ You can specify ``legend``, ``title``, ``figsize`` and ``color`` by passing to the kwargs. .. plot:: + :alt: Output from the previous code. :include-source: :context: reset @@ -103,6 +105,7 @@ Here is an example of using :func:`plot_histogram` to visualize measurement outcome counts: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.visualization import plot_histogram @@ -144,6 +147,7 @@ Here is an example of using :func:`plot_state_city` to visualize a quantum state: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.visualization import plot_state_city @@ -157,6 +161,7 @@ obtained from a :class:`~qiskit.circuit.QuantumCircuit`: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit @@ -172,6 +177,7 @@ plot_state_city(state) .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit diff --git a/qiskit/visualization/circuit/circuit_visualization.py b/qiskit/visualization/circuit/circuit_visualization.py index 82c3307e36c..dc01e69dc41 100644 --- a/qiskit/visualization/circuit/circuit_visualization.py +++ b/qiskit/visualization/circuit/circuit_visualization.py @@ -189,6 +189,7 @@ def circuit_drawer( Example: .. plot:: + :alt: Circuit diagram output by the previous code. :include-source: from qiskit import QuantumCircuit diff --git a/qiskit/visualization/counts_visualization.py b/qiskit/visualization/counts_visualization.py index 6d93ff6bfac..b20c0b20e24 100644 --- a/qiskit/visualization/counts_visualization.py +++ b/qiskit/visualization/counts_visualization.py @@ -111,6 +111,7 @@ def plot_histogram( Examples: .. plot:: + :alt: Output from the previous code. :include-source: # Plot two counts in the same figure with legends and colors specified. @@ -215,6 +216,7 @@ def plot_distribution( Examples: .. plot:: + :alt: Output from the previous code. :include-source: # Plot two counts in the same figure with legends and colors specified. diff --git a/qiskit/visualization/dag_visualization.py b/qiskit/visualization/dag_visualization.py index 8f8b8fc8909..c80a753174c 100644 --- a/qiskit/visualization/dag_visualization.py +++ b/qiskit/visualization/dag_visualization.py @@ -100,6 +100,7 @@ def dag_drawer(dag, scale=0.7, filename=None, style="color"): Example: .. plot:: :include-source: + :nofigs: from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.dagcircuit import DAGCircuit diff --git a/qiskit/visualization/gate_map.py b/qiskit/visualization/gate_map.py index eb20623f0c8..06dc3c66e42 100644 --- a/qiskit/visualization/gate_map.py +++ b/qiskit/visualization/gate_map.py @@ -75,13 +75,14 @@ def plot_gate_map( Figure: A Matplotlib figure instance. Raises: - QiskitError: if tried to pass a simulator, or if the backend is None, + QiskitError: If you tried to pass a simulator or the backend is None, but one of num_qubits, mpl_data, or cmap is None. - MissingOptionalLibraryError: if matplotlib not installed. + MissingOptionalLibraryError: If matplotlib not installed. Example: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.providers.fake_provider import GenericBackendV2 @@ -997,11 +998,12 @@ def plot_coupling_map( Raises: MissingOptionalLibraryError: If matplotlib or graphviz is not installed. - QiskitError: If length of qubit labels does not match number of qubits. + QiskitError: If the length of qubit labels does not match the number of qubits. Example: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.visualization import plot_coupling_map @@ -1168,6 +1170,7 @@ def plot_circuit_layout(circuit, backend, view="virtual", qubit_coordinates=None Example: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile @@ -1270,6 +1273,7 @@ def plot_error_map(backend, figsize=(15, 12), show_title=True, qubit_coordinates Example: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.visualization import plot_error_map diff --git a/qiskit/visualization/pulse_v2/interface.py b/qiskit/visualization/pulse_v2/interface.py index 9d781bd6e45..b879c73224d 100644 --- a/qiskit/visualization/pulse_v2/interface.py +++ b/qiskit/visualization/pulse_v2/interface.py @@ -306,12 +306,13 @@ def draw( Examples: To visualize a pulse program, you can call this function with set of - control arguments. Most of appearance of the output image can be controlled by the + control arguments. Most of the appearance of the output image can be controlled by the stylesheet. Drawing with the default stylesheet. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile, schedule @@ -330,6 +331,7 @@ def draw( Drawing with the stylesheet suited for publication. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile, schedule @@ -348,6 +350,7 @@ def draw( Drawing with the stylesheet suited for program debugging. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile, schedule diff --git a/qiskit/visualization/state_visualization.py b/qiskit/visualization/state_visualization.py index 0e47a5fe6d7..ac003055d2c 100644 --- a/qiskit/visualization/state_visualization.py +++ b/qiskit/visualization/state_visualization.py @@ -70,10 +70,11 @@ def plot_state_hinton(state, title="", figsize=None, ax_real=None, ax_imag=None, Raises: MissingOptionalLibraryError: Requires matplotlib. - VisualizationError: if input is not a valid N-qubit state. + VisualizationError: Input is not a valid N-qubit state. Examples: .. plot:: + :alt: Output from the previous code. :include-source: import numpy as np @@ -214,6 +215,7 @@ def plot_bloch_vector( Examples: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit.visualization import plot_bloch_vector @@ -221,6 +223,7 @@ def plot_bloch_vector( plot_bloch_vector([0,1,0], title="New Bloch Sphere") .. plot:: + :alt: Output from the previous code. :include-source: import numpy as np @@ -290,6 +293,7 @@ def plot_bloch_multivector( Examples: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit @@ -304,6 +308,7 @@ def plot_bloch_multivector( plot_bloch_multivector(state) .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit @@ -406,6 +411,7 @@ def plot_state_city( Examples: .. plot:: + :alt: Output from the previous code. :include-source: # You can choose different colors for the real and imaginary parts of the density matrix. @@ -422,6 +428,7 @@ def plot_state_city( plot_state_city(state, color=['midnightblue', 'crimson'], title="New State City") .. plot:: + :alt: Output from the previous code. :include-source: # You can make the bars more transparent to better see the ones that are behind @@ -643,6 +650,7 @@ def plot_state_paulivec(state, title="", figsize=None, color=None, ax=None, *, f Examples: .. plot:: + :alt: Output from the previous code. :include-source: # You can set a color for all the bars. @@ -659,6 +667,7 @@ def plot_state_paulivec(state, title="", figsize=None, color=None, ax=None, *, f plot_state_paulivec(state, color='midnightblue', title="New PauliVec plot") .. plot:: + :alt: Output from the previous code. :include-source: # If you introduce a list with less colors than bars, the color of the bars will @@ -816,12 +825,13 @@ def plot_state_qsphere( Raises: MissingOptionalLibraryError: Requires matplotlib. - VisualizationError: if input is not a valid N-qubit state. + VisualizationError: Input is not a valid N-qubit state. QiskitError: Input statevector does not have valid dimensions. Examples: .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit @@ -836,6 +846,7 @@ def plot_state_qsphere( plot_state_qsphere(state) .. plot:: + :alt: Output from the previous code. :include-source: # You can show the phase of each state and use diff --git a/qiskit/visualization/timeline/interface.py b/qiskit/visualization/timeline/interface.py index 686e0fe1d81..50dd006633a 100644 --- a/qiskit/visualization/timeline/interface.py +++ b/qiskit/visualization/timeline/interface.py @@ -291,13 +291,14 @@ def draw( for more details. No default layout is set. (default `None`). Examples: - To visualize a scheduled circuit program, you can call this function with set of - control arguments. Most of appearance of the output image can be controlled by the + To visualize a scheduled circuit program, you can call this function with a set of + control arguments. Most of the appearance of the output image can be controlled by the stylesheet. Drawing with the default stylesheet. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile, schedule @@ -314,6 +315,7 @@ def draw( Drawing with the simple stylesheet. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile, schedule @@ -330,6 +332,7 @@ def draw( Drawing with the stylesheet suited for program debugging. .. plot:: + :alt: Output from the previous code. :include-source: from qiskit import QuantumCircuit, transpile, schedule @@ -356,7 +359,7 @@ def draw( In the same way as above, you can create custom generator or layout functions and update existing stylesheet with custom functions. - This feature enables you to control the most of appearance of the output image + This feature enables you to control the most of the appearance of the output image without modifying the codebase of the scheduled circuit drawer. """ del show_idle From 6065b156ede98bad611adf670aaaf72a399b0248 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Tue, 17 Dec 2024 14:15:21 -0600 Subject: [PATCH 21/27] missing file name --- qiskit/transpiler/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit/transpiler/__init__.py b/qiskit/transpiler/__init__.py index 8dc664727c6..7e860ec9c17 100644 --- a/qiskit/transpiler/__init__.py +++ b/qiskit/transpiler/__init__.py @@ -673,7 +673,7 @@ qubits used in computations. We need to be able to map these virtual qubits in a one-to-one manner to the "physical" qubits in an actual quantum device. -.. image:: /source_images/ +.. image:: /source_images/mapping.png :alt: Diagram illustrating how virtual qubits are mapped to physical qubits. From 15d40bd3c1284f1d42cfdf3417fd38cf6b64fe25 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Tue, 17 Dec 2024 14:17:17 -0600 Subject: [PATCH 22/27] missing blank line --- qiskit/transpiler/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qiskit/transpiler/__init__.py b/qiskit/transpiler/__init__.py index 7e860ec9c17..85dec1dff60 100644 --- a/qiskit/transpiler/__init__.py +++ b/qiskit/transpiler/__init__.py @@ -340,6 +340,7 @@ :include-source: :alt: Output from the previous code. + from qiskit.circuit import Parameter, Measure from qiskit.transpiler import Target, InstructionProperties from qiskit.circuit.library import UGate, RZGate, RXGate, RYGate, CXGate, CZGate From ee7f758d47d4ee43baea5dc34da69005ca1e5a87 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Tue, 17 Dec 2024 14:54:12 -0600 Subject: [PATCH 23/27] extra blank line --- qiskit/transpiler/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit/transpiler/__init__.py b/qiskit/transpiler/__init__.py index 85dec1dff60..86c713c77d6 100644 --- a/qiskit/transpiler/__init__.py +++ b/qiskit/transpiler/__init__.py @@ -337,7 +337,6 @@ example 3 qubit :class:`~.Target` above: .. plot:: - :include-source: :alt: Output from the previous code. From ea3afd8ad6e0041101adcaf76f8b329d279e2650 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Tue, 17 Dec 2024 16:24:11 -0600 Subject: [PATCH 24/27] update allowlist --- tools/verify_images.py | 56 ------------------------------------------ 1 file changed, 56 deletions(-) diff --git a/tools/verify_images.py b/tools/verify_images.py index 5a33263dd7b..da1f546b5dd 100755 --- a/tools/verify_images.py +++ b/tools/verify_images.py @@ -20,62 +20,6 @@ # List of allowlist files that the checker will not verify ALLOWLIST_MISSING_ALT_TEXT = [ - "qiskit/primitives/statevector_estimator.py", - "qiskit/pulse/builder.py", - "qiskit/pulse/library/symbolic_pulses.py", - "qiskit/transpiler/layout.py", - "qiskit/transpiler/__init__.py", - "qiskit/transpiler/passes/utils/filter_op_nodes.py", - "qiskit/transpiler/passes/utils/remove_barriers.py", - "qiskit/transpiler/passes/scheduling/dynamical_decoupling.py", - "qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py", - "qiskit/transpiler/passes/routing/star_prerouting.py", - "qiskit/providers/fake_provider/__init__.py", - "qiskit/quantum_info/states/statevector.py", - "qiskit/qasm3/__init__.py", - "qiskit/converters/dag_to_circuit.py", - "qiskit/circuit/controlledgate.py", - "qiskit/circuit/operation.py", - "qiskit/circuit/quantumcircuit.py", - "qiskit/circuit/__init__.py", - "qiskit/circuit/parameter.py", - "qiskit/circuit/random/utils.py", - "qiskit/circuit/library/overlap.py", - "qiskit/circuit/library/iqp.py", - "qiskit/circuit/library/graph_state.py", - "qiskit/circuit/library/phase_estimation.py", - "qiskit/circuit/library/grover_operator.py", - "qiskit/circuit/library/quantum_volume.py", - "qiskit/circuit/library/hidden_linear_function.py", - "qiskit/circuit/library/fourier_checking.py", - "qiskit/circuit/library/__init__.py", - "qiskit/circuit/library/boolean_logic/quantum_xor.py", - "qiskit/circuit/library/boolean_logic/quantum_and.py", - "qiskit/circuit/library/boolean_logic/inner_product.py", - "qiskit/circuit/library/boolean_logic/quantum_or.py", - "qiskit/circuit/library/basis_change/qft.py", - "qiskit/circuit/library/generalized_gates/gms.py", - "qiskit/circuit/library/generalized_gates/permutation.py", - "qiskit/circuit/library/generalized_gates/gr.py", - "qiskit/circuit/library/generalized_gates/mcmt.py", - "qiskit/circuit/library/arithmetic/piecewise_chebyshev.py", - "qiskit/circuit/library/n_local/real_amplitudes.py", - "qiskit/circuit/library/n_local/evolved_operator_ansatz.py", - "qiskit/circuit/library/n_local/n_local.py", - "qiskit/circuit/library/n_local/pauli_two_design.py", - "qiskit/circuit/library/n_local/qaoa_ansatz.py", - "qiskit/circuit/library/n_local/excitation_preserving.py", - "qiskit/circuit/library/n_local/efficient_su2.py", - "qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py", - "qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py", - "qiskit/visualization/dag_visualization.py", - "qiskit/visualization/gate_map.py", - "qiskit/visualization/state_visualization.py", - "qiskit/visualization/counts_visualization.py", - "qiskit/visualization/__init__.py", - "qiskit/visualization/timeline/interface.py", - "qiskit/visualization/circuit/circuit_visualization.py", - "qiskit/visualization/pulse_v2/interface.py", ] From 66d84adc7e84fead3a6639dc85c337878cebbe5c Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 18 Dec 2024 10:40:10 -0600 Subject: [PATCH 25/27] fix spacing --- tools/verify_images.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/verify_images.py b/tools/verify_images.py index da1f546b5dd..5335cd3bc4e 100755 --- a/tools/verify_images.py +++ b/tools/verify_images.py @@ -19,8 +19,7 @@ import glob # List of allowlist files that the checker will not verify -ALLOWLIST_MISSING_ALT_TEXT = [ -] +ALLOWLIST_MISSING_ALT_TEXT = [] def is_image(line: str) -> bool: From b31c0dd6066f6b97bd1a5980bd3846ae77f9b1cc Mon Sep 17 00:00:00 2001 From: Rebecca Dimock Date: Wed, 18 Dec 2024 11:31:00 -0600 Subject: [PATCH 26/27] add more alt text --- qiskit/circuit/library/generalized_gates/gr.py | 3 +++ qiskit/circuit/library/iqp.py | 2 ++ qiskit/transpiler/__init__.py | 1 + 3 files changed, 6 insertions(+) diff --git a/qiskit/circuit/library/generalized_gates/gr.py b/qiskit/circuit/library/generalized_gates/gr.py index 6e9eddc58b2..d4189f7c0bd 100644 --- a/qiskit/circuit/library/generalized_gates/gr.py +++ b/qiskit/circuit/library/generalized_gates/gr.py @@ -100,6 +100,7 @@ class GRX(GR): **Expanded Circuit:** .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import GRX from qiskit.visualization.library import _generate_circuit_library_visualization @@ -148,6 +149,7 @@ class GRY(GR): **Expanded Circuit:** .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import GRY from qiskit.visualization.library import _generate_circuit_library_visualization @@ -196,6 +198,7 @@ class GRZ(QuantumCircuit): **Expanded Circuit:** .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import GRZ from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/circuit/library/iqp.py b/qiskit/circuit/library/iqp.py index cc9343d58a3..ac8624ec701 100644 --- a/qiskit/circuit/library/iqp.py +++ b/qiskit/circuit/library/iqp.py @@ -99,6 +99,7 @@ def iqp( **Reference Circuit:** .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import iqp A = [[6, 5, 3], [5, 4, 5], [3, 5, 1]] @@ -108,6 +109,7 @@ def iqp( **Expanded Circuit:** .. plot:: + :alt: Diagram illustrating the previously described circuit. from qiskit.circuit.library import iqp from qiskit.visualization.library import _generate_circuit_library_visualization diff --git a/qiskit/transpiler/__init__.py b/qiskit/transpiler/__init__.py index 86c713c77d6..9b306443fea 100644 --- a/qiskit/transpiler/__init__.py +++ b/qiskit/transpiler/__init__.py @@ -544,6 +544,7 @@ For example, to run a simple phase estimation circuit: .. plot:: + :alt: Output from the previous code. :include-source: import numpy as np From 7ec1473bf450b63e0495a5daaea338d2577bb281 Mon Sep 17 00:00:00 2001 From: Rebecca Dimock <66339736+beckykd@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:24:48 -0600 Subject: [PATCH 27/27] Apply suggestions from code review Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> --- qiskit/circuit/library/fourier_checking.py | 12 ++++++------ qiskit/pulse/instruction_schedule_map.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qiskit/circuit/library/fourier_checking.py b/qiskit/circuit/library/fourier_checking.py index 667212f4be5..cce2dbe0e2a 100644 --- a/qiskit/circuit/library/fourier_checking.py +++ b/qiskit/circuit/library/fourier_checking.py @@ -124,13 +124,13 @@ def fourier_checking(f: Sequence[int], g: Sequence[int]) -> QuantumCircuit: **Reference Circuit:** - .. plot:: - :alt: Circuit diagram output by the previous code. - :include-source: + .. plot:: + :alt: Circuit diagram output by the previous code. + :include-source: - from qiskit.circuit.library import fourier_checking - circuit = fourier_checking([1, -1, -1, -1], [1, 1, -1, -1]) - circuit.draw('mpl') + from qiskit.circuit.library import fourier_checking + circuit = fourier_checking([1, -1, -1, -1], [1, 1, -1, -1]) + circuit.draw('mpl') **Reference:** diff --git a/qiskit/pulse/instruction_schedule_map.py b/qiskit/pulse/instruction_schedule_map.py index 3cd016a7448..75ce3b8ef75 100644 --- a/qiskit/pulse/instruction_schedule_map.py +++ b/qiskit/pulse/instruction_schedule_map.py @@ -52,7 +52,7 @@ class InstructionScheduleMap: """Mapping from :py:class:`~qiskit.circuit.QuantumCircuit` :py:class:`qiskit.circuit.Instruction` names and qubits to - :py:class:`~qiskit.pulse.Schedule` s. In particular, the mapping is formatted as type + :py:class:`~qiskit.pulse.Schedule` s. In particular, the mapping is formatted as type:: Dict[str, Dict[Tuple[int], Schedule]]