You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently reviewing a bit the API for the motors and I believe they can be better expressed to be more generic than they currently are.
At the time I believe that they were a starting point to address an initial design; for the application I'm working on I may propose a change that looks something along these lines (affected module is exengine.device_types):
"""Base classes for device_implementations that can be used by the execution engine"""fromabcimportabstractmethodimportnumpyasnpfromexengine.kernel.deviceimportDevicefromtypingimportTypedDict, Generic, TypeVar, SequenceT=TypeVar('T')
X=TypeVar('X')
classPosition(TypedDict, Generic[T]):
"""Typed dictionary for describing position values of a positioner. Parameters ---------- axis : X The axis or axes that the value corresponds to. """axis: strvalue: TclassPositioner(Device):
""" A positioner that can move along a single axis (e.g. a z drive used as a focus stage) """@abstractmethoddefset_position(self, position: Position[float]) ->None:
"""Set the position of the device."""
...
@abstractmethoddefget_position(self, axis: str) ->Position[float]:
"""Return the position of the device on the specific axis."""
...
classTriggerablePositioner(Positioner):
""" A special type of positioner that can accept a sequence of positions to move to when provided external TTL triggers """@abstractmethoddefset_sequence(self, positions: Sequence[Position[np.ndarray]]) ->None:
...
@abstractmethoddefget_sequence_length(self) ->int:
...
@abstractmethoddefstop_sequence(self) ->None:
...
I understand that this might be somewhat disruptive of the current situation, but I remember that the initial design was closely related to Micro-Manager APIs. This would give a much needed higher level of flexibility to whoever wants to implement it's own device interface.
EDIT: link typo
The text was updated successfully, but these errors were encountered:
I still think that the typing for triggerable sequences can be done even better, but this is a first draft that came to me on a whim while working on my application.
I'm currently reviewing a bit the API for the motors and I believe they can be better expressed to be more generic than they currently are.
At the time I believe that they were a starting point to address an initial design; for the application I'm working on I may propose a change that looks something along these lines (affected module is exengine.device_types):
I understand that this might be somewhat disruptive of the current situation, but I remember that the initial design was closely related to Micro-Manager APIs. This would give a much needed higher level of flexibility to whoever wants to implement it's own device interface.
EDIT: link typo
The text was updated successfully, but these errors were encountered: