-
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
Add optional local qubits parameter #351
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #351 +/- ##
===========================================
+ Coverage 55.22% 95.44% +40.21%
===========================================
Files 76 46 -30
Lines 5718 2942 -2776
===========================================
- Hits 3158 2808 -350
+ Misses 2560 134 -2426
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Thanks @alecandido and @maxhant. |
Since there is still no qubit pairs PR, I'm writing here. Just note that also the tests will need some changes: qibocal/tests/test_operations.py Line 19 in 61a81a1
|
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.
For me, this PR is only missing qubits:
key tests
#351 (comment)
Ok, I can do that. |
src/qibocal/auto/runcard.py
Outdated
@@ -29,7 +29,7 @@ class Action: | |||
"""Priority level, determining the execution order.""" | |||
qubits: list[QubitId] = Field(default_factory=list) | |||
"""Local qubits (optional).""" | |||
update: bool = True | |||
update: bool = None |
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.
I guess you wanted:
update: bool = None | |
update: bool = False |
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.
No actually None
is correct, since this is the local update relative to a protocol, which can be absent.
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.
But then we are back to the wrong type hint: it is not a bool
, that can only be True
or False
, not None
.
If update
:
- is a toggle, keep it a
bool
, and if it can be absent, just choose what is the default value (out of the two allowed) - if it's an object, then it is not a bool, and if it can be absent, it should be
Optional[MyUpdate]
, and you can set toNone
But None
can't be a bool
. And definitely, do not use an Optional[bool]
, because this is just 3-states logic (and I believe you will end up acting as if it were one of the other two values).
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.
I feel like we are over complicating things. It is an optional value that the user can provide.
I cannot put a default value (True
/False
) since by providing a value to a local parameter, the local parameter will overwrite the global option which is something that I don't want. If no local option is provided the program should choose the global option.
And definitely, do not use an
Optional[bool]
, because this is just 3-states logic (and I believe you will end up acting as if it were one of the other two values).
I feel like in this case this is exactly what I want. Since my scenario should be the following:
- if local is provided it will overwrite the global option
- if local is not provided (
local == None
) the program should use the global option
But
None
can't be abool
.
I agree with this.
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.
You're creating more cases than needed.
I understand the logic of locally prevailing definition (i.e. scopes), but here I believe it could be much simpler.
- by default, you run the autocalibration to update the runcard, so you can make the assumptions you're always updating
- if you want to disable this option for some routines, you can set the local
update
key toFalse
, for each of them that you want to set toFalse
- the only reason to set the global one to
False
is to never update
I believe that you had in mind something like "if I have more False
, I set the global to False
and switch the few different ones explicitly, otherwise I do the opposite". And that's why you'd like to set an overwritable default.
But this makes all the logic more complicate, because you're allowing every time for two complementary ways of setting the same configuration (global False
and set only local True
s, or the opposite).
Instead, only the local key is required to have the full flexibility, so in principle you could avoid having the global one at all.
But for the special (and arguably relevant [*]) case of disabling update for all, you can provide the global key.
[*]: I actually don't know how much this is going to be used; if no one is using it, we can really avoid defining the global key
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.
To me this is fine. Since we were discussing about this in #366 with @vodovozovaliza and @wilkensJ. I want to make sure that they also agree.
Is this ready to merge @alecandido? |
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.
There would still be bits to be cleaned up. But part of them are already addressed by #387.
I'm becoming mad with all the changes here and in the other PR. If it works, better to merge both, and at most keep optimizing in a further one (after merging both of them)
Cleanup outdated routines and unused features
Closes #301 and this point
from #336.
This PR adds a local
qubits
parameter for each routine.If this parameter is not provided it will be used the global parameter
qubits
, if provided it will overwrite the global parameter.Probably this is not enough for supporting two qubit gates routines.
We could address this in another PR once we port two qubit gates to the new layout.
Checklist: