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 a function for running circuits in a shuffled order with readout error benchmarking. #6945

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

Conversation

ddddddanni
Copy link

@ddddddanni ddddddanni commented Jan 13, 2025

This pull request adds a function to run the circuits in a shuffled order with readout error benchmarking.

This pull request introduces a new function, run_shuffled_with_readout_benchmarking, to the cirq.experiments module. The function allows users to execute a set of quantum circuits in a randomized (shuffled) order while performing readout error benchmarking.

Open questions:

  1. I put the method under experiment folder. The reason is this method performs readout benchmarking, which is a little bit similar to single_qubit_readout_calibration which is also under this folder.
  2. I use the qubits extracts from the input circuits to generate random readout benchmarking circuits. Not sure if this is the intended way to do so.
  3. For generating random readout calibration circuits, this is based on the random bit strings (in a straight forward way). Not sure if there are better ways to generate those circuits.

…he first commit only extracts qubits from the input circuits. The commit also adds a corresponding test.
Also add some tests to check the correctness of the implementation.
@ddddddanni ddddddanni requested review from mrwojtek, vtomole and a team as code owners January 13, 2025 08:09
@ddddddanni ddddddanni requested a review from mpharrigan January 13, 2025 08:09
@eliottrosenberg
Copy link
Collaborator

eliottrosenberg commented Jan 14, 2025

Regarding question 1, I think @dstrain115 was saying that this should go in cirq.contrib, but I don't have a strong preference myself.
Regarding question 2, maybe we let that be the default behavior and allow the user to optionally specify qubits to use for readout benchmarking.
Regadring question 3, that sounds good to me.

Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please try to breakdown the method into smaller functions

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.87%. Comparing base (988ecbc) to head (85b8566).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6945    +/-   ##
========================================
  Coverage   97.86%   97.87%            
========================================
  Files        1084     1086     +2     
  Lines       94408    94538   +130     
========================================
+ Hits        92393    92528   +135     
+ Misses       2015     2010     -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ddddddanni
Copy link
Author

please try to breakdown the method into smaller functions

Sure, I breakdown the method into several sub methods.

@ddddddanni ddddddanni closed this Jan 15, 2025
@ddddddanni ddddddanni reopened this Jan 15, 2025
@ddddddanni
Copy link
Author

Regarding question 1, I think @dstrain115 was saying that this should go in cirq.contrib, but I don't have a strong preference myself. Regarding question 2, maybe we let that be the default behavior and allow the user to optionally specify qubits to use for readout benchmarking. Regadring question 3, that sounds good to me.

Done! I moved the whole stuff to contrib directory, and also added an optional 'qubit' input to the method. Additionally, I also added a test to reflect the change.

Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from a coding point of view, overall looks good % nits


@eliottrosenberg can you check the correctness

Copy link
Collaborator

@eliottrosenberg eliottrosenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Danni! This looks great! Just some small nits.

ddddddanni and others added 4 commits January 16, 2025 16:30
…readout_benchmarking.py

Co-authored-by: Noureldin <noureldinyosri@gmail.com>
…readout_benchmarking.py

Co-authored-by: Noureldin <noureldinyosri@gmail.com>
Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM%nits

Also address lint and format errors
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants