Utils
Util functions for qosst-bob.
- qosst_bob.utils.heatmap(data_x: ndarray, data_y: ndarray, x_label='X', y_label='Y', title='Heatmap', cmap: Colormap | str = 'rainbow', axes: Axes | None = None, clear: bool = True) Tuple[Figure, Axes]
Draw a heatmap from data_x and data_y.
- Parameters:
data_x (np.ndarray) – the data to be put in the x-axis of the heatmap.
data_y (np.ndarray) – the data to be put in the y-axis of the heatmap.
x_label (str, optional) – the label of the x-axis. Defaults to “X”.
y_label (str, optional) – the label of the y-axis. Defaults to “Y”.
title (str, optional) – the title of the figure. Defaults to “Heatmap”.
cmap (Union[matplotlib.colors.Colormap, str], optional) – the colormap to use. Defaults to rainbow.
axes (matplotlib.axes.Axes, optional) – use those axes to make the plot. Defaults to None.
clear (bool) – if True and if an axe was given, clear this axe.
- Returns:
the figure and the axe.
- Return type:
Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]
- qosst_bob.utils.heatmap_complex(data: ndarray, x_label='X', y_label='Y', title='Heatmap', cmap: Colormap | str = 'rainbow', axes: Axes | None = None, clear: bool = True) Tuple[Figure, Axes]
Draw a heatmap from data, using data.real as the values for the x-axis and data.imag for the y-axis.
- Parameters:
data (np.ndarray) – the complex data to be put in the x-axis (real part) and y-axis (imag part) of the heatmap.
x_label (str, optional) – the label of the x-axis. Defaults to “X”.
y_label (str, optional) – the label of the y-axis. Defaults to “Y”.
title (str, optional) – the title of the figure. Defaults to “Heatmap”.
cmap (Union[matplotlib.colors.Colormap, str], optional) – the colormap to use. Defaults to rainbow.
axes (matplotlib.axes.Axes, optional) – use those axes to make the plot. Defaults to None.
clear (bool) – if True and if an axe was given, clear this axe.
- Returns:
the figure and the axe.
- Return type:
Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]