(2/3) Add a method to generate a list of circuits for TREX benchmarking and readout calibration - #8185
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8185 +/- ##
==========================================
- Coverage 99.59% 99.59% -0.01%
==========================================
Files 1122 1122
Lines 102566 102598 +32
==========================================
+ Hits 102154 102182 +28
- Misses 412 416 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@NoureldinYosri and @obriente can you take a look at this one? |
|
@ddddddanni it looks like there's a type annotation check failure in CI. when you get a chance, could you investigate? |
Done! I will also find someone to review this PR next week. |
|
@ddddddanni Thank you for your work! I went ahead and added Nour and Tom to the reviewers for this PR, per your comment a couple of weeks ago. |
obriente
left a comment
There was a problem hiding this comment.
Some minor text edit requests, and one big question re: data output format.
obriente
left a comment
There was a problem hiding this comment.
LGTM, new formatting makes sense, thanks for fixing the nits.
mhucka
left a comment
There was a problem hiding this comment.
@ddddddanni Thank you for this work! I have one smallish request. the generate_trex_and_readout_circuits function has an insert_strategy parameter, but it doesn't look like the tests exercise the possibility that the value is not INLINE. Could the tests be expanded to cover that?
This might be a place where a parametrized test is useful. Something like
@pytest.mark.parametrize(
"insert_strategy, expected_moments_count",
[
(cirq.InsertStrategy.INLINE, 3),
(cirq.InsertStrategy.EARLIEST, 2),
],
)
def test_generate_trex_and_readout_circuits_insert_strategy(
insert_strategy: cirq.InsertStrategy, expected_moments_count: int
) -> None:
"""Test that the insert_strategy is correctly applied to generated twirled circuits."""
...
Done! |
Thank you! |
mhucka
left a comment
There was a problem hiding this comment.
@ddddddanni A couple of possible issues may be lurking.
mhucka
left a comment
There was a problem hiding this comment.
I'm sorry to have a couple more issues spotted in a final look-over … (I know this has gone on too long. This will be the last changes.)
| q: qubit_pauli_dict_unsorted[q] for q in sorted(qubit_pauli_dict_unsorted) | ||
| } | ||
|
|
||
| joint_basis_pauli: cirq.PauliString = ops.PauliString(qubit_pauli_dict) |
There was a problem hiding this comment.
I'm not sure why this switches between cirq.PauliString and ops.PauliString. Should they be the same? It looks like the rest of the code usually uses ops, so maybe the type declaration should be:
| joint_basis_pauli: cirq.PauliString = ops.PauliString(qubit_pauli_dict) | |
| joint_basis_pauli: ops.PauliString = ops.PauliString(qubit_pauli_dict) |
There was a problem hiding this comment.
Yes those are the same, and I realize I mess up with the two. Changed!
This PR adds a method generate_trex_and_readout_circuits which generates pauli circuits and readout circuits for trex readout benchmarking and pauli calculation.
The generated circuits are tested in: https://colab.sandbox.google.com/drive/1LVOEUDIkx5EtFJmCSyh2UR6QP_3t-PDG?resourcekey=0-O3gWlDvxUUWDx23O2xqtgQ#scrollTo=UNCUryvsqUfO, which looks good.