From 61208d8d46b74351251aef2a33c4041ba5a05ad0 Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Sun, 25 Aug 2024 20:05:20 -0400 Subject: [PATCH] expand auto generated APIs --- docs/apis.rst | 63 +++++++++++++++++++++++++- src/exengine/events/detector_events.py | 28 ++++++------ src/exengine/kernel/ex_future.py | 20 ++++---- 3 files changed, 87 insertions(+), 24 deletions(-) diff --git a/docs/apis.rst b/docs/apis.rst index b0f483c..fdea469 100644 --- a/docs/apis.rst +++ b/docs/apis.rst @@ -9,7 +9,6 @@ ExecutionEngine :members: :exclude-members: register_device - .. autoclass:: exengine.kernel.ex_future.ExecutionFuture :members: @@ -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 \ No newline at end of file diff --git a/src/exengine/events/detector_events.py b/src/exengine/events/detector_events.py index 04e4a2e..fc040d6 100644 --- a/src/exengine/events/detector_events.py +++ b/src/exengine/events/detector_events.py @@ -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 @@ -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, @@ -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 diff --git a/src/exengine/kernel/ex_future.py b/src/exengine/kernel/ex_future.py index cd8227d..cd48792 100644 --- a/src/exengine/kernel/ex_future.py +++ b/src/exengine/kernel/ex_future.py @@ -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)