General¶
- class lantz.Driver(*args, **kw)¶
Base class for all drivers.
Params name: easy to remember identifier given to the instance for logging purposes - log(level, msg, *args, **kwargs)¶
Log with the integer severity ‘level’ on the logger corresponding to this instrument.
Parameters: - level – severity level for this event.
- msg – message to be logged (can contain PEP3101 formatting codes)
- log_critical(msg, *args, **kwargs)¶
Log with the severity ‘CRITICAL’ on the logger corresponding to this instrument.
Parameters: msg – message to be logged (can contain PEP3101 formatting codes)
- log_debug(msg, *args, **kwargs)¶
Log with the severity ‘DEBUG’ on the logger corresponding to this instrument.
Parameters: msg – message to be logged (can contain PEP3101 formatting codes)
- log_error(msg, *args, **kwargs)¶
Log with the severity ‘ERROR’ on the logger corresponding to this instrument.
Parameters: msg – message to be logged (can contain PEP3101 formatting codes)
- log_info(msg, *args, **kwargs)¶
Log with the severity ‘INFO’ on the logger corresponding to this instrument.
Parameters: msg – message to be logged (can contain PEP3101 formatting codes)
- log_warning(msg, *args, **kwargs)¶
Log with the severity ‘WARNING’ on the logger corresponding to this instrument.
Parameters: msg – message to be logged (can contain PEP3101 formatting codes)
- recall(keys=None)¶
Return the last value seen for a feat or a collection of feats.
Parameters: keys (str, list, tuple, dict.) – a string or list of strings with the properties to refresh. Default None all properties. If keys is a string, returns the value. If keys is a list, returns a dictionary.
- refresh(keys=None)¶
Refresh cache by reading values from the instrument.
Parameters: keys (str or list or tuple or dict) – 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, returns a tuple. If keys is a dict, returns a dict.
- refresh_async(keys=None, *, callback=None)¶
Asynchronous refresh cache by reading values from the instrument.
Parameters: keys (str or list or tuple or dict) – 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, returns a dictionary. Return type: concurrent.future.
- update(newstate=None, *, force=False, **kwargs)¶
Update driver.
Parameters: - newstate (dict.) – a dictionary containing the new driver state.
- force – apply change even when the cache says it is not necessary.
- force – boolean.
Raises: ValueError if called with an empty dictionary.
- update_async(newstate=None, *, force=False, callback=None, **kwargs)¶
Asynchronous update driver.
Parameters: - newstate (dict.) – driver state.
- force (boolean.) – apply change even when the cache says it is not necessary.
- callback (callable.) – Called when the update finishes.
Return type: concurrent.future
Raises: ValueError if called with an empty dictionary.
- class lantz.Feat(fget=MISSING, fset=None, doc=None, *, values=None, units=None, limits=None, procs=None, read_once=False)¶
Pimped Python property for interfacing with instruments. Can be used as a decorator.
Processors can registered for each arguments to modify their values before they are passed to the body of the method. Two standard processors are defined: values and units and others can be given as callables in the procs parameter.
If a method contains multiple arguments, use a tuple. None can be used as do not change.
Parameters: - fget – getter function.
- fset – setter function.
- doc – docstring, if missing fget or fset docstring will be used.
- values – A dictionary to map key to values. A set to restrict the values. If a list/tuple instead of a dict is given, the value is not changed but only tested to belong to the container.
- units – Quantity or string that can be interpreted as units.
- procs – Other callables to be applied to input arguments.
- modifiers = None¶
instance: key: value
- value = None¶
instance: value
- class lantz.DictFeat(fget=MISSING, fset=None, doc=None, *, keys=None, **kwargs)¶
Pimped Python property with getitem access for interfacing with instruments. Can be used as a decorator.
Takes the same parameters as Feat, plus:
Parameters: keys – List/tuple restricts the keys to the specified ones.
- class lantz.Action(func=None, *, values=None, units=None, limits=None, procs=None)¶
Wraps a Driver method with Lantz. Can be used as a decorator.
Processors can registered for each arguments to modify their values before they are passed to the body of the method. Two standard processors are defined: values and units and others can be given as callables in the procs parameter.
If a method contains multiple arguments, use a tuple. None can be used as do not change.
Parameters: - func – driver method to be wrapped.
- values – A dictionary to values key to values. If a list/tuple instead of a dict is given, the value is not changed but only tested to belong to the container.
- units – Quantity or string that can be interpreted as units.
- procs – Other callables to be applied to input arguments.
- modifiers = None¶
instance: key: value