-
Notifications
You must be signed in to change notification settings - Fork 15
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
Drop pulse serial #750
Drop pulse serial #750
Conversation
Thanks, I agree with the removal. Just two quick remarks without checking all the changes:
|
This is something I'm genuinely unsure about. For the applications I have in mind, I'm even considering weakening
I also want the second for the comparison, because if I copy the pulse I'd like to have a different pulse_ = pulse.copy()
assert pulse == pulse_
assert pulse is not pulse_
assert pulse.id != pulse_.id (even though it doesn't have to be called However, I'm not sure if a loaded pulse should actually be different from its original version. Let's say that I dump the results and the sequence, I might still want to be able to retrieve the content as That's why I was thinking to replace the property with an actual attribute, to be initialized by Maybe it's overly complicated, but that's what makes me unsure. And with |
Oh, definitely! Most of the changes in #683 are non-breaking. But a few of them are breaking, and these are some of those. In principle, before merging we could provide a temporary |
f08b50d
to
0e8aff5
Compare
1cf9dc9
to
9469c5c
Compare
This is on top of #756, so that one should be merged first (even though both will end up in |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## 0.2 #750 +/- ##
==========================================
- Coverage 61.99% 61.84% -0.16%
==========================================
Files 47 47
Lines 5776 5748 -28
==========================================
- Hits 3581 3555 -26
+ Misses 2195 2193 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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, changes are fine with me. My only concerns are what I raised before:
- about
pulse.id
not being very useful as it is, as it is equivalent toid(pulse)
, but I understand that you'd like to keep it as property because you intend to change its implementation at some point. - the debugging issue. This is QM specific, I am not sure if it is relevant for other drivers, but until we have a proper mechanism for debugging (which I am not really sure how it would look), I would rather keep the QUA scripts readable. This is particularly because I have an open communication with some people from QM where I send scripts generated by the driver and they check the quality, so it is probably better if they are somehow readable. This to keep in mind while fixing conflicts with Sequence unrolling with QM #738.
Also, probably not for this PR, but the Waveform
class looks a bit useless. It is a wrapper over a numpy array and implements trivial methods like __len__
, __hash__
, etc.
str(pulse.id) | ||
] = pulse.id |
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 did not test, but there is a possibility that this will not work as it will need str
in both sides. Again, this will become a problem while trying to fix the conflicts between this and #738.
Exactly
Ok, I take your point. Let's open an issue to solve before merging
That class is already dead in my mind. I want to replace that and the
So, yes, I definitely agree with you. |
Btw, I'm not in an extreme hurry to merge, but I want to keep That's why I'm planning to merge these PRs even with a single approval (only I will wait until Tuesday. If you don't have time @PiergiorgioButtarini no worries, it's simply not necessary. In case, #768 has more priority (just because you're the only reviewer). |
In general, the checks on the serial are quite trivial, just putting the exact same function generating the string that has been used on the other side The only non-trivial part of these tests is the check that the pulse has not been modified after the initialization However, if needed, we'll be able to restore these tests after freezing the dataclasses
QM requires some keys to be strings, because of the way they are later processed. And before they were (by accident, since we were using the serial as an identifier).
9cc1fe6
to
dea5405
Compare
Thanks @alecandido! From my side I don't need a readable identifier (like it was |
There will be quite a few breaking changes, but consider that I'm merging to |
@PiergiorgioButtarini just noting that |
I didn't test as well, just waiting for merging to On the one side, I'm not even sure we want to merge now, because maybe we want to add even more breaking changes before merging. EDIT: my plan is to keep |
The goal of this PR is to drop
pulse.serial
and its relatives, since their goal shouldhave been serialization, but they were mainly used as a hash of the pulse itself.
Pulse.serial
dropPulseSequence.serial
Waveform.serial
pulse.serial
withpulse.id
(most places)Pulse.__hash__
pulse.serial
withhash(pulse)
To the best of my knowledge, they have never actually been used for serialization, so
I'm not aiming to preserve this functionality.
With the transition to
dataclass
, serializing the content should be pretty simple (assimple as calling
asdict()
, for as long as it is not nested), so this is somethingthat we could do even later on (especially because many other things related to
Pulse
will change in the near future).
Pulse.__hash__
will automatically come from a frozen instance. But, to reduce theeffects on everything else, I will avoid freezing
Pulse
for some time, and manuallyprovide a hash (not really appropriate for a mutable object, but for as long as we do
not use mutability and the hash at some time nothing terrible will happen).
Thus, it is intended only as a placeholder.
The hash is needed because there are places where the pulses want to be compared
according to their actual content, rather than a unique ID.
The main use case will be deduplication, but it's already being used for comparing the
content of sequences, so it is required to reproduce part of the behavior of
Pulse.serial
.