Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EstimatorPubResult with plotter for ZNE data #1951

Open
wants to merge 107 commits into
base: main
Choose a base branch
from

Conversation

joshuasn
Copy link
Collaborator

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"]

qiskit_ibm_runtime/utils/estimator_pub_result.py Outdated Show resolved Hide resolved
qiskit_ibm_runtime/visualization/plot_zne.py Outdated Show resolved Hide resolved
qiskit_ibm_runtime/visualization/plot_zne.py Outdated Show resolved Hide resolved
qiskit_ibm_runtime/visualization/plot_zne.py Outdated Show resolved Hide resolved
qiskit_ibm_runtime/visualization/plot_zne.py Outdated Show resolved Hide resolved
@joshuasn joshuasn marked this pull request as ready for review November 25, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add EstimatorPubResult with plotting methods
3 participants