qiskit-ibm-runtime
qiskit-ibm-runtime copied to clipboard
Add EstimatorPubResult with plotter for ZNE data
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:
Setting
subplots=True
gives a grid view of each value:
Further, we can select a subset of the values with the
indices
argument (here, (4, 1)
):
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"]