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

Single qubit state tomography #813

Merged
merged 19 commits into from
May 20, 2024
Merged

Single qubit state tomography #813

merged 19 commits into from
May 20, 2024

Conversation

andrea-pasquale
Copy link
Contributor

@andrea-pasquale andrea-pasquale commented May 1, 2024

As title says.

TODO:

  • improve plotting

Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 98.44961% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 97.26%. Comparing base (4c23ced) to head (0afbdb8).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #813      +/-   ##
==========================================
- Coverage   97.33%   97.26%   -0.07%     
==========================================
  Files         107      108       +1     
  Lines        7915     8044     +129     
==========================================
+ Hits         7704     7824     +120     
- Misses        211      220       +9     
Flag Coverage Δ
unittests 97.26% <98.44%> (-0.07%) ⬇️

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

Files Coverage Δ
src/qibocal/protocols/__init__.py 100.00% <100.00%> (ø)
src/qibocal/protocols/state_tomography.py 98.42% <98.42%> (ø)

... and 3 files with indirect coverage changes

@andrea-pasquale
Copy link
Contributor Author

There are still a few things to be improved but it seems to work: http://login.qrccluster.com:9000/lIw8tz8rT1-ZfWeOKdmn6Q==

@andrea-pasquale
Copy link
Contributor Author

@stavros11 a88257a is a first attempt to pass circuits as json files.

Base automatically changed from fix_transpiling to main May 8, 2024 09:35
@andrea-pasquale andrea-pasquale marked this pull request as ready for review May 9, 2024 08:41
@andrea-pasquale
Copy link
Contributor Author

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 @andrea-pasquale, generally looks good to me. I will start working on the two-qubit case on top of this.

The only two issues I currently see as a bit annoying is the multiple jsons for data saving (mentioned in comment below) and the plotting. I would personally prefer bar plots, or at least print the numerical value for each matrix element in the color plot (I am not sure if this is possible with plotly). Currently we can see the values by hovering over the color plot, but it is a bit inconvenient: if I want to compare the experiment with theory I have to hover over 8 boxes. For two-qubit that would be 32 boxes. In the barplot you can overlap theory and experiment and see the difference immediately (even using multiple 2D bar plots, not the fancy 3D one).

For the two-qubit case, I was also plotting bar plots of the shots in each basis, before the matrix reconstruction. This was mainly because the matrix reconstruction is less trivial in that case, so most likely not relevant for the current PR (I might still do it for 2q though).

src/qibocal/protocols/characterization/state_tomography.py Outdated Show resolved Hide resolved

for basis in ["X", "Y", "Z"]:
basis_circuit = deepcopy(params.circuit)
# FIXME: basis
Copy link
Member

Choose a reason for hiding this comment

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

Is that still a FIXME?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is related to qiboteam/qibo#1318

src/qibocal/protocols/characterization/state_tomography.py Outdated Show resolved Hide resolved
src/qibocal/protocols/characterization/state_tomography.py Outdated Show resolved Hide resolved
@Jacfomg
Copy link
Contributor

Jacfomg commented May 10, 2024

Thanks @andrea-pasquale, generally looks good to me. I will start working on the two-qubit case on top of this.

The only two issues I currently see as a bit annoying is the multiple jsons for data saving (mentioned in comment below) and the plotting. I would personally prefer bar plots, or at least print the numerical value for each matrix element in the color plot (I am not sure if this is possible with plotly). Currently we can see the values by hovering over the color plot, but it is a bit inconvenient: if I want to compare the experiment with theory I have to hover over 8 boxes. For two-qubit that would be 32 boxes. In the barplot you can overlap theory and experiment and see the difference immediately (even using multiple 2D bar plots, not the fancy 3D one).

For the two-qubit case, I was also plotting bar plots of the shots in each basis, before the matrix reconstruction. This was mainly because the matrix reconstruction is less trivial in that case, so most likely not relevant for the current PR (I might still do it for 2q though).

I would love to have something like this https://community.plotly.com/t/is-it-possible-to-make-this-with-plotly/73696/2 , but seems too tricky honestly

@andrea-pasquale
Copy link
Contributor Author

I fixed all the points but the plotting so far, let me see if I can do something quickly.

@stavros11 stavros11 mentioned this pull request May 14, 2024
10 tasks
@andrea-pasquale
Copy link
Contributor Author

Final version of the plot: http://login.qrccluster.com:9000/3T67I38gTlizhImJ6AkXbA==/

Copy link
Contributor

@Jacfomg Jacfomg left a comment

Choose a reason for hiding this comment

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

Please fix the conflicts. Plotting seems nice.

@andrea-pasquale andrea-pasquale added this pull request to the merge queue May 20, 2024
Merged via the queue into main with commit 77f7bd1 May 20, 2024
21 checks passed
@andrea-pasquale andrea-pasquale deleted the single_qubit_tomography branch May 20, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants