ophyd.device.DynamicDeviceComponent¶
- class ophyd.device.DynamicDeviceComponent(defn, *, clsname=None, doc=None, kind=<Kind.normal: 1>, default_read_attrs=None, default_configuration_attrs=None, component_class=<class 'ophyd.device.Component'>, base_class=None)¶
An Device component that dynamically creates an ophyd Device
- Parameters
- defnOrderedDict
The definition of all attributes to be created, in the form of:
defn['attribute_name'] = (SignalClass, pv_suffix, keyword_arg_dict)
This will create an attribute on the sub-device of type SignalClass, with a suffix of pv_suffix, which looks something like this:
parent.sub.attribute_name = Cpt(SignalClass, pv_suffix, **keyword_arg_dict)
Keep in mind that this is actually done in the metaclass creation, and not exactly as written above.
- clsnamestr, optional
The name of the class to be generated This defaults to {parent_name}{this_attribute_name.capitalize()}
- docstr, optional
The docstring to put on the dynamically generated class
- default_read_attrslist, optional
A class attribute to put on the dynamically generated class
- default_configuration_attrslist, optional
A class attribute to put on the dynamically generated class
- component_classclass, optional
Defaults to Component
- base_classclass, optional
Defaults to Device
- __init__(defn, *, clsname=None, doc=None, kind=<Kind.normal: 1>, default_read_attrs=None, default_configuration_attrs=None, component_class=<class 'ophyd.device.Component'>, base_class=None)¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(defn, *[, clsname, doc, kind, …])Initialize self.
create_component
(instance)Instantiate the object described by this Component for a Device
make_docstring
(parent_class)Create a docstring for the Component
maybe_add_prefix
(instance, kw, suffix)Add prefix to a suffix if kw is in self.add_prefix
sub_default
(func)Default subscription decorator
sub_meta
(func)Metadata subscription decorator
sub_value
(func)Value subscription decorator
subscriptions
(event_type)(Decorator) Specify subscriptions callbacks in the Device definition
Attributes
is_device
Does this Component contain a Device?
is_signal
Does this Component contain a Signal?