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

Fixing rabi issue when fitting fails #759

Merged
merged 4 commits into from
Mar 29, 2024
Merged

Conversation

andrea-pasquale
Copy link
Contributor

@andrea-pasquale andrea-pasquale commented Mar 20, 2024

Closes #758

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.
  • Compatibility with Qibo modules (Please edit this section if the current pull request is not compatible with the following branches).
    • Qibo: master
    • Qibolab: main
    • Qibolab_platforms_qrc: main

@andrea-pasquale andrea-pasquale added the bug Something isn't working label Mar 20, 2024
@andrea-pasquale andrea-pasquale self-assigned this Mar 20, 2024
@andrea-pasquale andrea-pasquale added this to the Qibocal 0.0.8 milestone Mar 20, 2024
@rodolfocarobene
Copy link
Contributor

Tested it, it fails gracefully now :-)

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.20%. Comparing base (c171ad9) to head (d40958a).
Report is 10 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #759      +/-   ##
==========================================
- Coverage   97.23%   97.20%   -0.03%     
==========================================
  Files         102      102              
  Lines        7297     7296       -1     
==========================================
- Hits         7095     7092       -3     
- Misses        202      204       +2     
Flag Coverage Δ
unittests 97.20% <100.00%> (-0.03%) ⬇️

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

Files Coverage Δ
.../protocols/characterization/coherence/spin_echo.py 100.00% <100.00%> (ø)
...qibocal/protocols/characterization/coherence/t1.py 100.00% <100.00%> (ø)
...qibocal/protocols/characterization/coherence/t2.py 100.00% <100.00%> (ø)
...ocal/protocols/characterization/coherence/utils.py 96.29% <100.00%> (+0.21%) ⬆️
...bocal/protocols/characterization/coherence/zeno.py 100.00% <100.00%> (ø)
...rotocols/characterization/qubit_spectroscopy_ef.py 98.48% <100.00%> (-0.03%) ⬇️
...bocal/protocols/characterization/rabi/amplitude.py 97.61% <100.00%> (+0.02%) ⬆️

... and 1 file with indirect coverage changes

@rodolfocarobene
Copy link
Contributor

However I think that also T1 may have a similar problem...
Let me finish testing all the routines and I will come back to you (I'm testing without being connected to anything so they fail immediately)

@rodolfocarobene
Copy link
Contributor

for T1 I got:

[Qibocal 0.0.8|INFO|2024-03-20 14:23:46]: Finished acquisition in less than 1 second.
/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/scipy/optimize/_minpack_py.py:94
5: RuntimeWarning: divide by zero encountered in divide
  transform = 1.0 / sigma
[Qibocal 0.0.8|WARNING|2024-03-20 14:23:46]: Exponential decay fit failed for qubit 0
 due to Residuals are not finite in the initial point.
Traceback (most recent call last):
  File "/home/rodolfo/Venv/qibo/bin/qq", line 8, in <module>
    sys.exit(command())
             ^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 115
7, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 107
8, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 168
8, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 143
4, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 783
, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/cli/_base.py", line 72, in auto
    autocalibrate(runcard, folder, force, update)
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/cli/autocalibration.py", line 56,
 in autocalibrate
    for _ in executor.run(mode=ExecutionMode.autocalibration):
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/auto/execute.py", line 69, in run
    completed = task.run(
                ^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/auto/task.py", line 112, in run
    completed.results, completed.results_time = operation.fit(completed.data)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/auto/operation.py", line 41, in w
rapper
    out = func(*args, **kwds)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/protocols/characterization/cohere
nce/t1.py", line 136, in _fit
    chi2 = {
           ^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/protocols/characterization/cohere
nce/t1.py", line 140, in <dictcomp>
    utils.exp_decay(data[qubit].wait, *fitted_parameters[qubit]),
                                       ~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 0

Then I got an error for ramsey_sequences (that does not exist anymore), so we should update the example runcard.

All other routines worked as expected

@andrea-pasquale
Copy link
Contributor Author

for T1 I got:

[Qibocal 0.0.8|INFO|2024-03-20 14:23:46]: Finished acquisition in less than 1 second.
/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/scipy/optimize/_minpack_py.py:94
5: RuntimeWarning: divide by zero encountered in divide
  transform = 1.0 / sigma
[Qibocal 0.0.8|WARNING|2024-03-20 14:23:46]: Exponential decay fit failed for qubit 0
 due to Residuals are not finite in the initial point.
Traceback (most recent call last):
  File "/home/rodolfo/Venv/qibo/bin/qq", line 8, in <module>
    sys.exit(command())
             ^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 115
7, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 107
8, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 168
8, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 143
4, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/lib/python3.11/site-packages/click/core.py", line 783
, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/cli/_base.py", line 72, in auto
    autocalibrate(runcard, folder, force, update)
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/cli/autocalibration.py", line 56,
 in autocalibrate
    for _ in executor.run(mode=ExecutionMode.autocalibration):
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/auto/execute.py", line 69, in run
    completed = task.run(
                ^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/auto/task.py", line 112, in run
    completed.results, completed.results_time = operation.fit(completed.data)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/auto/operation.py", line 41, in w
rapper
    out = func(*args, **kwds)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/protocols/characterization/cohere
nce/t1.py", line 136, in _fit
    chi2 = {
           ^
  File "/home/rodolfo/Venv/qibo/qibocal/src/qibocal/protocols/characterization/cohere
nce/t1.py", line 140, in <dictcomp>
    utils.exp_decay(data[qubit].wait, *fitted_parameters[qubit]),
                                       ~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 0

Then I got an error for ramsey_sequences (that does not exist anymore), so we should update the example runcard.

All other routines worked as expected

Also T2, SpinEcho and Zeno had the same issues. Try now.

@Edoardo-Pedicillo Edoardo-Pedicillo added this pull request to the merge queue Mar 29, 2024
Merged via the queue into main with commit 38d28d1 Mar 29, 2024
21 checks passed
@Edoardo-Pedicillo Edoardo-Pedicillo deleted the fix_rabi_error_fit branch March 29, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rabi amplitude error-handling
3 participants