-
Notifications
You must be signed in to change notification settings - Fork 17
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 sweeper types #459
Add sweeper types #459
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
==========================================
+ Coverage 57.59% 57.66% +0.06%
==========================================
Files 37 37
Lines 6198 6205 +7
==========================================
+ Hits 3570 3578 +8
+ Misses 2628 2627 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Seems cool to me, the biggest thing would be also deciding how each sweeper will behave on the existing routines. |
Thank you @Jacfomg, I think that what qibocal should do is another issue... I opened a PR in qibocal #369 if you want to propose things. In any case, this would require a driver update, I was able to update the rfsoc one, but the others are missing. |
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 @rodolfocarobene.
This is a nice idea, especially if we want to implement more than one way of sweeping a parameter without having to duplicate code.
If I understand correctly this feature will not break the other drivers but if they implement the same approach that you used her it will be possible to change in qibocal the way in which you sweep by changing the sweeper type, correct?
Yes, that's correct. If we merge this as it is the drivers will just continue to use the sweepers as before, not considering the "type" of the sweeper. I think we can merge this just after the zcu111 driver |
@rodolfocarobene given that you have already 4 approving reviews feel free to merge this whenever you want :) |
Thanks @rodolfocarobene for helping with this. I was wondering if there is a clearer way. class Sweeper:
values: npt.NDArray
def calculate_absolute_values(self, base_value):
return self.type.value(self.values, base_value)
# driver code
if sweeper.type == SweeperType.ABSOLUTE:
values = sweeper.values
else:
values = sweeper.calculate_absolute_values(base_value) If we wanted to remove the if statement within the driver and always use the same call (irrespective of the type) we may as well rename it as values: class Sweeper:
_values: npt.NDArray
def values(self, base_value):
return self.type.value(self._values, base_value)
# driver code
values = sweeper.values(base_value) @alecandido what do you think? |
Thanks, @aorgazf, for the proposal. I definitely like the idea of base values, it is fine to define the operand, but at the moment they were mainly (symmetric) binary functions, apart from the absolute. In general, I believe this bit could (and should) also be encoded in this PR (since it's strictly related), but we definitely need a more thorough discussion about sweepers standardization, even in light of some of the ideas of @stavros11 and @maxhant (respectively: per-pulse sweep values and multi-parameter sweepers). Among the two alternatives proposed, I like more the second one (of course ^^). Not much because of the fewer lines of code (that, when explicit enough, I always like), but because there is less code (i.e. tasks) delegated to the driver specific implementation. |
I added the |
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.
Tests are failing for a reason already reported in #373.
For sure they should pass before merging, but for me the update is fine.
I'll wait for the tests to pass for merging |
Adding a type parameter to sweepers, so that it's possible to choose if the sweeper should be relative-multiplied, relative-summed or absolute.
Still nothing was tested with qibocal, I'll open a PR.
But before, If someone has some comment on the implementation please tell me.
I coded the type enum so that it add "natively" the operation to execute
This enables to use the same interface for the three cases. For example, from the Rfsoc driver:
Checklist: