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

abstract register qubit #554

Merged
merged 14 commits into from
Oct 19, 2023
Merged

abstract register qubit #554

merged 14 commits into from
Oct 19, 2023

Conversation

Edoardo-Pedicillo
Copy link
Contributor

This PR closes #541

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

@Edoardo-Pedicillo
Copy link
Contributor Author

Edoardo-Pedicillo commented Oct 12, 2023

@alecandido @andrea-pasquale Could you please take a quick look at the new register_qubit function? Sorry for the commented code, I will remove it as soon as possible

@andrea-pasquale
Copy link
Contributor

@alecandido @andrea-pasquale Could you please take a quick look at the new register_qubit function? Sorry for the commented code, I will remove it as soon as possible

I think that it looks good.
A possible enhancement could be to have a clearer distinction between keys and values in data.
Currently keys are treated as args while values are treated as kwargs.

def register_qubit(self, dtype, *args, **kwargs):
"""Store output for single qubit."""
# to be able to handle the non-sweeper case
ar = np.empty(np.shape(kwargs[list(kwargs.keys())[0]]), dtype=dtype)
for key, value in kwargs.items():
ar[key] = value
if len(args) == 1:
args = args[0]
if args in self.data:
self.data[args] = np.rec.array(np.concatenate((self.data[args], ar)))
else:
self.data[args] = np.rec.array(ar)

We could introduce an argument called key or index to pass the key and for the rest we can keep kwargs.
I think that this could be relevant given that for some protocols the key could be also a tuple (especially for two qubit gates protocols).
Let me know what you think.

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #554 (df76391) into main (9abd302) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #554      +/-   ##
==========================================
- Coverage   96.00%   95.97%   -0.03%     
==========================================
  Files          88       88              
  Lines        6055     5939     -116     
==========================================
- Hits         5813     5700     -113     
+ Misses        242      239       -3     
Flag Coverage Δ
unittests 95.97% <100.00%> (-0.03%) ⬇️

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

Files Coverage Δ
src/qibocal/auto/operation.py 100.00% <100.00%> (ø)
src/qibocal/fitting/classifier/data.py 100.00% <100.00%> (ø)
.../qibocal/protocols/characterization/allxy/allxy.py 100.00% <100.00%> (ø)
.../characterization/allxy/allxy_drag_pulse_tuning.py 100.00% <100.00%> (ø)
...tocols/characterization/allxy/drag_pulse_tuning.py 100.00% <100.00%> (+3.77%) ⬆️
...bocal/protocols/characterization/classification.py 100.00% <100.00%> (ø)
.../protocols/characterization/coherence/spin_echo.py 100.00% <100.00%> (ø)
...tocols/characterization/coherence/spin_echo_msr.py 100.00% <100.00%> (ø)
...qibocal/protocols/characterization/coherence/t1.py 100.00% <100.00%> (ø)
...cal/protocols/characterization/coherence/t1_msr.py 100.00% <ø> (ø)
... and 24 more

@alecandido
Copy link
Member

Unfortunately, I will be unable to have look until late next week, sorry

@andrea-pasquale
Copy link
Contributor

Unfortunately, I will be unable to have look until late next week, sorry

Don't worry @alecandido. Thank you for letting us know. I will put @GabrielePalazzo as a reviewer.

Copy link
Contributor

@GabrielePalazzo GabrielePalazzo left a comment

Choose a reason for hiding this comment

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

I agree with @andrea-pasquale.

Apart from the comment below, everything else seems good to me.

src/qibocal/auto/operation.py Outdated Show resolved Hide resolved
Copy link
Contributor

@andrea-pasquale andrea-pasquale left a 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 the code when I was calibrating qw5q_gold and it looks good to me. As soon as you fixed conflicts we should be ready to merge.

@andrea-pasquale andrea-pasquale added this pull request to the merge queue Oct 19, 2023
Merged via the queue into main with commit d12808d Oct 19, 2023
21 checks passed
@andrea-pasquale andrea-pasquale deleted the register_qubit branch October 19, 2023 10:09
@GabrielePalazzo GabrielePalazzo mentioned this pull request Oct 31, 2023
8 tasks
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.

Abstract register_qubit
4 participants