-
Notifications
You must be signed in to change notification settings - Fork 306
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
getting a set-only parameter #46
Comments
My main concern here is that users know when they're asking for a When do you think this functionality will be useful?
Actually, I bet the only thing a user has to see is class StandardParameter(...):
def __init__(self):
...
self.latest = GetLatest(self)
...
class GetLatest(DelegateAttributes):
delegate_attr_objects = ['parameter']
def __init__(self, parameter):
self.parameter = parameter
def get(self):
return self.parameter._last_value
def __call__(self):
return self.get() Seem reasonable? Any other ideas what to call this thing? |
Small change, if I first standardize the names of stored values between |
I definately like the idea of .latest() or .get_latest(). I think that would be a good addition. However having .latest does not solve the problem I am having which relates to instruments that have a lacking communications protocol (and there are surprisingly many of them) In that case I would like it to be able to use the standard .get() function. For the specific problem I am having now it is a VISA instrument so I would like my parameter to still be a visa instrument and just rerout parameter.get() to the proposed parameter.latest(). If we add this feature we should add a note on when to and when not to use this feature in the docstring that explains it, unless you see a better solution. (Maybe .latest() for every parameter?) |
I'm still not sure I get your point - you want to be able to use
That's what I was proposing above - if you just want to read this value out, you do:
and to put this as data into a loop:
|
Yes, I want to rerout .get() to .latest() in some very specific cased (i.e. if the hardware does not support get-functionality). In all other cases I am very happy with the addition of the .latest() method. |
@alexcjohnson |
Haha I was about to propose exactly that. Sold, I'll add it to #48 |
closed by #48 |
Even though it is something we absolutely want to avoid there sometimes are instruments that only have set-commands, in this case I want the get command to return the value that was last set.
It is now already possible to extract the last set value by using the snapshot, however that does not make the interface the same when using it like any other parameter in some higher level script.
To give an example I have added a screenshot below of me running into this problem when developing a driver for an instrument where get-functionality has not yet been implemented.
The syntax I would propose would be something along the lines of
where soft get is either a reserved keyword (bad idea IMO), an importable function or code or some other object.
For now I'll just settle for the dirty hack of adding it in by hand.
EDIT: making get return _last_value explicitly
The text was updated successfully, but these errors were encountered: