qiskit-ibm-runtime icon indicating copy to clipboard operation
qiskit-ibm-runtime copied to clipboard

Add EstimatorPubResult with plotter for ZNE data

Open joshuasn opened this issue 5 months ago • 0 comments

Summary

Adds an EstimatorPubResult class with a method for plotting ZNE data.

Details and comments

Closes #1820. The plotter supports two separate views of the data with the subplots argument–by default, all expectation values are plotted on a single plot per extrapolator: Screenshot 2024-09-25 at 5 00 16 PM Setting subplots=True gives a grid view of each value: Screenshot 2024-09-25 at 5 00 28 PM Further, we can select a subset of the values with the indices argument (here, (4, 1)): Screenshot 2024-09-25 at 5 00 39 PM

The estimator does not currently return EstimatorPubResult so the class needs to be manually instantiated with the right metadata before the method is called:

pub_result = EstimatorPubResult(result[0].data, result[0].metadata)
pub_result.metadata["resilience"]["zne"]["noise_factors"] = result.metadata["resilience"]["zne"]["noise_factors"]
pub_result.metadata["resilience"]["zne"]["extrapolated_noise_factors"] = result.metadata["resilience"]["zne"]["extrapolated_noise_factors"]
pub_result.metadata["resilience"]["zne"]["extrapolators"] = result.metadata["resilience"]["zne"]["extrapolator"]

joshuasn avatar Sep 25 '24 19:09 joshuasn