deltakit.explorer.plotting.defect_rates#

deltakit.explorer.plotting.defect_rates(defect_rates_series: Iterable[dict[tuple[float, ...], list[float]]], w2_det_coords: Collection[tuple[float, ...]])#

Convenience function to plot the average defect rate plot fig 2b in Google paper https://www.nature.com/articles/s41586-022-05434-1.

Parameters:
  • defect_rates_series – List of defect rates dictionaries. E.g, this can be for the X and Z experiments for the Google data set.

  • w2_det_coords – Coordinates for the weight 2 detectors, so that these may be plotted with a separate colour and have their average separate from the higher-weight stabilisers.

Returns:

pyplot module

Return type:

matplotlib.pyplot

Examples

Plotting the Google example:

z_data_folder = data_folder / "surface_code_bZ_d3_r07_center_3_5/"
x_data_folder = data_folder / "surface_code_bX_d3_r07_center_3_5/"
z_and_x_experiment_folders = [z_data_folder, x_data_folder]

experiments = [
    QECExperiment.from_circuit_and_measurements(
        folder / "circuit_noisy.stim",
        folder / "measurements.b8",
        DataFormat.B8,
        folder / "sweep.b8",
        DataFormat.B8,
    )
    for folder in z_and_x_experiment_folders
]
all_rates = []
for experiment in experiments:
    _, rates = client.get_experiment_detectors_and_defect_rates(experiment)
    all_rates.append(rates)
defect_rates(
    all_rates,
    w2_det_coords=set({(5.0, 6.0), (1.0, 4.0), (4.0, 3.0), (2.0, 7.0)}),
)