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 probabilities to MeasurementOutcomes #1066

Merged
merged 44 commits into from
Nov 15, 2023
Merged

Add probabilities to MeasurementOutcomes #1066

merged 44 commits into from
Nov 15, 2023

Conversation

BrunoLiegiBastonLiegi
Copy link
Contributor

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi commented Oct 30, 2023

Tiny patch to #1039 that implements the calculation of the probabilities starting from the frequencies in MeasurementOutcomes objects.

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b5a6a2c) 100.00% compared to head (60f4253) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1066   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           63        63           
  Lines         8835      8857   +22     
=========================================
+ Hits          8835      8857   +22     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi marked this pull request as ready for review October 30, 2023 06:44
@scarrazza
Copy link
Member

@BrunoLiegiBastonLiegi did you test this on hardware?

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

Not yet, I am going to test it asap.

Copy link
Member

@stavros11 stavros11 left a comment

Choose a reason for hiding this comment

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

Thanks @BrunoLiegiBastonLiegi, looks good to me. The comments are not really blocking, although I would give a try to lower the tolerance in the test.

I also have not tested on hardware (will test the qibolab PR soon), but I don't the current PR is breaking anything since you are just calculating the probabilities from frequencies, and it shouldn't make a difference if the frequencies are simulated or obtained from hardware.

tests/test_result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
@BrunoLiegiBastonLiegi
Copy link
Contributor Author

BrunoLiegiBastonLiegi commented Oct 31, 2023

Ok, I made a quick test on the hardware and the calculation of the probabilities from the frequencies works.
I'll do another one after I added the qubits parameter to probabilities here as well.
One thing it's not completely clear to me though. If the user asks for a subset of the measured qubits, should you renormalize the probabilities of the selected qubits such that they still sum to one, or you just ignore the other qubits and return the global probabilities of the selected ones?

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

Ok I have added the qubits parameter and tested on hardware. It seems to work fine up to the calibration of the qubits.

tests/test_result.py Show resolved Hide resolved
tests/test_result.py Outdated Show resolved Hide resolved
tests/test_result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
tests/test_result.py Outdated Show resolved Hide resolved
src/qibo/result.py Show resolved Hide resolved
tests/test_result.py Outdated Show resolved Hide resolved
renatomello and others added 12 commits October 31, 2023 14:22
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
@renatomello renatomello self-requested a review November 6, 2023 06:30
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
src/qibo/result.py Outdated Show resolved Hide resolved
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
Co-authored-by: Renato Mello <renato.msf@gmail.com>
@renatomello renatomello merged commit ad2fd18 into master Nov 15, 2023
21 checks passed
@renatomello renatomello deleted the circuit_output branch November 15, 2023 05:59
@renatomello renatomello changed the title Add probabilities to MeasurementOutcomes Add probabilities to MeasurementOutcomes Nov 29, 2023
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.

4 participants