plot_slice_errors

plot_slice_errors(metadata, axes)[source]

Plot the slice errors.

This method populates the provided figure axes with a bar-plot of the truncation error incurred at each backpropagated slice. Below is an example where we plot some metadata which exists within our context.

>>> from matplotlib import pyplot as plt
>>> from qiskit_addon_obp.utils.visualization import plot_slice_errors
>>> fig, axes = plt.subplots(1, 1)
>>> plot_slice_errors(metadata, axes)
../_images/qiskit_addon_obp-utils-visualization-plot_slice_errors-2_00.png

Fig. 3 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_slice_errors-2_01.png

Fig. 4 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_slice_errors-2_02.png

Fig. 5 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_slice_errors-2_03.png

Fig. 6 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_slice_errors-2_04.png

Fig. 7 (png, hires.png, pdf)

../_images/qiskit_addon_obp-utils-visualization-plot_slice_errors-2_05.png

Fig. 8 (png, hires.png, pdf)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The truncation error incurred at each backpropagation step is displayed along the y-axis. Since each observable is treated individually, they are plotted separately.

This data is related to the one visualized by plot_accumulated_error(). That method will plot the cumulative sum of the slice errors along the x-axis.

Parameters:
  • metadata (OBPMetadata) – the metadata to be visualized.

  • axes (Axes) – the matplotlib axes in which to plot.