Skip to content

Commit

Permalink
deploy: e68cf5e
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-f-cruz committed Jun 12, 2024
0 parents commit 0cea8eb
Show file tree
Hide file tree
Showing 106 changed files with 19,166 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: ffbcb2f1419685c2cae3d11f3e36c580
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/api.base.doctree
Binary file not shown.
Binary file added .doctrees/api.base/rig.doctree
Binary file not shown.
Binary file added .doctrees/api.base/session.doctree
Binary file not shown.
Binary file added .doctrees/api.base/task_logic.doctree
Binary file not shown.
Binary file added .doctrees/api.calibration.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/api.calibration/load_cells.doctree
Binary file not shown.
Binary file added .doctrees/api.calibration/olfactometer.doctree
Binary file not shown.
Binary file added .doctrees/api.calibration/water_valve.doctree
Binary file not shown.
Binary file added .doctrees/api.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/json-schemas.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file added .nojekyll
Empty file.
71 changes: 71 additions & 0 deletions _images/AindBehaviorSessionModel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions _sources/api.base.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Base
-------------

.. toctree::
:maxdepth: 2

api.base/session
api.base/rig
api.base/task_logic
7 changes: 7 additions & 0 deletions _sources/api.base/rig.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AindBehaviorRigModel
-------------------------

.. autopydantic_model:: aind_behavior_services.AindBehaviorRigModel
:members:
:undoc-members:
:show-inheritance:
10 changes: 10 additions & 0 deletions _sources/api.base/session.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
AindBehaviorSessionModel
--------------------------

.. image:: ../_static/AindBehaviorSessionModel.svg
:target: ../_static/AindBehaviorSessionModel.svg

.. autopydantic_model:: aind_behavior_services.session.AindBehaviorSessionModel
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions _sources/api.base/task_logic.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AindBehaviorTaskLogicModel
--------------------------------

.. autopydantic_model:: aind_behavior_services.AindBehaviorTaskLogicModel
:members:
:undoc-members:
:show-inheritance:
123 changes: 123 additions & 0 deletions _sources/api.calibration.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
Calibration
-------------

Calibration Module
####################

The calibration module of this library is used to generate the metadata necessary configure and run calibration workflows for different assets/devices.

The metadata follows the general logic of the library by implementing the three core classes:
- :py:class:`~aind_behavior_services.session.AindBehaviorSessionModel`
- :py:class:`~aind_behavior_services.rig.AindBehaviorRigModel`
- :py:class:`~aind_behavior_services.task_logic.AindBehaviorTaskLogicModel`

A fourth class :py:class:`~aind_behavior_services.calibration.Calibration`,
specific to the Calibration module, is also implemented to keep track of the calibration metrics.
This class was written to be aligned to the Calibration class in `aind-data-schemas
<https://github.com/AllenNeuralDynamics/aind-data-schema/blob/2fd0e403bf46f0f1a47e5922c4228517e68376a3/src/aind_data_schema/components/devices.py#L274>`_.
An application example will be provided below.

While we use the base :py:class:`~aind_behavior_services.session.AindBehaviorSessionModel` class to keep track of the session metadata,
both :py:class:`~aind_behavior_services.rig.AindBehaviorRigModel` and :py:class:`~aind_behavior_services.task_logic.AindBehaviorTaskLogicModel` are
expected to be sub-classed to specify the necessary dependencies of the calibration workflow.

Sub-classing :py:class:`~aind_behavior_services.calibration.Calibration`
##########################################################################

Sub-classing :py:class:`~aind_behavior_services.calibration.Calibration` boils down to providing a subtype of the `input` and `output` fields.
These fields are expected to be of a sub-type of `~pydantic.BaseModel` and define the structure of the calibration outcome.
Conceptually, `input` is the pre-process data that resulted from the calibration workflow (i.e. the weight of delivered water),
whereas `output` is used to represent a post-processed version of the calibration outcome (e.g. a linear model that relates valve-opening times to water volume).

An example of a sub-class of `Calibration` is provided below:

.. code-block:: python
from pydantic import BaseModel, Field
from typing import List, Literal
from aind_behavior_services.calibration import Calibration
class BarContainer(BaseModel):
baz: string = Field(..., description="Baz value")
bar: float = Field(..., description="Bar value")
class DeviceCalibrationInput(BaseModel):
measured_foo: List[int] = Field(..., description="Measurements of Foo")
bar_container: List[BarContainer] = Field(..., description="Bar container")
class DeviceCalibrationOutput(BaseModel):
param_a = float = Field(default=1, description="Parameter A")
param_b = float = Field(default=0, description="Parameter B")
class DeviceCalibration(Calibration):
device_name: Literal["MyDevice"] = "MyDevice"
description: Literal["Stores the calibration of a device"] = "Stores the calibration of a device"
input: DeviceCalibrationInput = Field(..., title="Input of the calibration")
output: DeviceCalibrationOutput = Field(..., title="Output of the calibration")
Sub-classing :py:class:`~aind_behavior_services.rig.AindBehaviorRigModel`
##########################################################################

We adopt the following pattern to sub-class the :py:class:`~aind_behavior_services.rig.AindBehaviorRigModel` class:

.. code-block:: python
from aind_behavior_services.rig import AindBehaviorRigModel, Device
RIG_VERSION = "1.0.0" # Use SemVer
class FooDevice(Device):
calibration: DeviceCalibration = Field(..., title="Calibration of the device foo")
class CalibrationRig(AindBehaviorRigModel):
version: Literal[RIG_VERSION] = RIG_VERSION
device_foo: FooDevice = Field(..., title="Device Foo")
device_bar: Device = Field(..., title="Device Bar")
For an example see :py:class:`aind_behavior_services.calibration.olfactometer.CalibrationRig`.



Sub-classing :py:class:`~aind_behavior_services.task_logic.AindBehaviorTaskLogicModel`
################################################################################

The same way a :py:class:`~aind_behavior_services.task_logic.AindBehaviorTaskLogicModel` is used to define
the settings to run a behavior task, it is also used to define the settings to run a calibration workflow.
It will thus fallow an identical sub-classing pattern:


.. code-block:: python
from aind_behavior_services.task_logic import AindBehaviorTaskLogicModel, TaskParameters
TASK_LOGIC_VERSION = "0.1.0"
class CalibrationParameters(TaskParameters):
n_iterations: int = Field(default=10, description="Number of iterations to run the calibration")
channels_to_calibrate: List[Literal[1,2,3]] = Field(default=[1], description="List of channels to calibrate")
class CalibrationLogic(AindBehaviorTaskLogicModel):
name: Literal["CalibrationLogic"] = "CalibrationLogic
version: Literal[TASK_LOGIC_VERSION] = TASK_LOGIC_VERSION
task_parameters: CalibrationParameters = Field(default=CalibrationParameters(), title="Task parameters", validate_default=True)
For an example see :py:class:`aind_behavior_services.calibration.olfactometer.CalibrationLogic`.



.. toctree::
:maxdepth: 4

api.calibration/aind_manipulator
api.calibration/load_cells
api.calibration/olfactometer
api.calibration/water_valve


13 changes: 13 additions & 0 deletions _sources/api.calibration/aind_manipulator.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
aind_manipulator
-----------------

.. automodule:: aind_behavior_services.calibration.aind_manipulator
:members:
:undoc-members:
:show-inheritance:

Example
##########

.. literalinclude:: ../../examples/aind_manipulator.py
:language: python
13 changes: 13 additions & 0 deletions _sources/api.calibration/load_cells.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load_cells
-------------

.. automodule:: aind_behavior_services.calibration.load_cells
:members:
:undoc-members:
:show-inheritance:

Example
########

.. literalinclude:: ../../examples/load_cells.py
:language: python
13 changes: 13 additions & 0 deletions _sources/api.calibration/olfactometer.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
olfactometer
-------------

.. automodule:: aind_behavior_services.calibration.olfactometer
:members:
:undoc-members:
:show-inheritance:

Example
########

.. literalinclude:: ../../examples/olfactometer.py
:language: python
13 changes: 13 additions & 0 deletions _sources/api.calibration/water_valve.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
water_valve
-------------

.. automodule:: aind_behavior_services.calibration.water_valve
:members:
:undoc-members:
:show-inheritance:

Example
########

.. literalinclude:: ../../examples/water_valve.py
:language: python
9 changes: 9 additions & 0 deletions _sources/api.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
API
-------------

.. toctree::
:maxdepth: 2

api.base
api.calibration

25 changes: 25 additions & 0 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. Aind.Behavior.Services documentation master file, created by
sphinx-quickstart on Thu Apr 25 11:48:33 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to AIND Behavior Services's documentation!
==================================================

.. include:: ../README.md
:parser: myst_parser.sphinx_

.. toctree::
:maxdepth: 4
:caption: Contents:

self
api
json-schemas
GitHub Source Code <https://github.com/AllenNeuralDynamics/Aind.Behavior.Services>

Indices and tables
==================

* :ref:`genindex`
* :ref:`search`
16 changes: 16 additions & 0 deletions _sources/json-schemas.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

JsonSchema
-------------
.. toctree::
:maxdepth: 4

json-schemas/aind_manipulator_calibration_rig
json-schemas/olfactometer_calibration_rig
json-schemas/load_cells_calibration_rig
json-schemas/water_valve_calibration_logic
json-schemas/water_valve_calibration_rig
json-schemas/aind_behavior_subject_database
json-schemas/aind_manipulator_calibration_logic
json-schemas/aind_behavior_session
json-schemas/olfactometer_calibration_logic
json-schemas/load_cells_calibration_logic
10 changes: 10 additions & 0 deletions _sources/json-schemas/aind_behavior_session.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

aind_behavior_session
----------------------------------------------------

`Download Schema <https://raw.githubusercontent.com/AllenNeuralDynamics/Aind.Behavior.Services/main/src/DataSchemas/schemas/aind_behavior_session.json>`_

.. jsonschema:: https://raw.githubusercontent.com/AllenNeuralDynamics/Aind.Behavior.Services/main/src/DataSchemas/schemas/aind_behavior_session.json
:lift_definitions:
:auto_reference:

10 changes: 10 additions & 0 deletions _sources/json-schemas/aind_behavior_subject_database.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

aind_behavior_subject_database
----------------------------------------------------

`Download Schema <https://raw.githubusercontent.com/AllenNeuralDynamics/Aind.Behavior.Services/main/src/DataSchemas/schemas/aind_behavior_subject_database.json>`_

.. jsonschema:: https://raw.githubusercontent.com/AllenNeuralDynamics/Aind.Behavior.Services/main/src/DataSchemas/schemas/aind_behavior_subject_database.json
:lift_definitions:
:auto_reference:

10 changes: 10 additions & 0 deletions _sources/json-schemas/aind_manipulator_calibration_logic.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

aind_manipulator_calibration_logic
----------------------------------------------------

`Download Schema <https://raw.githubusercontent.com/AllenNeuralDynamics/Aind.Behavior.Services/main/src/DataSchemas/schemas/aind_manipulator_calibration_logic.json>`_

.. jsonschema:: https://raw.githubusercontent.com/AllenNeuralDynamics/Aind.Behavior.Services/main/src/DataSchemas/schemas/aind_manipulator_calibration_logic.json
:lift_definitions:
:auto_reference:

Loading

0 comments on commit 0cea8eb

Please sign in to comment.