QPUPlot#
Module: exa.core.plotting.qpu_plot
- class QPUPlot(chip_label, qb_colormap=None, tc_colormap=None, cr_colormap=None, observations=None, aux_colormap=None, save_directory=None, resolution=300, figure_format='png', split_dut_field=None, chip_layout=None)#
Bases:
objectHelp creating a plot for a given QPU that shows observation data.
Initialize QPUPlot.
- Parameters:
chip_label (str) – The DUT label of the chip, used to find the respective chip design record.
qb_colormap (ListedColormap | None) – If provided, color the qubits in the topology plot based on their data value, otherwise qubits are uncolored.
tc_colormap (ListedColormap | None) – If provided, color the couplers in the topology plot based on their data value, otherwise couplers are uncolored.
cr_colormap (ListedColormap | None) – If provided, color the computational resonators in the topology plot based on their data value, otherwise computational resonators are uncolored.
aux_colormap (ListedColormap | None) – Auxiliary colormap that is used by CDF plot.
observations (Sequence[ObservationDefinition] | None) – An optional list of observations passed on initialization, to be used in the plot. More observations can be added via add_observations or add_observations_from_database methods.
save_directory (Path | None) – Where to save the figure.
resolution (int) – If figures are saved, rasterize with the given value in dpi.
figure_format (str) – All figures will be saved in this format, for example, png, jpg, pdf, svg.
split_dut_field (Callable[[str], tuple[str, str]] | None) – How to extract component and parameter names from the DUT field. Default assumes that {dut_field}=={component_name}.{parameter_name}.
chip_layout (ChipLayout | None) – Providing a chip layout is required if the metro data is not available in the chip design record.
Attributes
The chip architecture definition (CHAD).
The chip label, same as the DUT label.
List of figures rather than list of dictionary of figures for compliance.
The plain list of observations.
Methods
Add the given observations to our observations list.
Add observations from database, filtering based on the provided criteria.
Get observations from an existing stash, independently of their origin.
Converts fidelities to errors and errors to fidelities.
Draw all the plots for all the data we have.
Draw bar chart plots for the latest observations of a given type.
Draw a cumulative histogram plot for all the observations of the given obs_types.
Plot a histogram for observation.
Draw a time series plot for multiple DUT fields.
Draw the topology plots for all the observations.
Set the auxiliary colormap.
Set the colormaps to the given ones.
Set the computational resonator colormap to the given one.
Set the qubit colormap to the given one.
Set the directory to which we save resulting figures to.
Set the coupler colormap to the given one.
Print out a summary of the data stored within the QPUPlot object.
- property figs: list[Figure]#
List of figures rather than list of dictionary of figures for compliance.
- property observations: list[ObservationData | LocalObservation]#
The plain list of observations.
- add_observations(observations)#
Add the given observations to our observations list.
It’s up to the caller of the method to decide where these observations came from.
- Parameters:
observations (ObservationDefinition | Sequence[ObservationDefinition]) – This will be added to the QPUPlot’s observations list.
- Return type:
None
- add_observations_from_database(*, latest=True, all_tags=True, dut_fields=None, obs_params=None, run_id=None, tags=None, min_date=None, max_date=None)#
Add observations from database, filtering based on the provided criteria.
- Parameters:
latest (bool) – Add only the latest observation for each DUT field. Otherwise add all observations for the given filters.
all_tags (bool) – Add the observations that satisfy all tags. Otherwise add observations that contain at least one tag if specified in
tags.dut_fields (list[str] | None) – The IDs of the type of observation in the database, e.g., component_name.parameter_name.
obs_params (list[Parameter] | None) – Add the observations with this parameter for each of the components on the chip if they have it.
run_id (UUID | None) – Add only the observations from the specified run ID.
tags (list[str] | None) – Tags to filter the observations. If this is the only argument, the latest observations for these tags are returned.
min_date (date | str | None) – Exclude observations with earlier created_timestamp. If defined as a string, it should be in ISO-8601 date format. Dates are not aware of timezones. Requires
max_dateto be set.max_date (date | str | None) – Only include observations with earlier created_timestamp. If defined as a string, it should be in ISO-8601 date format. Dates are not aware of timezones. Requires
min_dateto be set.
- Return type:
None
- add_observations_from_stash(stash, components=None, observations=None, tags=None)#
Get observations from an existing stash, independently of their origin.
- Parameters:
stash (ObservationStash) – ObservationStash to load from.
components (list[str] | None) – List of components to load observations for. Defaults to None.
observations (list[str] | None) – List of observations to load. Defaults to None.
tags (list[str] | None) – List of tags to load. Defaults to None.
- Return type:
None
- draw_all(save_directory=None, **kwargs)#
Draw all the plots for all the data we have.
- Supported plots:
topology plot
cumulative histogram (CDF)
- draw_topology(save_directory=None, include_comp_names=True, close_fig=False, **kwargs)#
Draw the topology plots for all the observations.
- Parameters:
- Returns:
The topology plot for each observation parameter.
- Return type:
- draw_cdf(observation_types=None, save_directory=None, figsize=(6.0, 4.0), **kwargs)#
Draw a cumulative histogram plot for all the observations of the given obs_types.
The observations for each obs_type will be drawn on its own line, but in the same plot with the rest. The obs_types of the same unit will be plotted on the same plot, otherwise they will be drawn on different plots.
- Parameters:
- Returns:
The CDF plot for each unit.
- Return type:
- draw_bar_chart(save_directory=None, **kwargs)#
Draw bar chart plots for the latest observations of a given type.
If one_per_dut_field = True, all observations (not only the latest) are plotted in a box plot.
- draw_time_series(dut_fields, save_directory=None, **kwargs)#
Draw a time series plot for multiple DUT fields.
- draw_histogram(save_directory=None, obs_types=None, **kwargs)#
Plot a histogram for observation.
- Parameters:
- Returns:
The histogram for each observation parameter.
- Return type:
- summarize()#
Print out a summary of the data stored within the QPUPlot object.
- Return type:
None
- set_save_directory(save_directory=None)#
Set the directory to which we save resulting figures to.
Leaving this blank will clear the save_directory.
- Parameters:
save_directory (Path | None)
- Return type:
None
- set_colormaps(qb_colormap=<matplotlib.colors.ListedColormap object>, tc_colormap=<matplotlib.colors.ListedColormap object>, cr_colormap=<matplotlib.colors.ListedColormap object>, aux_colormap=<matplotlib.colors.ListedColormap object>)#
Set the colormaps to the given ones. Default is IQM colormap for both qubits and couplers.
- Return type:
None
- set_qb_colormap(colormap=<matplotlib.colors.ListedColormap object>)#
Set the qubit colormap to the given one. Default is IQM colormap.
- Return type:
None
- set_tc_colormap(colormap=<matplotlib.colors.ListedColormap object>)#
Set the coupler colormap to the given one. Default is IQM colormap.
- Return type:
None
- set_cr_colormap(colormap=<matplotlib.colors.ListedColormap object>)#
Set the computational resonator colormap to the given one. Default is IQM colormap.
- Return type:
None
- set_aux_colormap(colormap=<matplotlib.colors.ListedColormap object>)#
Set the auxiliary colormap. Default is IQM colormap.
- Return type:
None
- convert_fidelity_and_error()#
Converts fidelities to errors and errors to fidelities.
Note that in order to convert, we create new local observations with the correct parameters and delete the old ones, so this function is not perfectly reversible.
- Return type:
None
Inheritance
