diff --git a/docs/api/devices/camera.md b/docs/api/devices/camera.md new file mode 100644 index 0000000..37547d0 --- /dev/null +++ b/docs/api/devices/camera.md @@ -0,0 +1,7 @@ +# camera + +```{eval-rst} +.. automodule:: miniscope_io.devices.camera + :members: + :undoc-members: +``` \ No newline at end of file diff --git a/docs/api/devices/index.md b/docs/api/devices/index.md new file mode 100644 index 0000000..5e68b09 --- /dev/null +++ b/docs/api/devices/index.md @@ -0,0 +1,11 @@ +# devices + +```{toctree} +camera +``` + +```{eval-rst} +.. automodule:: miniscope_io.devices.device + :members: + :undoc-members: +``` \ No newline at end of file diff --git a/docs/api/models/index.md b/docs/api/models/index.md index 718c20c..2dd8eda 100644 --- a/docs/api/models/index.md +++ b/docs/api/models/index.md @@ -8,14 +8,9 @@ module, inheriting from the relevant parent class. Rule of thumb: keep what is common common, and what is unique unique. - -```{eval-rst} -.. automodule:: miniscope_io.models - :members: - :undoc-members: -``` - ```{toctree} +:maxdepth: 1 + buffer config data diff --git a/docs/index.md b/docs/index.md index 6c70b3e..627cd11 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,6 +23,7 @@ reference/object_model :maxdepth: 1 :caption: API: +api/devices/index api/formats/index api/io api/logging diff --git a/docs/reference/object_model.md b/docs/reference/object_model.md index e5af039..6d7d77b 100644 --- a/docs/reference/object_model.md +++ b/docs/reference/object_model.md @@ -1,12 +1,49 @@ # Object Model -```{currentmodule} miniscope_io -``` - ## Devices -```{autoclasstree} miniscope_io.models.PipelineModel miniscope_io.models.Node miniscope_io.models.Source miniscope_io.models.Sink miniscope_io.models.ProcessingNode miniscope_io.models.Pipeline +A "{class}`.Device`" is the top-level class that one is expected to interact with when recording +data. + +It encapsulates a {class}`.Pipeline` object that parameterizes one of several +{class}`.Source` nodes (like the {class}`.okDev`, {class]`.SDCard`, etc.), +zero-to-several {class}`.ProcessingNode`s that transform the source ouput, +and then one or several {class}`.Sink` nodes for saving data, plotting, and so on. + +```{autoclasstree} miniscope_io.devices.Device miniscope_io.devices.Camera miniscope_io.devices.Miniscope +:namespace: miniscope_io ``` ## Pipeline +A {class}`.Pipeline` is the basic unit of data processing in miniscope-io. + +A {class}`.Pipeline` contains a set of {class}`.Node`s, which have three root types: + +- {class}`.Source` nodes have outputs but no inputs +- {class}`.Sink` nodes have inputs but no outputs +- {class}`.ProcessingNode`s have both inputs and outputs + +Nodes can be connected to any number of `input` or `output` nodes, +and it is the responsibility of the {class}`.Pipeline` class to orchestrate +their run: launching them in a threadqueue, passing data between them, etc. + +{class}`.Node`s should not directly call each other, and instead implement +their {meth}`.Node.process` method as a "pure"-ish[^pureish] function that takes +data as input and returns data as output without knowledge of the nodes +that are connected to it. + +```{autoclasstree} miniscope_io.models.PipelineModel miniscope_io.models.Node miniscope_io.models.Source miniscope_io.models.Sink miniscope_io.models.ProcessingNode miniscope_io.models.Pipeline +:namespace: miniscope_io +``` + +## Config + +```{todo} +Complete configuration documentation: +- Sources of config - user dir, prepackaged, etc. +- Types of config - device, session, etc. +``` + +[^pureish]: As in nodes can be stateful and use their instance attributes, + but should not rely on side-effects, implement their own queues, etc. \ No newline at end of file diff --git a/miniscope_io/devices/__init__.py b/miniscope_io/devices/__init__.py index fb6e493..4e602ba 100644 --- a/miniscope_io/devices/__init__.py +++ b/miniscope_io/devices/__init__.py @@ -1,3 +1,8 @@ """ Devices! """ + +from miniscope_io.devices.camera import Camera, Miniscope +from miniscope_io.devices.device import Device + +__all__ = ["Camera", "Device", "Miniscope"] diff --git a/miniscope_io/devices/cameras/camera.py b/miniscope_io/devices/camera.py similarity index 100% rename from miniscope_io/devices/cameras/camera.py rename to miniscope_io/devices/camera.py diff --git a/miniscope_io/devices/cameras/__init__.py b/miniscope_io/devices/cameras/__init__.py deleted file mode 100644 index a4ab349..0000000 --- a/miniscope_io/devices/cameras/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -""" -Camera classes :) -""" - -from miniscope_io.devices.device import Device - -__all__ = ["Device"]