-
Notifications
You must be signed in to change notification settings - Fork 319
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_parameter() with DelegateParameter have inconsistent defaults for bind_to_instrument #6715
Comments
@thangleiter There is a logical error in add_parameter if bind_to_instrument is False. I am however curious of you use case for using add_parameter if you don't want to bind to the instrument? Why not simply create the Parameter with DelegateParameter("name", ...) for that use case? The only thing add_parameter really does is to create the parameter with the supplied args and then registers it on the instrument. |
Hi @jenshnielsen, in the end it's not a crucial issue. It just came up as I was updating the TimeTagger driver to use the preferred pattern for adding parameters of using Obvioiusly, I could just not use |
@thangleiter Thanks for the explanation. If you want to avoid snapshotting I would recommend passing Honestly, I never planned for the use case where someone would do `self.foo = self.add_parameter(..., bind_to_instrument=False) and the intension was that if a parameter was assigned as an attribute, it should also be bound to the instrument (which basically amount to adding it to the parameters dict. I would be tempted to suggest that: |
That should work, yes. |
Using the preferred pattern
param = inst.add_parameter(...)
together withparam_cls=DelegateParameter
defaults tobind_to_instrument=True
, whereasDelegateParameter
defaults toFalse
. The latter's behavior is explicitly pointed out in the docs (which also makes sense to me).However, forcing
bind_to_instrument=False
raises aQCoDeSDeprecationWarning
.MWE:
At the very least, the inconsistency should be resolved, however, I'd petition for allowing
DelegateParameter
s not bound to instruments.The text was updated successfully, but these errors were encountered: