Skip to content

Commit

Permalink
expand auto generated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypinkard committed Aug 26, 2024
1 parent 7c66389 commit 61208d8
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 24 deletions.
63 changes: 62 additions & 1 deletion docs/apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ExecutionEngine
:members:
:exclude-members: register_device


.. autoclass:: exengine.kernel.ex_future.ExecutionFuture
:members:

Expand Down Expand Up @@ -37,3 +36,65 @@ Data
.. autoclass:: exengine.kernel.data_handler.DataHandler
:members:

Micro-Manager Devices
=====================

.. autoclass:: exengine.backends.micromanager.mm_device_implementations.MicroManagerDevice
:members:

.. autoclass:: exengine.backends.micromanager.mm_device_implementations.MicroManagerSingleAxisStage
:members:

.. autoclass:: exengine.backends.micromanager.mm_device_implementations.MicroManagerXYStage
:members:

.. autoclass:: exengine.backends.micromanager.mm_device_implementations.MicroManagerCamera
:members:


Implemented Events
==================

Detector Events
```````````````

.. autoclass:: exengine.events.detector_events.ReadoutData

.. autoclass:: exengine.events.detector_events.DataAcquiredNotification

.. autoclass:: exengine.events.detector_events.StartCapture

.. autoclass:: exengine.events.detector_events.StartContinuousCapture

.. autoclass:: exengine.events.detector_events.StopCapture

Positioner Events
`````````````````

.. autoclass:: exengine.events.positioner_events.SetPosition2DEvent

.. autoclass:: exengine.events.positioner_events.SetTriggerable2DPositionsEvent

.. autoclass:: exengine.events.positioner_events.SetPosition1DEvent

.. autoclass:: exengine.events.positioner_events.SetTriggerable1DPositionsEvent

.. autoclass:: exengine.events.positioner_events.StopTriggerablePositionSequenceEvent

Property Events
````````````````
.. autoclass:: exengine.events.property_events.SetPropertiesEvent

.. autoclass:: exengine.events.property_events.SetTriggerablePropertySequencesEvent

.. autoclass:: exengine.events.property_events.StopTriggerablePropertySequencesEvent

Miscellaneous Events
````````````````````
.. autoclass:: exengine.events.misc_events.Sleep

.. autoclass:: exengine.events.misc_events.SetTimeEvent

Multi-Dimensional Acquisition Events
````````````````````````````````````
.. autofunction:: exengine.events.multi_d_events.multi_d_acquisition_events
28 changes: 15 additions & 13 deletions src/exengine/events/detector_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from exengine import ExecutionEngine


class DataAcquired(Notification[DataCoordinates]):
class DataAcquiredNotification(Notification[DataCoordinates]):
category = NotificationCategory.Data
description = "Data has been acquired by a camera or other data-producing device and is now available"
# payload is the data coordinates of the acquired data
Expand All @@ -19,22 +19,24 @@ class ReadoutData(Stoppable, DataProducing, ExecutorEvent):
"""
Readout one or more blocks of data (e.g. images) and associated metadata from a Detector device (e.g. a camera)
Args:
data_coordinate_iterator (Iterable[DataCoordinates]): An iterator or list of DataCoordinates objects, which
specify the coordinates of the data that will be read out, should be able to provide at least num_images
elements (or indefinitely if num_images is None)
detector (Union[Detector, str]): The Detector object to read data from. Can be the object itself,
:param data_coordinate_iterator (Iterable[DataCoordinates]): An iterator or list of DataCoordinates objects, which
specify the coordinates of the data that will be read out, should be able to provide at least num_images
elements (or indefinitely if num_images is None)
:param detector (Union[Detector, str]): The Detector object to read data from. Can be the object itself,
or the name of the object in the ExecutionEngine's device registry.
num_blocks (int): The number of pieces of data (e.g. images) to read out. If None, the readout will continue until
:param num_blocks (int): The number of pieces of data (e.g. images) to read out. If None, the readout will continue until
the data_coordinate_iterator is exhausted or the Detector is stopped and no more images are available.
stop_on_empty (bool): If True, the readout will stop when the detector is stopped when there is no data
:param stop_on_empty (bool): If True, the readout will stop when the detector is stopped when there is no data
available to read
data_handler (DataHandler): The DataHandler object that will handle the data read out by this event
:param data_handler (DataHandler): The DataHandler object that will handle the data read out by this event
"""
notification_types = [DataAcquired]
notification_types = [DataAcquiredNotification]

def __init__(self, data_coordinates_iterator: Union[DataCoordinatesIterator,
Iterable[DataCoordinates], Iterable[Dict[str, Union[int, str]]]],
def __init__(self,
data_coordinates_iterator: Union[DataCoordinatesIterator,
Iterable[DataCoordinates],
Iterable[Dict[str, Union[int, str]]]],
detector: Optional[Union[Detector, str]] = None,
data_handler: DataHandler = None,
num_blocks: int = None,
Expand Down Expand Up @@ -62,7 +64,7 @@ def execute(self) -> None:
return
elif image is not None:
self.put_data(image_coordinates, image, metadata)
self.publish_notification(DataAcquired(image_coordinates))
self.publish_notification(DataAcquiredNotification(image_coordinates))
break


Expand Down
20 changes: 10 additions & 10 deletions src/exengine/kernel/ex_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ def await_data(self, coordinates: Optional[Union[DataCoordinates, Dict[str, Unio
this function is called before the data is acquired, the data may have already been saved and not readily
available in RAM. In this case, the data will be read from disk.
Args:
coordinates: A single DataCoordinates object/dictionary, or Sequence (i.e. list or tuple) of
DataCoordinates objects/dictionaries. If None, this function will block until the next data is
acquired/processed/saved
return_data: whether to return the data
return_metadata: whether to return the metadata
processed: whether to wait until data has been processed. If not data processor is in use, then this
parameter has no effect
stored: whether to wait for data that has been stored. If the call to await data occurs before the data
gets passed off to the storage_backends class, then it will be stored in memory and returned immediately without having to retrieve
:param coordinates: A single DataCoordinates object/dictionary, or Sequence (i.e. list or tuple) of
DataCoordinates objects/dictionaries. If None, this function will block until the next data is
acquired/processed/saved
:param return_data: whether to return the data
:param return_metadata: whether to return the metadata
:param processed: whether to wait until data has been processed. If not data processor is in use, then this
parameter has no effect
:param stored: whether to wait for data that has been stored. If the call to await data occurs before the data
gets passed off to the storage_backends class, then it will be stored in memory and returned immediately without having to retrieve
"""

coordinates_iterator = DataCoordinatesIterator.create(coordinates)
Expand Down

0 comments on commit 61208d8

Please sign in to comment.