devices#
Import: hklpy2.devices
Ophyd device construction helpers for hklpy2.
These utilities are called during diffractometer creation to build ophyd
Component and Device objects dynamically from axis specifications
and factory configurations.
|
Base class for a diffractometer's virtual axis. |
|
Return class and kwargs of a real axis from its 'specs'. |
|
Create a |
|
Import the object given its import path as text. |
|
Create an Component for a custom ophyd Device class. |
|
Return an instance of the Python 'call_name'. |
|
Parse a set of axis specifications, return Device class attributes. |
Module Contents#
- class hklpy2.devices.VirtualPositionerBase(*, physical_name: str = '', **kwargs)[source]#
Import:
hklpy2.devices.VirtualPositionerBaseBases:
ophyd.SoftPositionerBase class for a diffractometer’s virtual axis.
This base class also serves as an example where the virtual axis is twice the value of the physical axis. It is used as a Component of a ‘DiffractometerBase’ definition. The
physical_nameis the name of a sibling positioner attribute.- forward(physical: float) float[source]#
Return virtual position from physical position.
Subclass should override.
- hklpy2.devices.define_real_axis(specs: None | str | KeyValueMap, kwargs: KeyValueMap) tuple[str, Sequence, Mapping][source]#
Import:
hklpy2.devices.define_real_axisReturn class and kwargs of a real axis from its ‘specs’.
- hklpy2.devices.dict_device_factory(data: KeyValueMap, **kwargs: Any) type[source]#
Import:
hklpy2.devices.dict_device_factoryCreate a
DictionaryDevice()class using the supplied dictionary.
- hklpy2.devices.dynamic_import(full_path: str) type[source]#
Import:
hklpy2.devices.dynamic_importImport the object given its import path as text.
Motivated by specification of class names for plugins when using
apstools.devices.ad_creator().EXAMPLES:
klass = dynamic_import("ophyd.EpicsMotor") m1 = klass("gp:m1", name="m1") creator = dynamic_import("hklpy2.diffract.creator") fourc = creator(name="fourc")
From the apstools package.
- hklpy2.devices.make_component(call_name: str, *args: Any, **kwargs: Any) Component[source]#
Import:
hklpy2.devices.make_componentCreate an Component for a custom ophyd Device class.
- hklpy2.devices.make_dynamic_instance(call_name: str, *args: Any, **kwargs: Any) Any[source]#
Import:
hklpy2.devices.make_dynamic_instanceReturn an instance of the Python ‘call_name’.
- hklpy2.devices.parse_factory_axes(*, space: str | None = None, axes: KeyValueMap | None | Sequence[str] = None, order: Sequence[str] | None = None, canonical: Sequence[str] | None = None, labels: Sequence[str] | None = None, **_ignored: Any) Mapping[str, Component | Sequence[str]][source]#
Import:
hklpy2.devices.parse_factory_axesParse a set of axis specifications, return Device class attributes.
Called from the diffract.diffractometer_class_factory().