diff --git a/docs/api/qiskit-ibm-runtime/dev/_toc.json b/docs/api/qiskit-ibm-runtime/dev/_toc.json index 0c64cdf234..8be957e769 100644 --- a/docs/api/qiskit-ibm-runtime/dev/_toc.json +++ b/docs/api/qiskit-ibm-runtime/dev/_toc.json @@ -516,6 +516,10 @@ { "title": "draw_layer_error_map", "url": "/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.visualization.draw_layer_error_map" + }, + { + "title": "draw_layer_errors_swarm", + "url": "/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.visualization.draw_layer_errors_swarm" } ] }, diff --git a/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.utils.noise_learner_result.LayerError.mdx b/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.utils.noise_learner_result.LayerError.mdx index 507c41cb91..71a4566007 100644 --- a/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.utils.noise_learner_result.LayerError.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.utils.noise_learner_result.LayerError.mdx @@ -93,40 +93,47 @@ python_api_name: qiskit_ibm_runtime.utils.noise_learner_result.LayerError **Parameters** * **embedding** (`Union`\[`Embedding`, [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.2)")]) – An `Embedding` object containing the coordinates and coupling map to draw the layer error on, or a backend to generate an `Embedding` for. - * **colorscale** (`str`) – The colorscale used to show the rates of this layer error. - * **color\_no\_data** (`str`) – The color used for qubits and edges for which no data is available. - * **color\_out\_of\_scale** (`str`) – The color used for rates with value greater than `highest_rate`. - * **num\_edge\_segments** (`int`) – The number of equal-sized segments that edges are made of. - * **edge\_width** (`float`) – The line width of the edges in pixels. - * **height** (`int`) – The height of the returned figure. - * **highest\_rate** (`Optional`\[`float`]) – The highest rate, used to normalize all other rates before choosing their colors. If `None`, it defaults to the highest value found in the `layer_error`. - * **background\_color** (`str`) – The background color. - * **radius** (`float`) – The radius of the pie charts representing the qubits. - * **width** (`int`) – The width of the returned figure. - * **code:** (*..*) – - - python: from qiskit import QuantumCircuit from qiskit.quantum\_info import PauliList from qiskit\_ibm\_runtime.utils.embeddings import Embedding from qiskit\_ibm\_runtime.utils.noise\_learner\_result import LayerError, PauliLindbladError - - \# A five-qubit 1-D embedding with nearest neighbouring connectivity coordinates1 = \[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5)] coupling\_map1 = \[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)] embedding1 = Embedding(coordinates1, coupling\_map1) - - \# A six-qubit horseshoe-shaped embedding with nearest neighbouring connectivity coordinates2 = \[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)] coupling\_map2 = \[(0, 1), (1, 2), (0, 3), (3, 4), (4, 5)] embedding2 = Embedding(coordinates2, coupling\_map2) - - \# A LayerError object circuit = QuantumCircuit(4) qubits = \[1, 2, 3, 4] generators = PauliList(\[“IIIX”, “IIXI”, “IXII”, “YIII”, “ZIII”, “XXII”, “ZZII”]) rates = \[0.01, 0.01, 0.01, 0.005, 0.02, 0.01, 0.01] error = PauliLindbladError(generators, rates) layer\_error = LayerError(circuit, qubits, error) - - \# Draw the layer error on embedding1 layer\_error.draw\_map(embedding1) - - \# Draw the layer error on embedding2 layer\_error.draw\_map(embedding2) + ```python + from qiskit import QuantumCircuit + from qiskit.quantum_info import PauliList + from qiskit_ibm_runtime.utils.embeddings import Embedding + from qiskit_ibm_runtime.utils.noise_learner_result import LayerError, PauliLindbladError + + # A five-qubit 1-D embedding with nearest neighbouring connectivity + coordinates1 = [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5)] + coupling_map1 = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)] + embedding1 = Embedding(coordinates1, coupling_map1) + + # A six-qubit horseshoe-shaped embedding with nearest neighbouring connectivity + coordinates2 = [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)] + coupling_map2 = [(0, 1), (1, 2), (0, 3), (3, 4), (4, 5)] + embedding2 = Embedding(coordinates2, coupling_map2) + + # A LayerError object + circuit = QuantumCircuit(4) + qubits = [1, 2, 3, 4] + generators = PauliList(["IIIX", "IIXI", "IXII", "YIII", "ZIII", "XXII", "ZZII"]) + rates = [0.01, 0.01, 0.01, 0.005, 0.02, 0.01, 0.01] + error = PauliLindbladError(generators, rates) + layer_error = LayerError(circuit, qubits, error) + + # Draw the layer error on embedding1 + layer_error.draw_map(embedding1) + + # Draw the layer error on embedding2 + layer_error.draw_map(embedding2) + ``` **Return type** @@ -141,7 +148,7 @@ python_api_name: qiskit_ibm_runtime.utils.noise_learner_result.LayerError This function plots the rates along a vertical axes, offsetting the rates along the `x` axis so that they do not overlap with each other. - To draw multiple layer errors at once, consider calling `draw_layer_errors_swarm()` directly. + To draw multiple layer errors at once, consider calling [`draw_layer_errors_swarm()`](qiskit_ibm_runtime.visualization.draw_layer_errors_swarm "qiskit_ibm_runtime.visualization.draw_layer_errors_swarm") directly. **Parameters** diff --git a/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.visualization.draw_layer_errors_swarm.mdx b/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.visualization.draw_layer_errors_swarm.mdx new file mode 100644 index 0000000000..324abcf3fc --- /dev/null +++ b/docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.visualization.draw_layer_errors_swarm.mdx @@ -0,0 +1,47 @@ +--- +title: draw_layer_errors_swarm (dev version) +description: API reference for qiskit_ibm_runtime.visualization.draw_layer_errors_swarm in the dev version of qiskit-ibm-runtime +in_page_toc_min_heading_level: 1 +python_api_type: function +python_api_name: qiskit_ibm_runtime.visualization.draw_layer_errors_swarm +--- + + + +# draw\_layer\_errors\_swarm + + + Draw a swarm plot for the given list of layer errors. + + This function plots the rates of each of the given layer errors along a vertical axes, offsetting the rates along the `x` axis to minimize the overlap between the markers. It helps visualizing the distribution of errors for different layer errors, as well as to track (using the `connected` argument) the evolution of specific generators across different layers. + + + To calculate the offsets, this arranges the rates in `num_bins` equally-spaced bins, and then it assigns the `x` coordinates so that all the rates in the same bins are spaced around the vertical axis. Thus, a higher value of `num_bins` will result in higher overlaps between the markers. + + + **Parameters** + + * **layer\_errors** (`list`\[[`LayerError`](qiskit_ibm_runtime.utils.noise_learner_result.LayerError "qiskit_ibm_runtime.utils.noise_learner_result.LayerError")]) – The layer errors to draw. + * **num\_bodies** (`Optional`\[`int`]) – The weight of the generators to include in the plot, or `None` if all the generators should be included. + * **max\_rate** (`Optional`\[`float`]) – The largest rate to include in the plot, or `None` if no upper limit should be set. + * **min\_rate** (`Optional`\[`float`]) – The smallest rate to include in the plot, or `None` if no lower limit should be set. + * **connected** (`Optional`\[`list`\[`Union`\[[`Pauli`](/api/qiskit/qiskit.quantum_info.Pauli "(in Qiskit v1.2)"), `str`]]]) – A list of generators whose markers are to be connected by lines. + * **colors** (`Optional`\[`list`\[`str`]]) – A list of colors for the markers in the plot, or `None` if these colors are to be chosen automatically. + * **num\_bins** (`Optional`\[`int`]) – The number of bins to place the rates into when calculating the `x`-axis offsets. + * **opacities** (`Union`\[`float`, `list`\[`float`]]) – A list of opacities for the markers. + * **names** (`Optional`\[`list`\[`str`]]) – The names of the various layers as displayed in the legend. If `None`, default names are assigned based on the layers’ position inside the `layer_errors` list. + * **x\_coo** (`Optional`\[`list`\[`float`]]) – The `x`-axis coordinates of the vertical axes that the markers are drawn around, or `None` if these axes should be placed at regular intervals. + * **marker\_size** (`Optional`\[`float`]) – The size of the marker in the plot. + * **height** (`int`) – The height of the returned figure. + * **width** (`int`) – The width of the returned figure. + + **Raises** + + * **ValueError** – If an invalid grouping option is given. + * **ValueError** – If `colors` is given but its length is incorrect. + + **Return type** + + `Figure` + + diff --git a/docs/api/qiskit-ibm-runtime/dev/visualization.mdx b/docs/api/qiskit-ibm-runtime/dev/visualization.mdx index 9cbb5cc720..039848050c 100644 --- a/docs/api/qiskit-ibm-runtime/dev/visualization.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/visualization.mdx @@ -18,8 +18,9 @@ A suite of functions for visualizing qiskit-ibm-runtime’s objects. ## Functions -| | | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`draw_execution_spans`](qiskit_ibm_runtime.visualization.draw_execution_spans "qiskit_ibm_runtime.visualization.draw_execution_spans")(\*spans\[, names, ...]) | Draw one or more [`ExecutionSpans`](qiskit_ibm_runtime.execution_span.ExecutionSpans "qiskit_ibm_runtime.execution_span.ExecutionSpans") on a bar plot. | -| [`draw_layer_error_map`](qiskit_ibm_runtime.visualization.draw_layer_error_map "qiskit_ibm_runtime.visualization.draw_layer_error_map")(layer\_error, embedding) | Draw a map view of a [`LayerError`](qiskit_ibm_runtime.utils.noise_learner_result.LayerError "qiskit_ibm_runtime.utils.noise_learner_result.LayerError"). | +| | | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`draw_execution_spans`](qiskit_ibm_runtime.visualization.draw_execution_spans "qiskit_ibm_runtime.visualization.draw_execution_spans")(\*spans\[, names, ...]) | Draw one or more [`ExecutionSpans`](qiskit_ibm_runtime.execution_span.ExecutionSpans "qiskit_ibm_runtime.execution_span.ExecutionSpans") on a bar plot. | +| [`draw_layer_error_map`](qiskit_ibm_runtime.visualization.draw_layer_error_map "qiskit_ibm_runtime.visualization.draw_layer_error_map")(layer\_error, embedding) | Draw a map view of a [`LayerError`](qiskit_ibm_runtime.utils.noise_learner_result.LayerError "qiskit_ibm_runtime.utils.noise_learner_result.LayerError"). | +| [`draw_layer_errors_swarm`](qiskit_ibm_runtime.visualization.draw_layer_errors_swarm "qiskit_ibm_runtime.visualization.draw_layer_errors_swarm")(layer\_errors\[, ...]) | Draw a swarm plot for the given list of layer errors. | diff --git a/public/api/qiskit-ibm-runtime/dev/objects.inv b/public/api/qiskit-ibm-runtime/dev/objects.inv index b6ff4f431f..5103a5ecbb 100644 Binary files a/public/api/qiskit-ibm-runtime/dev/objects.inv and b/public/api/qiskit-ibm-runtime/dev/objects.inv differ diff --git a/public/images/api/qiskit-ibm-runtime/dev/fake_provider-1_02.png b/public/images/api/qiskit-ibm-runtime/dev/fake_provider-1_02.png index c05a5bfba0..ac90160ceb 100644 Binary files a/public/images/api/qiskit-ibm-runtime/dev/fake_provider-1_02.png and b/public/images/api/qiskit-ibm-runtime/dev/fake_provider-1_02.png differ diff --git a/scripts/config/api-html-artifacts.json b/scripts/config/api-html-artifacts.json index 57284feace..74121db047 100644 --- a/scripts/config/api-html-artifacts.json +++ b/scripts/config/api-html-artifacts.json @@ -29,7 +29,7 @@ "0.19": "https://ibm.box.com/shared/static/wjoea4x5tnxd0l4lgo2v3kxnx6btxvvl.zip" }, "qiskit-ibm-runtime": { - "dev": "https://api.github.com/repos/Qiskit/qiskit-ibm-runtime/actions/artifacts/2173495540/zip", + "dev": "https://api.github.com/repos/Qiskit/qiskit-ibm-runtime/actions/artifacts/2178981798/zip", "0.33": "https://ibm.box.com/shared/static/dpyhy6pa4xcmdz1881bjq7fkmcc47nuh.zip", "0.32": "https://ibm.box.com/shared/static/enr0tnwaxzpvrypzjav4f1vjip3yfqcy.zip", "0.31": "https://ibm.box.com/shared/static/z19dt14je6cz69oi4knraitjglzo29w7.zip", diff --git a/scripts/config/historical-pages-to-latest.json b/scripts/config/historical-pages-to-latest.json index a5c8df5b53..4acc48081a 100644 --- a/scripts/config/historical-pages-to-latest.json +++ b/scripts/config/historical-pages-to-latest.json @@ -19258,7 +19258,9 @@ }, "0.31": {}, "0.32": {}, - "dev": {} + "dev": { + "qiskit_ibm_runtime.visualization.draw_layer_errors_swarm": "/" + } }, "qiskit-ibm-transpiler": { "0.3": {