-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unpickling old objects may not work with new methods and object attributes #183
Comments
Hey @maij I have indeed noticed this behaviour before. however, I'm a bit wary of also introducing I had also come across other issues with pickling pulse sequencing, such as it being fairly slow (dill is even slower than pickle), and that it sometimes causes issues when updating silq / qcodes. I thought that with the new ParameterNode structure, it should actually be fairly straightforward to serialize a pulse sequence to json and also to create a pulse sequence from json. It should also be a much faster process, and probably also much cleaner. There's also the advantage that the file can be opened by a text editor, so one could also view the pulse sequence without using python. |
I encountered an example of this when unpickling an old pulse sequence.
The pulse sequence contains
FrequencyRampPulse
s which don't contain a recently added new attributephase_reference
, which is required for methods such asget_voltage
. I'm performing a hotfix for this instance in #204, but this a broader issue which might reoccur.I had a brief look into a proper fix, but I got a bit lost.
When pickle loads objects it calls
__new__
but not__init__
, so default values aren't created. I'm beginning to think each class should have default values (not just what's written in__init__
) which can be modified with__new__
.@nulinspiratie Do you understand what the issue is here, have you thought about this before?
This is how I think it should approximately work (
Foo
is good,Bar
is bad), although this doesn't really work when all attributes areParameter
s that are created during__init__
. Could we move parameter creation to__new__
?The text was updated successfully, but these errors were encountered: