-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 a tool for measuring expectation values of Pauli strings with readout error mitigation #7067
base: main
Are you sure you want to change the base?
Conversation
…of qubits as input
… readout error mitigation
…CalibrationResult. Besides, fixed some lints
Hey @eliottrosenberg and @NoureldinYosri if you could take a look at this. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work Danni!! This looks really great!
A few initial comments:
Regarding line 55 in shuffle_circuits_with_readout_benchmarking.py
, it should be possible to specify 0 for num_random_bitstrings
in order to do the measurement without readout mitigation (or have a different way of running without readout mitigation).
I think you went with lists of tuples for circuits_to_pauli
because you can't put a cirq.Circuit
into a dictionary, but you can put a cirq.FrozenCircuit
into a dictionary, so maybe that would be more convenient (not sure). Also, the object that measure_pauli_strings
outputs is pretty complicated, with lots of nested tuples, so maybe we want to create some data class for the output?
…_random_bitstrings, and add a test to cover the situation. The design is the run_shuffled_with_readout_benchmarking method will return a empty SingleQubitReadoutCalibrationResult if no calibration is actually done. 2. Allow measure_pauli_strings to take num_random_bitstrings = 0. In this case, no mitigation is actually done, and the mitigated result and unmitigated result are the same. Also add a test to handle this situation. 3. Make the return type of measure_pauli_strings a data class.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Danni!! I tried testing it in this colab and got the error shown there.
Can you try again? The problem should be fixed in the latest commit ;) |
This PR does the following two things:
Improved Readout Benchmarking: Modified run_shuffled_with_readout_benchmarking to accept a list of qubit tuples (List[Tuple[Qubit]]). This allows for calculating the readout error rate on specific qubit subsets, ensuring alignment with the qubit sets used in non-identity Pauli operators within Pauli strings.
Added a tool to compute expectation values for Pauli operators. This tool calculates both unmitigated and readout-error-mitigated expectation values for each circuit, and integrates the results from the readout benchmarking.