Skip to content

Commit

Permalink
more documenation; added APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypinkard committed Aug 22, 2024
1 parent f60a885 commit 8a75fd6
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 27 deletions.
46 changes: 46 additions & 0 deletions docs/apis.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
==============
API Reference
==============

ExecutionEngine
================

.. autoclass:: exengine.kernel.executor.ExecutionEngine
:members:
:exclude-members: register_device


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



Data
=====

.. autoclass:: exengine.kernel.data_storage_base.DataStorage
:members:

.. autoclass:: exengine.kernel.data_coords.DataCoordinates

.. autoclass:: exengine.kernel.data_coords.DataCoordinatesIterator
:members:

.. autoclass:: exengine.kernel.data_handler.DataHandler
:members:


Base classes for extending ExEngine
===================================

.. autoclass:: exengine.device_types.Device
:members:

.. autoclass:: exengine.kernel.ex_event_base.ExecutorEvent
:members:

.. autoclass:: exengine.kernel.notification_base.Notification
:members:

.. autoclass:: exengine.kernel.data_storage_base.DataStorage
:members:
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
extensions = [
'sphinx_rtd_theme',
'sphinx_togglebutton',
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints', # for better type hint support
]


Expand Down
2 changes: 1 addition & 1 deletion docs/extending/add_devices.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _add_devices:

##############################
Adding Support for New Devices
Adding New Device Backends
##############################

We welcome contributions of new device backends to ExEngine! If you've developed a backend for a new device, framework, or system, please consider submitting a Pull Request.
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ Key Features:
design
usage
extending
apis
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sphinx
sphinx-autodoc-typehints
sphinx-rtd-theme
sphinx-togglebutton
sphinx_autodoc_typehints
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Usage

usage/installation
usage/backends
usage/key_concepts
usage/key_features
10 changes: 7 additions & 3 deletions docs/usage/backends.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
.. _backends:

================
Device Backends
Backends
================

This page contains a list of supported backends for ExEngine, as well as information and setup instructions for each


Device Backends
---------------


.. toctree::
:maxdepth: 1

backends/micro-manager_backend


================
Storage Backends
================
----------------

.. toctree::
:maxdepth: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
.. _NDTiff and RAM backend:
.. _ndstorage_backend:

##################################################################
NDTiff and RAM backend
##################################################################

`NDTiff <https://github.com/micro-manager/NDStorage>`_ is a high-performance indexed Tiff format used to save image data in Micro-Manager. NDRAM is a light-weight in-memory storage class. Both implementations provide the same API for in-memory (NDRAMStorage) or file-based (NDTiffStorage) storage.

`NDTiff <https://github.com/micro-manager/NDStorage>`_ is a high-performance, indexed Tiff format that can be written to local disk or network storage. It is one of the formats used in Micro-Manager. NDRAM is a simple in-memory storage. Both share the same API, enabling easy switching between file-based and in-memory storage.


To install this backend:

.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/devices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ By default, all ExEngine devices are made thread-safe.

This is done under the hood by intercepting and rerouting all device calls to common threads.

This can be turned off by setting the `no_executor` parameter to `True` when initializing a device:
This can be turned off by setting the ``no_executor`` parameter to ``True`` when initializing a device:

.. code-block:: python
Expand Down
2 changes: 0 additions & 2 deletions docs/usage/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
Installation and Setup
======================

Basic Installation
------------------
ExEngine was design to support multiple device and data storage backends, either independently or in combination. Each backend has some adapter code that lives within the Exengine package, and (optionally) other dependencies that need to be installed separately.

To install ExEngine with all available backend adapters, use pip:
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/key_concepts.rst → docs/usage/key_features.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _key concepts:
.. _key_features:

============
Key concepts
Key features
============

.. toctree::
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 @@ -109,27 +109,27 @@ def abort(self, await_completion: bool = False):
####################################################################################################################

def await_data(self, coordinates: Optional[Union[DataCoordinates, Dict[str, Union[int, str]],
DataCoordinatesIterator, Sequence[DataCoordinates],
Sequence[Dict[str, Union[int, str]]]]],
DataCoordinatesIterator, Sequence[DataCoordinates],
Sequence[Dict[str, Union[int, str]]]]],
return_data: bool = False, return_metadata: bool = False,
processed: bool = False, stored: bool = False):
"""
(Only for AcquisitionEvents that also inherit from DataProducing)
Block until the event's data is acquired/processed/saved, and optionally return the data/metadata.
when waiting for the data to be acquired (i.e. before it is processed), since there is no way to guarantee that
When waiting for the data to be acquired (i.e. before it is processed), since there is no way to guarantee that
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
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
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
"""

coordinates_iterator = DataCoordinatesIterator.create(coordinates)
Expand Down
6 changes: 3 additions & 3 deletions src/exengine/kernel/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def submit(self, event_or_events: Union[ExecutorEvent, Iterable[ExecutorEvent]],
- Priority execution can be requested using the 'prioritize' parameter.
Parameters:
----------
-----------
event_or_events : Union[ExecutorEvent, Iterable[ExecutorEvent]]
A single ExecutorEvent or an iterable of ExecutorEvents to be submitted.
Expand All @@ -212,14 +212,14 @@ def submit(self, event_or_events: Union[ExecutorEvent, Iterable[ExecutorEvent]],
Object to handle data and metadata produced by DataProducingExecutorEvents.
Returns:
-------
--------
Union[AcquisitionFuture, Iterable[AcquisitionFuture]]
For a single event: returns a single AcquisitionFuture.
For multiple events: returns an Iterable of AcquisitionFutures.
Note: The number of returned futures may differ from the input if transpilation occurs.
Notes:
-----
------
- Transpilation may optimize multiple events, potentially altering their number or structure.
- Use 'prioritize' for critical system changes that should occur before other queued events.
- 'use_free_thread' is essential for operations that need to run independently, like cancellation events.
Expand Down
1 change: 1 addition & 0 deletions src/exengine/kernel/notification_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Notification(ABC, Generic[TNotificationPayload]):
@dataclass
class DataAcquired(Notification[DataCoordinates]):
# Define the category and description of the notification shared by all instances of this class
category = NotificationCategory.Data
description = "Data has been acquired by a camera or other data-producing device and is now available"
Expand Down

0 comments on commit 8a75fd6

Please sign in to comment.