Refresh cache by reading values from the instrument. :param keys: a string or list of strings with the properties to refresh. Default None, meaning all properties. If keys is a string, returns the value. If keys is a list/tuple,
(self, keys=None)
| 404 | return fut |
| 405 | |
| 406 | def refresh(self, keys=None): |
| 407 | """Refresh cache by reading values from the instrument. |
| 408 | |
| 409 | :param keys: a string or list of strings with the properties to refresh. |
| 410 | Default None, meaning all properties. |
| 411 | If keys is a string, returns the value. |
| 412 | If keys is a list/tuple, returns a tuple. |
| 413 | If keys is a dict, returns a dict. |
| 414 | :type keys: str or list or tuple or dict |
| 415 | """ |
| 416 | if keys: |
| 417 | if isinstance(keys, (list, tuple)): |
| 418 | return tuple(getattr(self, key) for key in keys) |
| 419 | elif isinstance(keys, dict): |
| 420 | return {key: getattr(self, key) for key in keys.keys()} |
| 421 | elif isinstance(keys, str): |
| 422 | return getattr(self, keys) |
| 423 | else: |
| 424 | raise ValueError('keys must be a (str, list, tuple or dict)') |
| 425 | return {key: getattr(self, key) for key in self._lantz_features} |
| 426 | |
| 427 | def refresh_async(self, keys=None, *, callback=None): |
| 428 | """Asynchronous refresh cache by reading values from the instrument. |