-
Notifications
You must be signed in to change notification settings - Fork 7
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
ro_optimization in autocalibration #392
Conversation
Can we try to have this working, or if you have to work on something else can I take it ? |
We might need this also to fix #337 given that when optimizing the freq we can clearly see in which direction the clouds are rotating. |
This reverts commit f04b0eb.
…to auto_ro_optimization
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #392 +/- ##
==========================================
+ Coverage 97.03% 97.15% +0.11%
==========================================
Files 48 49 +1
Lines 3107 3233 +126
==========================================
+ Hits 3015 3141 +126
Misses 92 92
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Sorry for the number of commits, but I had some troubles with the stash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Edoardo-Pedicillo.
I still need to test the routine on hardware, generally looks good to me.
Please find below some suggestions.
src/qibocal/protocols/characterization/readout_optimization/ro_frequency.py
Outdated
Show resolved
Hide resolved
src/qibocal/protocols/characterization/readout_optimization/ro_frequency.py
Outdated
Show resolved
Hide resolved
src/qibocal/protocols/characterization/readout_optimization/ro_frequency.py
Outdated
Show resolved
Hide resolved
src/qibocal/protocols/characterization/readout_optimization/ro_frequency.py
Outdated
Show resolved
Hide resolved
I was testing it and the cumulative takes the times we measured. Now all the time the routine takes is on the execution. As there usually short time-scale noise going on that can be seen on weird blobs that decrease fidelity I suppose we should set a high default value for nshots if we want to avoid to do software averages. Also, checking if just using a high number of shots would help could be measured running a calibrate qubit states with many points using now the new cumulative function. |
…_frequency.py Co-authored-by: Juan Cereijo <[email protected]>
…_frequency.py Co-authored-by: Juan Cereijo <[email protected]>
Yes indeed, I have not implemented the software average for this reason. Maybe I can add this as a suggestion somewhere. |
…_frequency.py Co-authored-by: Juan Cereijo <[email protected]>
…_frequency.py Co-authored-by: Juan Cereijo <[email protected]>
…_frequency.py Co-authored-by: Juan Cereijo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Edoardo-Pedicillo.
I tested it on hardware and it seems to work as expected.
Just a few minor comments than we can merge.
Could you also have a look at the coverage?
src/qibocal/protocols/characterization/readout_optimization/resonator_frequency.py
Outdated
Show resolved
Hide resolved
src/qibocal/protocols/characterization/readout_optimization/resonator_frequency.py
Outdated
Show resolved
Hide resolved
iq_state0 = data[qubit, 0][data[qubit, 0].freq == freq][["i", "q"]] | ||
iq_state1 = data[qubit, 1][data[qubit, 1].freq == freq][["i", "q"]] | ||
iq_state0 = iq_state0.i + 1.0j * iq_state0.q | ||
iq_state1 = iq_state1.i + 1.0j * iq_state1.q | ||
|
||
iq_state1 = np.array(iq_state1) | ||
iq_state0 = np.array(iq_state0) | ||
nshots = len(iq_state0) | ||
|
||
iq_mean_state1 = np.mean(iq_state1) | ||
iq_mean_state0 = np.mean(iq_state0) | ||
|
||
vector01 = iq_mean_state1 - iq_mean_state0 | ||
rotation_angle = np.angle(vector01) | ||
|
||
iq_state1_rotated = iq_state1 * np.exp(-1j * rotation_angle) | ||
iq_state0_rotated = iq_state0 * np.exp(-1j * rotation_angle) | ||
|
||
real_values_state1 = iq_state1_rotated.real | ||
real_values_state0 = iq_state0_rotated.real | ||
|
||
real_values_combined = np.concatenate( | ||
(real_values_state1, real_values_state0) | ||
) | ||
|
||
cum_distribution_state1 = cumulative( | ||
real_values_combined, real_values_state1 | ||
) | ||
cum_distribution_state0 = cumulative( | ||
real_values_combined, real_values_state0 | ||
) | ||
|
||
cum_distribution_diff = np.abs( | ||
np.array(cum_distribution_state1) - np.array(cum_distribution_state0) | ||
) | ||
argmax = np.argmax(cum_distribution_diff) | ||
errors_state1 = nshots - cum_distribution_state1[argmax] | ||
errors_state0 = cum_distribution_state0[argmax] | ||
fidelities.append((errors_state1 + errors_state0) / nshots / 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same operation that we are doing for the single shot classification, right?
We should be able to recycle that function in one way or another.
Did you speed up also the fitting in the single shot classification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same operation that we are doing for the single shot classification, right?
Yes
We should be able to recycle that function in one way or another.
If not strictly necessary now, I prefer to do it in the (near) future PR to port the classification models.
Did you speed up also the fitting in the single shot classification?
Yes, only the cumulative part.
src/qibocal/protocols/characterization/readout_optimization/resonator_frequency.py
Outdated
Show resolved
Hide resolved
…sonator_frequency.py Co-authored-by: Andrea Pasquale <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Edoardo-Pedicillo, looks good to me.
This PR implements the ro frequency optimization and a new cumulative function using numba.
Checklist: