calibration¶
Calibration Module¶
The calibration module of this library keep a collection of models used to keep track of calibration metadata.
Every submodule has a single Calibration
class that is used to store the calibration metadata.
This class was written to be aligned to the Calibration class in aind-data-schemas as to provide an easy way to map calibration data.
Sub-classing Calibration
¶
Sub-classing 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:
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")
- aind_manipulator
- load_cells
- olfactometer
- water_valve
- treadmill