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

fix: AutoQASM measurement of physical qubits #788

Merged

Conversation

rmshaffer
Copy link
Contributor

Issue #, if available:

Description of changes:

  • Change the parameter type check in measure so that we handle physical qubits (i.e., strings) correctly.

Testing done:

  • Add a test for physical qubit measurement. Also verify that tox -e notebooks passes locally.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9bfd34c) 100.00% compared to head (4acfcf6) 100.00%.

Additional details and impacted files
@@                Coverage Diff                 @@
##           feature/autoqasm      #788   +/-   ##
==================================================
  Coverage            100.00%   100.00%           
==================================================
  Files                   163       163           
  Lines                  9774      9773    -1     
  Branches               2084      2084           
==================================================
- Hits                   9774      9773    -1     
Files Coverage Δ
...experimental/autoqasm/instructions/measurements.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

@rmshaffer rmshaffer requested a review from yitchen-tim November 7, 2023 20:16
@rmshaffer rmshaffer marked this pull request as ready for review November 7, 2023 20:18
@rmshaffer rmshaffer requested a review from a team as a code owner November 7, 2023 20:18
bit b;
bit[2] c;
bit __bit_0__;
__bit_0__ = measure $0;
Copy link
Contributor

Choose a reason for hiding this comment

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

wow can't believe we were missing this case! glad you found it

@@ -42,7 +46,7 @@ def measure(qubits: Union[QubitIdentifierType, Iterable[QubitIdentifierType]]) -
Returns:
BitVar: Bit variable the measurement results are assigned to.
"""
if not isinstance(qubits, Iterable):
if is_qubit_identifier_type(qubits):
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice solution!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I always seem to forget that str is an Iterable

@rmshaffer rmshaffer merged commit f6e2f9a into feature/autoqasm Nov 7, 2023
22 checks passed
@rmshaffer rmshaffer deleted the rmshaffer/autoqasm-physical-qubit-measurement branch November 7, 2023 20:32
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.

2 participants