aind_behavior_services.calibration package

Submodules

aind_behavior_services.calibration.aind_manipulator module

pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorCalibration[source]

Bases: Calibration

Aind manipulator calibration class

Show JSON schema
{
   "title": "AindManipulatorCalibration",
   "description": "Aind manipulator calibration class",
   "type": "object",
   "properties": {
      "device_name": {
         "default": "AindManipulator",
         "description": "Must match a device name in rig/instrument",
         "title": "Device name",
         "type": "string"
      },
      "input": {
         "$ref": "#/$defs/AindManipulatorCalibrationInput",
         "title": "Input of the calibration"
      },
      "output": {
         "$ref": "#/$defs/AindManipulatorCalibrationOutput",
         "title": "Output of the calibration."
      },
      "date": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Date"
      },
      "description": {
         "const": "Calibration of the load cells system",
         "default": "Calibration of the load cells system",
         "title": "Description",
         "type": "string"
      },
      "notes": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Notes"
      }
   },
   "$defs": {
      "AindManipulatorCalibrationInput": {
         "properties": {
            "full_step_to_mm": {
               "$ref": "#/$defs/ManipulatorPosition",
               "default": {
                  "x": 0.01,
                  "y1": 0.01,
                  "y2": 0.01,
                  "z": 0.01
               },
               "title": "Full step to mm. Used to convert steps to SI Units"
            },
            "axis_configuration": {
               "default": [
                  {
                     "axis": 2,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 3,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 1,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 4,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  }
               ],
               "items": {
                  "$ref": "#/$defs/AxisConfiguration"
               },
               "title": "Axes configuration. Only the axes that are configured will be enabled.",
               "type": "array"
            },
            "homing_order": {
               "default": [
                  2,
                  3,
                  1,
                  4
               ],
               "items": {
                  "$ref": "#/$defs/Axis"
               },
               "title": "Homing order",
               "type": "array"
            },
            "initial_position": {
               "$ref": "#/$defs/ManipulatorPosition",
               "default": {
                  "x": 0.0,
                  "y1": 0.0,
                  "y2": 0.0,
                  "z": 0.0
               }
            }
         },
         "title": "AindManipulatorCalibrationInput",
         "type": "object"
      },
      "AindManipulatorCalibrationOutput": {
         "properties": {},
         "title": "AindManipulatorCalibrationOutput",
         "type": "object"
      },
      "Axis": {
         "description": "Motor axis available",
         "enum": [
            0,
            1,
            2,
            3,
            4
         ],
         "title": "Axis",
         "type": "integer"
      },
      "AxisConfiguration": {
         "description": "Axis configuration",
         "properties": {
            "axis": {
               "$ref": "#/$defs/Axis",
               "title": "Axis to be configured"
            },
            "step_acceleration_interval": {
               "default": 100,
               "description": "Acceleration of the step interval in microseconds",
               "maximum": 2000,
               "minimum": 2,
               "title": "Acceleration",
               "type": "integer"
            },
            "step_interval": {
               "default": 100,
               "description": "Step interval in microseconds.",
               "maximum": 20000,
               "minimum": 100,
               "title": "Step interval",
               "type": "integer"
            },
            "microstep_resolution": {
               "$ref": "#/$defs/MicrostepResolution",
               "default": 0,
               "title": "Microstep resolution"
            },
            "maximum_step_interval": {
               "default": 2000,
               "maximum": 20000,
               "minimum": 100,
               "title": "Configures the time between step motor pulses (us) used when starting or stopping a movement",
               "type": "integer"
            },
            "motor_operation_mode": {
               "$ref": "#/$defs/MotorOperationMode",
               "default": 0,
               "title": "Motor operation mode"
            },
            "max_limit": {
               "default": 25,
               "title": "Maximum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            },
            "min_limit": {
               "default": -0.01,
               "title": "Minimum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            }
         },
         "required": [
            "axis"
         ],
         "title": "AxisConfiguration",
         "type": "object"
      },
      "ManipulatorPosition": {
         "properties": {
            "x": {
               "title": "X coordinate",
               "type": "number"
            },
            "y1": {
               "title": "Y1 coordinate",
               "type": "number"
            },
            "y2": {
               "title": "Y2 coordinate",
               "type": "number"
            },
            "z": {
               "title": "Z coordinate",
               "type": "number"
            }
         },
         "required": [
            "x",
            "y1",
            "y2",
            "z"
         ],
         "title": "ManipulatorPosition",
         "type": "object"
      },
      "MicrostepResolution": {
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "MicrostepResolution",
         "type": "integer"
      },
      "MotorOperationMode": {
         "enum": [
            0,
            1
         ],
         "title": "MotorOperationMode",
         "type": "integer"
      }
   },
   "required": [
      "input",
      "output"
   ]
}

Fields:
field description: Literal['Calibration of the load cells system'] = 'Calibration of the load cells system'[source]
field device_name: str = 'AindManipulator'[source]

Must match a device name in rig/instrument

field input: AindManipulatorCalibrationInput [Required][source]
field output: AindManipulatorCalibrationOutput [Required][source]
pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorCalibrationInput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "AindManipulatorCalibrationInput",
   "type": "object",
   "properties": {
      "full_step_to_mm": {
         "$ref": "#/$defs/ManipulatorPosition",
         "default": {
            "x": 0.01,
            "y1": 0.01,
            "y2": 0.01,
            "z": 0.01
         },
         "title": "Full step to mm. Used to convert steps to SI Units"
      },
      "axis_configuration": {
         "default": [
            {
               "axis": 2,
               "step_acceleration_interval": 100,
               "step_interval": 100,
               "microstep_resolution": 0,
               "maximum_step_interval": 2000,
               "motor_operation_mode": 0,
               "max_limit": 25.0,
               "min_limit": -0.01
            },
            {
               "axis": 3,
               "step_acceleration_interval": 100,
               "step_interval": 100,
               "microstep_resolution": 0,
               "maximum_step_interval": 2000,
               "motor_operation_mode": 0,
               "max_limit": 25.0,
               "min_limit": -0.01
            },
            {
               "axis": 1,
               "step_acceleration_interval": 100,
               "step_interval": 100,
               "microstep_resolution": 0,
               "maximum_step_interval": 2000,
               "motor_operation_mode": 0,
               "max_limit": 25.0,
               "min_limit": -0.01
            },
            {
               "axis": 4,
               "step_acceleration_interval": 100,
               "step_interval": 100,
               "microstep_resolution": 0,
               "maximum_step_interval": 2000,
               "motor_operation_mode": 0,
               "max_limit": 25.0,
               "min_limit": -0.01
            }
         ],
         "items": {
            "$ref": "#/$defs/AxisConfiguration"
         },
         "title": "Axes configuration. Only the axes that are configured will be enabled.",
         "type": "array"
      },
      "homing_order": {
         "default": [
            2,
            3,
            1,
            4
         ],
         "items": {
            "$ref": "#/$defs/Axis"
         },
         "title": "Homing order",
         "type": "array"
      },
      "initial_position": {
         "$ref": "#/$defs/ManipulatorPosition",
         "default": {
            "x": 0.0,
            "y1": 0.0,
            "y2": 0.0,
            "z": 0.0
         }
      }
   },
   "$defs": {
      "Axis": {
         "description": "Motor axis available",
         "enum": [
            0,
            1,
            2,
            3,
            4
         ],
         "title": "Axis",
         "type": "integer"
      },
      "AxisConfiguration": {
         "description": "Axis configuration",
         "properties": {
            "axis": {
               "$ref": "#/$defs/Axis",
               "title": "Axis to be configured"
            },
            "step_acceleration_interval": {
               "default": 100,
               "description": "Acceleration of the step interval in microseconds",
               "maximum": 2000,
               "minimum": 2,
               "title": "Acceleration",
               "type": "integer"
            },
            "step_interval": {
               "default": 100,
               "description": "Step interval in microseconds.",
               "maximum": 20000,
               "minimum": 100,
               "title": "Step interval",
               "type": "integer"
            },
            "microstep_resolution": {
               "$ref": "#/$defs/MicrostepResolution",
               "default": 0,
               "title": "Microstep resolution"
            },
            "maximum_step_interval": {
               "default": 2000,
               "maximum": 20000,
               "minimum": 100,
               "title": "Configures the time between step motor pulses (us) used when starting or stopping a movement",
               "type": "integer"
            },
            "motor_operation_mode": {
               "$ref": "#/$defs/MotorOperationMode",
               "default": 0,
               "title": "Motor operation mode"
            },
            "max_limit": {
               "default": 25,
               "title": "Maximum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            },
            "min_limit": {
               "default": -0.01,
               "title": "Minimum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            }
         },
         "required": [
            "axis"
         ],
         "title": "AxisConfiguration",
         "type": "object"
      },
      "ManipulatorPosition": {
         "properties": {
            "x": {
               "title": "X coordinate",
               "type": "number"
            },
            "y1": {
               "title": "Y1 coordinate",
               "type": "number"
            },
            "y2": {
               "title": "Y2 coordinate",
               "type": "number"
            },
            "z": {
               "title": "Z coordinate",
               "type": "number"
            }
         },
         "required": [
            "x",
            "y1",
            "y2",
            "z"
         ],
         "title": "ManipulatorPosition",
         "type": "object"
      },
      "MicrostepResolution": {
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "MicrostepResolution",
         "type": "integer"
      },
      "MotorOperationMode": {
         "enum": [
            0,
            1
         ],
         "title": "MotorOperationMode",
         "type": "integer"
      }
   }
}

Fields:
field axis_configuration: List[AxisConfiguration] = [AxisConfiguration(axis=<Axis.Y1: 2>, step_acceleration_interval=100, step_interval=100, microstep_resolution=<MicrostepResolution.MICROSTEP8: 0>, maximum_step_interval=2000, motor_operation_mode=<MotorOperationMode.QUIET: 0>, max_limit=25, min_limit=-0.01), AxisConfiguration(axis=<Axis.Y2: 3>, step_acceleration_interval=100, step_interval=100, microstep_resolution=<MicrostepResolution.MICROSTEP8: 0>, maximum_step_interval=2000, motor_operation_mode=<MotorOperationMode.QUIET: 0>, max_limit=25, min_limit=-0.01), AxisConfiguration(axis=<Axis.X: 1>, step_acceleration_interval=100, step_interval=100, microstep_resolution=<MicrostepResolution.MICROSTEP8: 0>, maximum_step_interval=2000, motor_operation_mode=<MotorOperationMode.QUIET: 0>, max_limit=25, min_limit=-0.01), AxisConfiguration(axis=<Axis.Z: 4>, step_acceleration_interval=100, step_interval=100, microstep_resolution=<MicrostepResolution.MICROSTEP8: 0>, maximum_step_interval=2000, motor_operation_mode=<MotorOperationMode.QUIET: 0>, max_limit=25, min_limit=-0.01)][source]
field full_step_to_mm: ManipulatorPosition = ManipulatorPosition(x=0.01, y1=0.01, y2=0.01, z=0.01)[source]
field homing_order: List[Axis] = [Axis.Y1, Axis.Y2, Axis.X, Axis.Z][source]
field initial_position: ManipulatorPosition = ManipulatorPosition(x=0.0, y1=0.0, y2=0.0, z=0.0)[source]
pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorCalibrationOutput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "AindManipulatorCalibrationOutput",
   "type": "object",
   "properties": {}
}

pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorDevice[source]

Bases: HarpStepperDriver

Show JSON schema
{
   "title": "AindManipulatorDevice",
   "type": "object",
   "properties": {
      "device_type": {
         "const": "StepperDriver",
         "default": "StepperDriver",
         "title": "Device Type",
         "type": "string"
      },
      "device_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device name",
         "title": "Device Name"
      },
      "additional_settings": {
         "anyOf": [
            {
               "$ref": "#/$defs/BaseModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Additional settings"
      },
      "calibration": {
         "anyOf": [
            {
               "$ref": "#/$defs/AindManipulatorCalibration"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Calibration of the manipulator"
      },
      "who_am_i": {
         "const": 1130,
         "default": 1130,
         "title": "Who Am I",
         "type": "integer"
      },
      "serial_number": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device serial number",
         "title": "Serial Number"
      },
      "port_name": {
         "description": "Device port name",
         "title": "Port Name",
         "type": "string"
      }
   },
   "$defs": {
      "AindManipulatorCalibration": {
         "description": "Aind manipulator calibration class",
         "properties": {
            "device_name": {
               "default": "AindManipulator",
               "description": "Must match a device name in rig/instrument",
               "title": "Device name",
               "type": "string"
            },
            "input": {
               "$ref": "#/$defs/AindManipulatorCalibrationInput",
               "title": "Input of the calibration"
            },
            "output": {
               "$ref": "#/$defs/AindManipulatorCalibrationOutput",
               "title": "Output of the calibration."
            },
            "date": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Date"
            },
            "description": {
               "const": "Calibration of the load cells system",
               "default": "Calibration of the load cells system",
               "title": "Description",
               "type": "string"
            },
            "notes": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Notes"
            }
         },
         "required": [
            "input",
            "output"
         ],
         "title": "AindManipulatorCalibration",
         "type": "object"
      },
      "AindManipulatorCalibrationInput": {
         "properties": {
            "full_step_to_mm": {
               "$ref": "#/$defs/ManipulatorPosition",
               "default": {
                  "x": 0.01,
                  "y1": 0.01,
                  "y2": 0.01,
                  "z": 0.01
               },
               "title": "Full step to mm. Used to convert steps to SI Units"
            },
            "axis_configuration": {
               "default": [
                  {
                     "axis": 2,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 3,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 1,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 4,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  }
               ],
               "items": {
                  "$ref": "#/$defs/AxisConfiguration"
               },
               "title": "Axes configuration. Only the axes that are configured will be enabled.",
               "type": "array"
            },
            "homing_order": {
               "default": [
                  2,
                  3,
                  1,
                  4
               ],
               "items": {
                  "$ref": "#/$defs/Axis"
               },
               "title": "Homing order",
               "type": "array"
            },
            "initial_position": {
               "$ref": "#/$defs/ManipulatorPosition",
               "default": {
                  "x": 0.0,
                  "y1": 0.0,
                  "y2": 0.0,
                  "z": 0.0
               }
            }
         },
         "title": "AindManipulatorCalibrationInput",
         "type": "object"
      },
      "AindManipulatorCalibrationOutput": {
         "properties": {},
         "title": "AindManipulatorCalibrationOutput",
         "type": "object"
      },
      "Axis": {
         "description": "Motor axis available",
         "enum": [
            0,
            1,
            2,
            3,
            4
         ],
         "title": "Axis",
         "type": "integer"
      },
      "AxisConfiguration": {
         "description": "Axis configuration",
         "properties": {
            "axis": {
               "$ref": "#/$defs/Axis",
               "title": "Axis to be configured"
            },
            "step_acceleration_interval": {
               "default": 100,
               "description": "Acceleration of the step interval in microseconds",
               "maximum": 2000,
               "minimum": 2,
               "title": "Acceleration",
               "type": "integer"
            },
            "step_interval": {
               "default": 100,
               "description": "Step interval in microseconds.",
               "maximum": 20000,
               "minimum": 100,
               "title": "Step interval",
               "type": "integer"
            },
            "microstep_resolution": {
               "$ref": "#/$defs/MicrostepResolution",
               "default": 0,
               "title": "Microstep resolution"
            },
            "maximum_step_interval": {
               "default": 2000,
               "maximum": 20000,
               "minimum": 100,
               "title": "Configures the time between step motor pulses (us) used when starting or stopping a movement",
               "type": "integer"
            },
            "motor_operation_mode": {
               "$ref": "#/$defs/MotorOperationMode",
               "default": 0,
               "title": "Motor operation mode"
            },
            "max_limit": {
               "default": 25,
               "title": "Maximum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            },
            "min_limit": {
               "default": -0.01,
               "title": "Minimum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            }
         },
         "required": [
            "axis"
         ],
         "title": "AxisConfiguration",
         "type": "object"
      },
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "ManipulatorPosition": {
         "properties": {
            "x": {
               "title": "X coordinate",
               "type": "number"
            },
            "y1": {
               "title": "Y1 coordinate",
               "type": "number"
            },
            "y2": {
               "title": "Y2 coordinate",
               "type": "number"
            },
            "z": {
               "title": "Z coordinate",
               "type": "number"
            }
         },
         "required": [
            "x",
            "y1",
            "y2",
            "z"
         ],
         "title": "ManipulatorPosition",
         "type": "object"
      },
      "MicrostepResolution": {
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "MicrostepResolution",
         "type": "integer"
      },
      "MotorOperationMode": {
         "enum": [
            0,
            1
         ],
         "title": "MotorOperationMode",
         "type": "integer"
      }
   },
   "required": [
      "port_name"
   ]
}

Fields:
Validators:

field calibration: AindManipulatorCalibration | None = None[source]
Validated by:
  • _set_name

class aind_behavior_services.calibration.aind_manipulator.Axis(value)[source]

Bases: IntEnum

Motor axis available

NONE = 0[source]
X = 1[source]
Y1 = 2[source]
Y2 = 3[source]
Z = 4[source]
pydantic model aind_behavior_services.calibration.aind_manipulator.AxisConfiguration[source]

Bases: BaseModel

Axis configuration

Show JSON schema
{
   "title": "AxisConfiguration",
   "description": "Axis configuration",
   "type": "object",
   "properties": {
      "axis": {
         "$ref": "#/$defs/Axis",
         "title": "Axis to be configured"
      },
      "step_acceleration_interval": {
         "default": 100,
         "description": "Acceleration of the step interval in microseconds",
         "maximum": 2000,
         "minimum": 2,
         "title": "Acceleration",
         "type": "integer"
      },
      "step_interval": {
         "default": 100,
         "description": "Step interval in microseconds.",
         "maximum": 20000,
         "minimum": 100,
         "title": "Step interval",
         "type": "integer"
      },
      "microstep_resolution": {
         "$ref": "#/$defs/MicrostepResolution",
         "default": 0,
         "title": "Microstep resolution"
      },
      "maximum_step_interval": {
         "default": 2000,
         "maximum": 20000,
         "minimum": 100,
         "title": "Configures the time between step motor pulses (us) used when starting or stopping a movement",
         "type": "integer"
      },
      "motor_operation_mode": {
         "$ref": "#/$defs/MotorOperationMode",
         "default": 0,
         "title": "Motor operation mode"
      },
      "max_limit": {
         "default": 25,
         "title": "Maximum limit in SI units. A value of 0 disables this limit.",
         "type": "number"
      },
      "min_limit": {
         "default": -0.01,
         "title": "Minimum limit in SI units. A value of 0 disables this limit.",
         "type": "number"
      }
   },
   "$defs": {
      "Axis": {
         "description": "Motor axis available",
         "enum": [
            0,
            1,
            2,
            3,
            4
         ],
         "title": "Axis",
         "type": "integer"
      },
      "MicrostepResolution": {
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "MicrostepResolution",
         "type": "integer"
      },
      "MotorOperationMode": {
         "enum": [
            0,
            1
         ],
         "title": "MotorOperationMode",
         "type": "integer"
      }
   },
   "required": [
      "axis"
   ]
}

Fields:
field axis: Axis [Required][source]
field max_limit: float = 25[source]
field maximum_step_interval: int = 2000[source]
Constraints:
  • ge = 100

  • le = 20000

field microstep_resolution: MicrostepResolution = MicrostepResolution.MICROSTEP8[source]
field min_limit: float = -0.01[source]
field motor_operation_mode: MotorOperationMode = MotorOperationMode.QUIET[source]
field step_acceleration_interval: int = 100[source]

Acceleration of the step interval in microseconds

Constraints:
  • ge = 2

  • le = 2000

field step_interval: int = 100[source]

Step interval in microseconds.

Constraints:
  • ge = 100

  • le = 20000

pydantic model aind_behavior_services.calibration.aind_manipulator.CalibrationLogic[source]

Bases: AindBehaviorTaskLogicModel

Show JSON schema
{
   "title": "CalibrationLogic",
   "type": "object",
   "properties": {
      "name": {
         "default": "AindManipulatorCalibrationLogic",
         "title": "Task name",
         "type": "string"
      },
      "description": {
         "default": "",
         "description": "Description of the task.",
         "title": "Description",
         "type": "string"
      },
      "task_parameters": {
         "$ref": "#/$defs/CalibrationParameters",
         "title": "Task parameters"
      },
      "version": {
         "const": "0.2.0",
         "default": "0.2.0",
         "title": "Version",
         "type": "string"
      },
      "stage_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional stage name the `Task` object instance represents.",
         "title": "Stage Name"
      }
   },
   "$defs": {
      "CalibrationParameters": {
         "additionalProperties": true,
         "properties": {
            "rng_seed": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Seed of the random number generator",
               "title": "Rng Seed"
            },
            "aind_behavior_services_pkg_version": {
               "const": "0.11.0",
               "default": "0.11.0",
               "title": "aind_behavior_services package version",
               "type": "string"
            }
         },
         "title": "CalibrationParameters",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "task_parameters"
   ]
}

Config:
  • extra: str = forbid

  • validate_assignment: bool = True

  • validate_default: bool = True

  • strict: bool = True

  • str_strip_whitespace: bool = True

Fields:
Validators:
field name: str = 'AindManipulatorCalibrationLogic'[source]
field task_parameters: CalibrationParameters [Required][source]
field version: Literal['0.2.0'] = '0.2.0'[source]
Validated by:
pydantic model aind_behavior_services.calibration.aind_manipulator.CalibrationParameters[source]

Bases: TaskParameters

Show JSON schema
{
   "title": "CalibrationParameters",
   "type": "object",
   "properties": {
      "rng_seed": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Seed of the random number generator",
         "title": "Rng Seed"
      },
      "aind_behavior_services_pkg_version": {
         "const": "0.11.0",
         "default": "0.11.0",
         "title": "aind_behavior_services package version",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • extra: str = allow

  • validate_assignment: bool = True

  • validate_default: bool = True

  • strict: bool = True

  • str_strip_whitespace: bool = True

Fields:

Validators:

pydantic model aind_behavior_services.calibration.aind_manipulator.CalibrationRig[source]

Bases: AindBehaviorRigModel

Show JSON schema
{
   "title": "CalibrationRig",
   "type": "object",
   "properties": {
      "aind_behavior_services_pkg_version": {
         "const": "0.11.0",
         "default": "0.11.0",
         "title": "aind_behavior_services package version",
         "type": "string"
      },
      "version": {
         "const": "0.1.0",
         "default": "0.1.0",
         "title": "Version",
         "type": "string"
      },
      "computer_name": {
         "description": "Computer name",
         "title": "Computer Name",
         "type": "string"
      },
      "rig_name": {
         "description": "Rig name",
         "title": "Rig Name",
         "type": "string"
      },
      "manipulator": {
         "$ref": "#/$defs/AindManipulatorDevice",
         "default": null,
         "title": "Manipulator device"
      }
   },
   "$defs": {
      "AindManipulatorCalibration": {
         "description": "Aind manipulator calibration class",
         "properties": {
            "device_name": {
               "default": "AindManipulator",
               "description": "Must match a device name in rig/instrument",
               "title": "Device name",
               "type": "string"
            },
            "input": {
               "$ref": "#/$defs/AindManipulatorCalibrationInput",
               "title": "Input of the calibration"
            },
            "output": {
               "$ref": "#/$defs/AindManipulatorCalibrationOutput",
               "title": "Output of the calibration."
            },
            "date": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Date"
            },
            "description": {
               "const": "Calibration of the load cells system",
               "default": "Calibration of the load cells system",
               "title": "Description",
               "type": "string"
            },
            "notes": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Notes"
            }
         },
         "required": [
            "input",
            "output"
         ],
         "title": "AindManipulatorCalibration",
         "type": "object"
      },
      "AindManipulatorCalibrationInput": {
         "properties": {
            "full_step_to_mm": {
               "$ref": "#/$defs/ManipulatorPosition",
               "default": {
                  "x": 0.01,
                  "y1": 0.01,
                  "y2": 0.01,
                  "z": 0.01
               },
               "title": "Full step to mm. Used to convert steps to SI Units"
            },
            "axis_configuration": {
               "default": [
                  {
                     "axis": 2,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 3,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 1,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  },
                  {
                     "axis": 4,
                     "step_acceleration_interval": 100,
                     "step_interval": 100,
                     "microstep_resolution": 0,
                     "maximum_step_interval": 2000,
                     "motor_operation_mode": 0,
                     "max_limit": 25.0,
                     "min_limit": -0.01
                  }
               ],
               "items": {
                  "$ref": "#/$defs/AxisConfiguration"
               },
               "title": "Axes configuration. Only the axes that are configured will be enabled.",
               "type": "array"
            },
            "homing_order": {
               "default": [
                  2,
                  3,
                  1,
                  4
               ],
               "items": {
                  "$ref": "#/$defs/Axis"
               },
               "title": "Homing order",
               "type": "array"
            },
            "initial_position": {
               "$ref": "#/$defs/ManipulatorPosition",
               "default": {
                  "x": 0.0,
                  "y1": 0.0,
                  "y2": 0.0,
                  "z": 0.0
               }
            }
         },
         "title": "AindManipulatorCalibrationInput",
         "type": "object"
      },
      "AindManipulatorCalibrationOutput": {
         "properties": {},
         "title": "AindManipulatorCalibrationOutput",
         "type": "object"
      },
      "AindManipulatorDevice": {
         "properties": {
            "device_type": {
               "const": "StepperDriver",
               "default": "StepperDriver",
               "title": "Device Type",
               "type": "string"
            },
            "device_name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Device name",
               "title": "Device Name"
            },
            "additional_settings": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BaseModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Additional settings"
            },
            "calibration": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/AindManipulatorCalibration"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Calibration of the manipulator"
            },
            "who_am_i": {
               "const": 1130,
               "default": 1130,
               "title": "Who Am I",
               "type": "integer"
            },
            "serial_number": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Device serial number",
               "title": "Serial Number"
            },
            "port_name": {
               "description": "Device port name",
               "title": "Port Name",
               "type": "string"
            }
         },
         "required": [
            "port_name"
         ],
         "title": "AindManipulatorDevice",
         "type": "object"
      },
      "Axis": {
         "description": "Motor axis available",
         "enum": [
            0,
            1,
            2,
            3,
            4
         ],
         "title": "Axis",
         "type": "integer"
      },
      "AxisConfiguration": {
         "description": "Axis configuration",
         "properties": {
            "axis": {
               "$ref": "#/$defs/Axis",
               "title": "Axis to be configured"
            },
            "step_acceleration_interval": {
               "default": 100,
               "description": "Acceleration of the step interval in microseconds",
               "maximum": 2000,
               "minimum": 2,
               "title": "Acceleration",
               "type": "integer"
            },
            "step_interval": {
               "default": 100,
               "description": "Step interval in microseconds.",
               "maximum": 20000,
               "minimum": 100,
               "title": "Step interval",
               "type": "integer"
            },
            "microstep_resolution": {
               "$ref": "#/$defs/MicrostepResolution",
               "default": 0,
               "title": "Microstep resolution"
            },
            "maximum_step_interval": {
               "default": 2000,
               "maximum": 20000,
               "minimum": 100,
               "title": "Configures the time between step motor pulses (us) used when starting or stopping a movement",
               "type": "integer"
            },
            "motor_operation_mode": {
               "$ref": "#/$defs/MotorOperationMode",
               "default": 0,
               "title": "Motor operation mode"
            },
            "max_limit": {
               "default": 25,
               "title": "Maximum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            },
            "min_limit": {
               "default": -0.01,
               "title": "Minimum limit in SI units. A value of 0 disables this limit.",
               "type": "number"
            }
         },
         "required": [
            "axis"
         ],
         "title": "AxisConfiguration",
         "type": "object"
      },
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "ManipulatorPosition": {
         "properties": {
            "x": {
               "title": "X coordinate",
               "type": "number"
            },
            "y1": {
               "title": "Y1 coordinate",
               "type": "number"
            },
            "y2": {
               "title": "Y2 coordinate",
               "type": "number"
            },
            "z": {
               "title": "Z coordinate",
               "type": "number"
            }
         },
         "required": [
            "x",
            "y1",
            "y2",
            "z"
         ],
         "title": "ManipulatorPosition",
         "type": "object"
      },
      "MicrostepResolution": {
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "MicrostepResolution",
         "type": "integer"
      },
      "MotorOperationMode": {
         "enum": [
            0,
            1
         ],
         "title": "MotorOperationMode",
         "type": "integer"
      }
   },
   "required": [
      "rig_name"
   ]
}

Fields:
Validators:
field manipulator: AindManipulatorDevice = None[source]
field version: Literal['0.1.0'] = '0.1.0'[source]
Validated by:
pydantic model aind_behavior_services.calibration.aind_manipulator.ManipulatorPosition[source]

Bases: BaseModel

Show JSON schema
{
   "title": "ManipulatorPosition",
   "type": "object",
   "properties": {
      "x": {
         "title": "X coordinate",
         "type": "number"
      },
      "y1": {
         "title": "Y1 coordinate",
         "type": "number"
      },
      "y2": {
         "title": "Y2 coordinate",
         "type": "number"
      },
      "z": {
         "title": "Z coordinate",
         "type": "number"
      }
   },
   "required": [
      "x",
      "y1",
      "y2",
      "z"
   ]
}

Fields:
field x: float [Required][source]
field y1: float [Required][source]
field y2: float [Required][source]
field z: float [Required][source]
class aind_behavior_services.calibration.aind_manipulator.MicrostepResolution(value)[source]

Bases: IntEnum

MICROSTEP16 = 1[source]
MICROSTEP32 = 2[source]
MICROSTEP64 = 3[source]
MICROSTEP8 = 0[source]
class aind_behavior_services.calibration.aind_manipulator.MotorOperationMode(value)[source]

Bases: IntEnum

DYNAMIC = 1[source]
QUIET = 0[source]

aind_behavior_services.calibration.load_cells module

pydantic model aind_behavior_services.calibration.load_cells.LoadCellCalibrationInput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "LoadCellCalibrationInput",
   "type": "object",
   "properties": {
      "channel": {
         "description": "Load cell channel number available",
         "maximum": 7,
         "minimum": 0,
         "title": "Load cell channel number",
         "type": "integer"
      },
      "offset_measurement": {
         "default": [],
         "items": {
            "$ref": "#/$defs/MeasuredOffset"
         },
         "title": "Load cell offset calibration data",
         "type": "array"
      },
      "weight_measurement": {
         "default": [],
         "items": {
            "$ref": "#/$defs/MeasuredWeight"
         },
         "title": "Load cell weight calibration data",
         "type": "array"
      }
   },
   "$defs": {
      "MeasuredOffset": {
         "properties": {
            "offset": {
               "description": "The applied offset resistor value[-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Offset",
               "type": "integer"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "offset",
            "baseline"
         ],
         "title": "MeasuredOffset",
         "type": "object"
      },
      "MeasuredWeight": {
         "properties": {
            "weight": {
               "description": "The applied weight in grams",
               "title": "Weight",
               "type": "number"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "weight",
            "baseline"
         ],
         "title": "MeasuredWeight",
         "type": "object"
      }
   },
   "required": [
      "channel"
   ]
}

Fields:
field channel: LoadCellChannel [Required][source]

Load cell channel number available

Constraints:
  • ge = 0

  • le = 7

field offset_measurement: List[MeasuredOffset] = [][source]
field weight_measurement: List[MeasuredWeight] = [][source]
pydantic model aind_behavior_services.calibration.load_cells.LoadCellCalibrationOutput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "LoadCellCalibrationOutput",
   "type": "object",
   "properties": {
      "channel": {
         "description": "Load cell channel number available",
         "maximum": 7,
         "minimum": 0,
         "title": "Channel",
         "type": "integer"
      },
      "offset": {
         "default": 0,
         "description": "Load cell offset value [-255, 255]",
         "maximum": 255,
         "minimum": -255,
         "title": "Load cell offset applied to the wheatstone bridge circuit",
         "type": "integer"
      },
      "baseline": {
         "default": 0.0,
         "title": "Load cell baseline that will be DSP subtracted to the raw adc output.",
         "type": "number"
      },
      "slope": {
         "default": 1.0,
         "title": "Load cell slope that will be used to convert tared (- baseline) adc units to weight (g).",
         "type": "number"
      },
      "weight_lookup": {
         "default": [],
         "items": {
            "$ref": "#/$defs/MeasuredWeight"
         },
         "title": "Load cell weight lookup calibration table",
         "type": "array"
      }
   },
   "$defs": {
      "MeasuredWeight": {
         "properties": {
            "weight": {
               "description": "The applied weight in grams",
               "title": "Weight",
               "type": "number"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "weight",
            "baseline"
         ],
         "title": "MeasuredWeight",
         "type": "object"
      }
   },
   "required": [
      "channel"
   ]
}

Fields:
field baseline: float = 0.0[source]
field channel: LoadCellChannel [Required][source]

Load cell channel number available

Constraints:
  • ge = 0

  • le = 7

field offset: LoadCellOffset = 0[source]

Load cell offset value [-255, 255]

Constraints:
  • ge = -255

  • le = 255

field slope: float = 1.0[source]
field weight_lookup: List[MeasuredWeight] = [][source]
pydantic model aind_behavior_services.calibration.load_cells.LoadCells[source]

Bases: HarpLoadCells

Show JSON schema
{
   "title": "LoadCells",
   "type": "object",
   "properties": {
      "device_type": {
         "const": "LoadCells",
         "default": "LoadCells",
         "title": "Device Type",
         "type": "string"
      },
      "device_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device name",
         "title": "Device Name"
      },
      "additional_settings": {
         "anyOf": [
            {
               "$ref": "#/$defs/BaseModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Additional settings"
      },
      "calibration": {
         "anyOf": [
            {
               "$ref": "#/$defs/LoadCellsCalibration"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Calibration of the load cells"
      },
      "who_am_i": {
         "const": 1232,
         "default": 1232,
         "title": "Who Am I",
         "type": "integer"
      },
      "serial_number": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device serial number",
         "title": "Serial Number"
      },
      "port_name": {
         "description": "Device port name",
         "title": "Port Name",
         "type": "string"
      }
   },
   "$defs": {
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "LoadCellCalibrationInput": {
         "properties": {
            "channel": {
               "description": "Load cell channel number available",
               "maximum": 7,
               "minimum": 0,
               "title": "Load cell channel number",
               "type": "integer"
            },
            "offset_measurement": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredOffset"
               },
               "title": "Load cell offset calibration data",
               "type": "array"
            },
            "weight_measurement": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredWeight"
               },
               "title": "Load cell weight calibration data",
               "type": "array"
            }
         },
         "required": [
            "channel"
         ],
         "title": "LoadCellCalibrationInput",
         "type": "object"
      },
      "LoadCellCalibrationOutput": {
         "properties": {
            "channel": {
               "description": "Load cell channel number available",
               "maximum": 7,
               "minimum": 0,
               "title": "Channel",
               "type": "integer"
            },
            "offset": {
               "default": 0,
               "description": "Load cell offset value [-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Load cell offset applied to the wheatstone bridge circuit",
               "type": "integer"
            },
            "baseline": {
               "default": 0.0,
               "title": "Load cell baseline that will be DSP subtracted to the raw adc output.",
               "type": "number"
            },
            "slope": {
               "default": 1.0,
               "title": "Load cell slope that will be used to convert tared (- baseline) adc units to weight (g).",
               "type": "number"
            },
            "weight_lookup": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredWeight"
               },
               "title": "Load cell weight lookup calibration table",
               "type": "array"
            }
         },
         "required": [
            "channel"
         ],
         "title": "LoadCellCalibrationOutput",
         "type": "object"
      },
      "LoadCellsCalibration": {
         "description": "Load cells calibration class",
         "properties": {
            "device_name": {
               "default": "LoadCells",
               "description": "Must match a device name in rig/instrument",
               "title": "Device name",
               "type": "string"
            },
            "input": {
               "$ref": "#/$defs/LoadCellsCalibrationInput",
               "title": "Input of the calibration"
            },
            "output": {
               "$ref": "#/$defs/LoadCellsCalibrationOutput",
               "title": "Output of the calibration."
            },
            "date": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Date"
            },
            "description": {
               "const": "Calibration of the load cells system",
               "default": "Calibration of the load cells system",
               "title": "Description",
               "type": "string"
            },
            "notes": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Notes"
            }
         },
         "required": [
            "input",
            "output"
         ],
         "title": "LoadCellsCalibration",
         "type": "object"
      },
      "LoadCellsCalibrationInput": {
         "properties": {
            "channels": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/LoadCellCalibrationInput"
               },
               "title": "Load cells calibration data",
               "type": "array"
            }
         },
         "title": "LoadCellsCalibrationInput",
         "type": "object"
      },
      "LoadCellsCalibrationOutput": {
         "properties": {
            "channels": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/LoadCellCalibrationOutput"
               },
               "title": "Load cells calibration output",
               "type": "array"
            }
         },
         "title": "LoadCellsCalibrationOutput",
         "type": "object"
      },
      "MeasuredOffset": {
         "properties": {
            "offset": {
               "description": "The applied offset resistor value[-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Offset",
               "type": "integer"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "offset",
            "baseline"
         ],
         "title": "MeasuredOffset",
         "type": "object"
      },
      "MeasuredWeight": {
         "properties": {
            "weight": {
               "description": "The applied weight in grams",
               "title": "Weight",
               "type": "number"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "weight",
            "baseline"
         ],
         "title": "MeasuredWeight",
         "type": "object"
      }
   },
   "required": [
      "port_name"
   ]
}

Fields:
Validators:

field calibration: LoadCellsCalibration | None = None[source]
Validated by:
  • _set_name

pydantic model aind_behavior_services.calibration.load_cells.LoadCellsCalibration[source]

Bases: Calibration

Load cells calibration class

Show JSON schema
{
   "title": "LoadCellsCalibration",
   "description": "Load cells calibration class",
   "type": "object",
   "properties": {
      "device_name": {
         "default": "LoadCells",
         "description": "Must match a device name in rig/instrument",
         "title": "Device name",
         "type": "string"
      },
      "input": {
         "$ref": "#/$defs/LoadCellsCalibrationInput",
         "title": "Input of the calibration"
      },
      "output": {
         "$ref": "#/$defs/LoadCellsCalibrationOutput",
         "title": "Output of the calibration."
      },
      "date": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Date"
      },
      "description": {
         "const": "Calibration of the load cells system",
         "default": "Calibration of the load cells system",
         "title": "Description",
         "type": "string"
      },
      "notes": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Notes"
      }
   },
   "$defs": {
      "LoadCellCalibrationInput": {
         "properties": {
            "channel": {
               "description": "Load cell channel number available",
               "maximum": 7,
               "minimum": 0,
               "title": "Load cell channel number",
               "type": "integer"
            },
            "offset_measurement": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredOffset"
               },
               "title": "Load cell offset calibration data",
               "type": "array"
            },
            "weight_measurement": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredWeight"
               },
               "title": "Load cell weight calibration data",
               "type": "array"
            }
         },
         "required": [
            "channel"
         ],
         "title": "LoadCellCalibrationInput",
         "type": "object"
      },
      "LoadCellCalibrationOutput": {
         "properties": {
            "channel": {
               "description": "Load cell channel number available",
               "maximum": 7,
               "minimum": 0,
               "title": "Channel",
               "type": "integer"
            },
            "offset": {
               "default": 0,
               "description": "Load cell offset value [-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Load cell offset applied to the wheatstone bridge circuit",
               "type": "integer"
            },
            "baseline": {
               "default": 0.0,
               "title": "Load cell baseline that will be DSP subtracted to the raw adc output.",
               "type": "number"
            },
            "slope": {
               "default": 1.0,
               "title": "Load cell slope that will be used to convert tared (- baseline) adc units to weight (g).",
               "type": "number"
            },
            "weight_lookup": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredWeight"
               },
               "title": "Load cell weight lookup calibration table",
               "type": "array"
            }
         },
         "required": [
            "channel"
         ],
         "title": "LoadCellCalibrationOutput",
         "type": "object"
      },
      "LoadCellsCalibrationInput": {
         "properties": {
            "channels": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/LoadCellCalibrationInput"
               },
               "title": "Load cells calibration data",
               "type": "array"
            }
         },
         "title": "LoadCellsCalibrationInput",
         "type": "object"
      },
      "LoadCellsCalibrationOutput": {
         "properties": {
            "channels": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/LoadCellCalibrationOutput"
               },
               "title": "Load cells calibration output",
               "type": "array"
            }
         },
         "title": "LoadCellsCalibrationOutput",
         "type": "object"
      },
      "MeasuredOffset": {
         "properties": {
            "offset": {
               "description": "The applied offset resistor value[-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Offset",
               "type": "integer"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "offset",
            "baseline"
         ],
         "title": "MeasuredOffset",
         "type": "object"
      },
      "MeasuredWeight": {
         "properties": {
            "weight": {
               "description": "The applied weight in grams",
               "title": "Weight",
               "type": "number"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "weight",
            "baseline"
         ],
         "title": "MeasuredWeight",
         "type": "object"
      }
   },
   "required": [
      "input",
      "output"
   ]
}

Fields:
field description: Literal['Calibration of the load cells system'] = 'Calibration of the load cells system'[source]
field device_name: str = 'LoadCells'[source]

Must match a device name in rig/instrument

field input: LoadCellsCalibrationInput [Required][source]
field output: LoadCellsCalibrationOutput [Required][source]
pydantic model aind_behavior_services.calibration.load_cells.LoadCellsCalibrationInput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "LoadCellsCalibrationInput",
   "type": "object",
   "properties": {
      "channels": {
         "default": [],
         "items": {
            "$ref": "#/$defs/LoadCellCalibrationInput"
         },
         "title": "Load cells calibration data",
         "type": "array"
      }
   },
   "$defs": {
      "LoadCellCalibrationInput": {
         "properties": {
            "channel": {
               "description": "Load cell channel number available",
               "maximum": 7,
               "minimum": 0,
               "title": "Load cell channel number",
               "type": "integer"
            },
            "offset_measurement": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredOffset"
               },
               "title": "Load cell offset calibration data",
               "type": "array"
            },
            "weight_measurement": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredWeight"
               },
               "title": "Load cell weight calibration data",
               "type": "array"
            }
         },
         "required": [
            "channel"
         ],
         "title": "LoadCellCalibrationInput",
         "type": "object"
      },
      "MeasuredOffset": {
         "properties": {
            "offset": {
               "description": "The applied offset resistor value[-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Offset",
               "type": "integer"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "offset",
            "baseline"
         ],
         "title": "MeasuredOffset",
         "type": "object"
      },
      "MeasuredWeight": {
         "properties": {
            "weight": {
               "description": "The applied weight in grams",
               "title": "Weight",
               "type": "number"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "weight",
            "baseline"
         ],
         "title": "MeasuredWeight",
         "type": "object"
      }
   }
}

Fields:
Validators:
field channels: List[LoadCellCalibrationInput] = [][source]
Validated by:
classmethod calibrate_loadcell_output(value)[source]
Parameters:

value (LoadCellCalibrationInput)

Return type:

LoadCellCalibrationOutput

validator ensure_unique_channels  »  channels[source]
Parameters:

values (List[LoadCellCalibrationInput])

Return type:

List[LoadCellCalibrationInput]

static get_optimum_offset(value)[source]
Parameters:

value (List[MeasuredOffset] | None)

Return type:

Annotated[int, FieldInfo(annotation=NoneType, required=True, description=’Load cell offset value [-255, 255]’, metadata=[Ge(ge=-255), Le(le=255)])] | None

calibrate_output()[source]
Return type:

LoadCellsCalibrationOutput

pydantic model aind_behavior_services.calibration.load_cells.LoadCellsCalibrationOutput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "LoadCellsCalibrationOutput",
   "type": "object",
   "properties": {
      "channels": {
         "default": [],
         "items": {
            "$ref": "#/$defs/LoadCellCalibrationOutput"
         },
         "title": "Load cells calibration output",
         "type": "array"
      }
   },
   "$defs": {
      "LoadCellCalibrationOutput": {
         "properties": {
            "channel": {
               "description": "Load cell channel number available",
               "maximum": 7,
               "minimum": 0,
               "title": "Channel",
               "type": "integer"
            },
            "offset": {
               "default": 0,
               "description": "Load cell offset value [-255, 255]",
               "maximum": 255,
               "minimum": -255,
               "title": "Load cell offset applied to the wheatstone bridge circuit",
               "type": "integer"
            },
            "baseline": {
               "default": 0.0,
               "title": "Load cell baseline that will be DSP subtracted to the raw adc output.",
               "type": "number"
            },
            "slope": {
               "default": 1.0,
               "title": "Load cell slope that will be used to convert tared (- baseline) adc units to weight (g).",
               "type": "number"
            },
            "weight_lookup": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/MeasuredWeight"
               },
               "title": "Load cell weight lookup calibration table",
               "type": "array"
            }
         },
         "required": [
            "channel"
         ],
         "title": "LoadCellCalibrationOutput",
         "type": "object"
      },
      "MeasuredWeight": {
         "properties": {
            "weight": {
               "description": "The applied weight in grams",
               "title": "Weight",
               "type": "number"
            },
            "baseline": {
               "description": "The measured baseline value",
               "title": "Baseline",
               "type": "number"
            }
         },
         "required": [
            "weight",
            "baseline"
         ],
         "title": "MeasuredWeight",
         "type": "object"
      }
   }
}

Fields:
Validators:
field channels: List[LoadCellCalibrationOutput] = [][source]
Validated by:
validator ensure_unique_channels  »  channels[source]
Parameters:

values (List[LoadCellCalibrationOutput])

Return type:

List[LoadCellCalibrationOutput]

pydantic model aind_behavior_services.calibration.load_cells.MeasuredOffset[source]

Bases: BaseModel

Show JSON schema
{
   "title": "MeasuredOffset",
   "type": "object",
   "properties": {
      "offset": {
         "description": "The applied offset resistor value[-255, 255]",
         "maximum": 255,
         "minimum": -255,
         "title": "Offset",
         "type": "integer"
      },
      "baseline": {
         "description": "The measured baseline value",
         "title": "Baseline",
         "type": "number"
      }
   },
   "required": [
      "offset",
      "baseline"
   ]
}

Fields:
field baseline: float [Required][source]

The measured baseline value

field offset: LoadCellOffset [Required][source]

The applied offset resistor value[-255, 255]

Constraints:
  • ge = -255

  • le = 255

pydantic model aind_behavior_services.calibration.load_cells.MeasuredWeight[source]

Bases: BaseModel

Show JSON schema
{
   "title": "MeasuredWeight",
   "type": "object",
   "properties": {
      "weight": {
         "description": "The applied weight in grams",
         "title": "Weight",
         "type": "number"
      },
      "baseline": {
         "description": "The measured baseline value",
         "title": "Baseline",
         "type": "number"
      }
   },
   "required": [
      "weight",
      "baseline"
   ]
}

Fields:
field baseline: float [Required][source]

The measured baseline value

field weight: float [Required][source]

The applied weight in grams

aind_behavior_services.calibration.olfactometer module

pydantic model aind_behavior_services.calibration.olfactometer.Olfactometer[source]

Bases: HarpOlfactometer

Show JSON schema
{
   "title": "Olfactometer",
   "type": "object",
   "properties": {
      "device_type": {
         "const": "Olfactometer",
         "default": "Olfactometer",
         "title": "Device Type",
         "type": "string"
      },
      "device_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device name",
         "title": "Device Name"
      },
      "additional_settings": {
         "anyOf": [
            {
               "$ref": "#/$defs/BaseModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Additional settings"
      },
      "calibration": {
         "anyOf": [
            {
               "$ref": "#/$defs/OlfactometerCalibration"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Calibration of the olfactometer"
      },
      "who_am_i": {
         "const": 1140,
         "default": 1140,
         "title": "Who Am I",
         "type": "integer"
      },
      "serial_number": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device serial number",
         "title": "Serial Number"
      },
      "port_name": {
         "description": "Device port name",
         "title": "Port Name",
         "type": "string"
      }
   },
   "$defs": {
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "OlfactometerCalibration": {
         "description": "Olfactometer calibration class",
         "properties": {
            "device_name": {
               "default": "Olfactometer",
               "description": "Name of the device being calibrated",
               "title": "Device name",
               "type": "string"
            },
            "input": {
               "$ref": "#/$defs/OlfactometerCalibrationInput",
               "title": "Input of the calibration"
            },
            "output": {
               "$ref": "#/$defs/OlfactometerCalibrationOutput",
               "title": "Output of the calibration"
            },
            "date": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Date"
            },
            "description": {
               "const": "Calibration of the harp olfactometer device",
               "default": "Calibration of the harp olfactometer device",
               "title": "Description",
               "type": "string"
            },
            "notes": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Notes"
            }
         },
         "required": [
            "input",
            "output"
         ],
         "title": "OlfactometerCalibration",
         "type": "object"
      },
      "OlfactometerCalibrationInput": {
         "properties": {
            "channel_config": {
               "additionalProperties": {
                  "$ref": "#/$defs/OlfactometerChannelConfig"
               },
               "default": {},
               "description": "Configuration of olfactometer channels",
               "propertyNames": {
                  "$ref": "#/$defs/OlfactometerChannel"
               },
               "title": "Channel Config",
               "type": "object"
            }
         },
         "title": "OlfactometerCalibrationInput",
         "type": "object"
      },
      "OlfactometerCalibrationOutput": {
         "properties": {},
         "title": "OlfactometerCalibrationOutput",
         "type": "object"
      },
      "OlfactometerChannel": {
         "description": "Harp Olfactometer available channel",
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "OlfactometerChannel",
         "type": "integer"
      },
      "OlfactometerChannelConfig": {
         "properties": {
            "channel_index": {
               "title": "Channel index",
               "type": "integer"
            },
            "channel_type": {
               "$ref": "#/$defs/OlfactometerChannelType",
               "default": "Odor",
               "title": "Channel type"
            },
            "flow_rate_capacity": {
               "default": 100,
               "enum": [
                  100,
                  1000
               ],
               "title": "Flow capacity. mL/min",
               "type": "integer"
            },
            "flow_rate": {
               "default": 100,
               "maximum": 100,
               "title": "Target flow rate. mL/min. If channel_type == CARRIER, this value is ignored.",
               "type": "number"
            },
            "odorant": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Odorant name"
            },
            "odorant_dilution": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Odorant dilution (%v/v)"
            }
         },
         "required": [
            "channel_index"
         ],
         "title": "OlfactometerChannelConfig",
         "type": "object"
      },
      "OlfactometerChannelType": {
         "description": "Channel type",
         "enum": [
            "Odor",
            "Carrier"
         ],
         "title": "OlfactometerChannelType",
         "type": "string"
      }
   },
   "required": [
      "port_name"
   ]
}

Fields:
Validators:

field calibration: OlfactometerCalibration | None = None[source]
Validated by:
  • _set_name

pydantic model aind_behavior_services.calibration.olfactometer.OlfactometerCalibration[source]

Bases: Calibration

Olfactometer calibration class

Show JSON schema
{
   "title": "OlfactometerCalibration",
   "description": "Olfactometer calibration class",
   "type": "object",
   "properties": {
      "device_name": {
         "default": "Olfactometer",
         "description": "Name of the device being calibrated",
         "title": "Device name",
         "type": "string"
      },
      "input": {
         "$ref": "#/$defs/OlfactometerCalibrationInput",
         "title": "Input of the calibration"
      },
      "output": {
         "$ref": "#/$defs/OlfactometerCalibrationOutput",
         "title": "Output of the calibration"
      },
      "date": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Date"
      },
      "description": {
         "const": "Calibration of the harp olfactometer device",
         "default": "Calibration of the harp olfactometer device",
         "title": "Description",
         "type": "string"
      },
      "notes": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Notes"
      }
   },
   "$defs": {
      "OlfactometerCalibrationInput": {
         "properties": {
            "channel_config": {
               "additionalProperties": {
                  "$ref": "#/$defs/OlfactometerChannelConfig"
               },
               "default": {},
               "description": "Configuration of olfactometer channels",
               "propertyNames": {
                  "$ref": "#/$defs/OlfactometerChannel"
               },
               "title": "Channel Config",
               "type": "object"
            }
         },
         "title": "OlfactometerCalibrationInput",
         "type": "object"
      },
      "OlfactometerCalibrationOutput": {
         "properties": {},
         "title": "OlfactometerCalibrationOutput",
         "type": "object"
      },
      "OlfactometerChannel": {
         "description": "Harp Olfactometer available channel",
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "OlfactometerChannel",
         "type": "integer"
      },
      "OlfactometerChannelConfig": {
         "properties": {
            "channel_index": {
               "title": "Channel index",
               "type": "integer"
            },
            "channel_type": {
               "$ref": "#/$defs/OlfactometerChannelType",
               "default": "Odor",
               "title": "Channel type"
            },
            "flow_rate_capacity": {
               "default": 100,
               "enum": [
                  100,
                  1000
               ],
               "title": "Flow capacity. mL/min",
               "type": "integer"
            },
            "flow_rate": {
               "default": 100,
               "maximum": 100,
               "title": "Target flow rate. mL/min. If channel_type == CARRIER, this value is ignored.",
               "type": "number"
            },
            "odorant": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Odorant name"
            },
            "odorant_dilution": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Odorant dilution (%v/v)"
            }
         },
         "required": [
            "channel_index"
         ],
         "title": "OlfactometerChannelConfig",
         "type": "object"
      },
      "OlfactometerChannelType": {
         "description": "Channel type",
         "enum": [
            "Odor",
            "Carrier"
         ],
         "title": "OlfactometerChannelType",
         "type": "string"
      }
   },
   "required": [
      "input",
      "output"
   ]
}

Fields:
field description: Literal['Calibration of the harp olfactometer device'] = 'Calibration of the harp olfactometer device'[source]
field device_name: str = 'Olfactometer'[source]

Name of the device being calibrated

field input: OlfactometerCalibrationInput [Required][source]
field output: OlfactometerCalibrationOutput [Required][source]
pydantic model aind_behavior_services.calibration.olfactometer.OlfactometerCalibrationInput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "OlfactometerCalibrationInput",
   "type": "object",
   "properties": {
      "channel_config": {
         "additionalProperties": {
            "$ref": "#/$defs/OlfactometerChannelConfig"
         },
         "default": {},
         "description": "Configuration of olfactometer channels",
         "propertyNames": {
            "$ref": "#/$defs/OlfactometerChannel"
         },
         "title": "Channel Config",
         "type": "object"
      }
   },
   "$defs": {
      "OlfactometerChannel": {
         "description": "Harp Olfactometer available channel",
         "enum": [
            0,
            1,
            2,
            3
         ],
         "title": "OlfactometerChannel",
         "type": "integer"
      },
      "OlfactometerChannelConfig": {
         "properties": {
            "channel_index": {
               "title": "Channel index",
               "type": "integer"
            },
            "channel_type": {
               "$ref": "#/$defs/OlfactometerChannelType",
               "default": "Odor",
               "title": "Channel type"
            },
            "flow_rate_capacity": {
               "default": 100,
               "enum": [
                  100,
                  1000
               ],
               "title": "Flow capacity. mL/min",
               "type": "integer"
            },
            "flow_rate": {
               "default": 100,
               "maximum": 100,
               "title": "Target flow rate. mL/min. If channel_type == CARRIER, this value is ignored.",
               "type": "number"
            },
            "odorant": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Odorant name"
            },
            "odorant_dilution": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Odorant dilution (%v/v)"
            }
         },
         "required": [
            "channel_index"
         ],
         "title": "OlfactometerChannelConfig",
         "type": "object"
      },
      "OlfactometerChannelType": {
         "description": "Channel type",
         "enum": [
            "Odor",
            "Carrier"
         ],
         "title": "OlfactometerChannelType",
         "type": "string"
      }
   }
}

Fields:
field channel_config: Dict[OlfactometerChannel, OlfactometerChannelConfig] = {}[source]

Configuration of olfactometer channels

pydantic model aind_behavior_services.calibration.olfactometer.OlfactometerCalibrationOutput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "OlfactometerCalibrationOutput",
   "type": "object",
   "properties": {}
}

class aind_behavior_services.calibration.olfactometer.OlfactometerChannel(value)[source]

Bases: IntEnum

Harp Olfactometer available channel

Channel0 = 0[source]
Channel1 = 1[source]
Channel2 = 2[source]
Channel3 = 3[source]
pydantic model aind_behavior_services.calibration.olfactometer.OlfactometerChannelConfig[source]

Bases: BaseModel

Show JSON schema
{
   "title": "OlfactometerChannelConfig",
   "type": "object",
   "properties": {
      "channel_index": {
         "title": "Channel index",
         "type": "integer"
      },
      "channel_type": {
         "$ref": "#/$defs/OlfactometerChannelType",
         "default": "Odor",
         "title": "Channel type"
      },
      "flow_rate_capacity": {
         "default": 100,
         "enum": [
            100,
            1000
         ],
         "title": "Flow capacity. mL/min",
         "type": "integer"
      },
      "flow_rate": {
         "default": 100,
         "maximum": 100,
         "title": "Target flow rate. mL/min. If channel_type == CARRIER, this value is ignored.",
         "type": "number"
      },
      "odorant": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Odorant name"
      },
      "odorant_dilution": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Odorant dilution (%v/v)"
      }
   },
   "$defs": {
      "OlfactometerChannelType": {
         "description": "Channel type",
         "enum": [
            "Odor",
            "Carrier"
         ],
         "title": "OlfactometerChannelType",
         "type": "string"
      }
   },
   "required": [
      "channel_index"
   ]
}

Fields:
field channel_index: int [Required][source]
field channel_type: OlfactometerChannelType = OlfactometerChannelType.ODOR[source]
field flow_rate: float = 100[source]
Constraints:
  • le = 100

field flow_rate_capacity: Literal[100, 1000] = 100[source]
field odorant: str | None = None[source]
field odorant_dilution: float | None = None[source]
class aind_behavior_services.calibration.olfactometer.OlfactometerChannelType(value)[source]

Bases: str, Enum

Channel type

CARRIER = 'Carrier'[source]
ODOR = 'Odor'[source]

aind_behavior_services.calibration.treadmill module

pydantic model aind_behavior_services.calibration.treadmill.Treadmill[source]

Bases: HarpTreadmill

Show JSON schema
{
   "title": "Treadmill",
   "type": "object",
   "properties": {
      "device_type": {
         "const": "Treadmill",
         "default": "Treadmill",
         "title": "Device Type",
         "type": "string"
      },
      "device_name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device name",
         "title": "Device Name"
      },
      "additional_settings": {
         "anyOf": [
            {
               "$ref": "#/$defs/BaseModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Additional settings"
      },
      "calibration": {
         "anyOf": [
            {
               "$ref": "#/$defs/TreadmillCalibration"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Calibration of the treadmill"
      },
      "who_am_i": {
         "const": 1402,
         "default": 1402,
         "title": "Who Am I",
         "type": "integer"
      },
      "serial_number": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Device serial number",
         "title": "Serial Number"
      },
      "port_name": {
         "description": "Device port name",
         "title": "Port Name",
         "type": "string"
      }
   },
   "$defs": {
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "TreadmillCalibration": {
         "description": "Treadmill calibration class",
         "properties": {
            "device_name": {
               "default": "Treadmill",
               "description": "Must match a device name in rig/instrument",
               "title": "Device name",
               "type": "string"
            },
            "input": {
               "$ref": "#/$defs/TreadmillCalibrationInput",
               "title": "Input of the calibration"
            },
            "output": {
               "$ref": "#/$defs/TreadmillCalibrationOutput",
               "title": "Output of the calibration."
            },
            "date": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Date"
            },
            "description": {
               "const": "Calibration of the treadmill system",
               "default": "Calibration of the treadmill system",
               "title": "Description",
               "type": "string"
            },
            "notes": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Notes"
            }
         },
         "required": [
            "input",
            "output"
         ],
         "title": "TreadmillCalibration",
         "type": "object"
      },
      "TreadmillCalibrationInput": {
         "properties": {},
         "title": "TreadmillCalibrationInput",
         "type": "object"
      },
      "TreadmillCalibrationOutput": {
         "properties": {
            "wheel_diameter": {
               "default": 15,
               "description": "Wheel diameter",
               "minimum": 0,
               "title": "Wheel Diameter",
               "type": "number"
            },
            "pulses_per_revolution": {
               "default": 28800,
               "description": "Pulses per revolution",
               "minimum": 1,
               "title": "Pulses Per Revolution",
               "type": "integer"
            },
            "invert_direction": {
               "default": false,
               "description": "Invert direction",
               "title": "Invert Direction",
               "type": "boolean"
            },
            "brake_lookup_calibration": {
               "description": "Brake lookup calibration. Each pair of values define (input [torque], output [brake set-point U16])",
               "items": {
                  "items": {
                     "type": "number"
                  },
                  "maxItems": 2,
                  "minItems": 2,
                  "type": "array"
               },
               "minItems": 2,
               "title": "Brake Lookup Calibration",
               "type": "array"
            }
         },
         "required": [
            "brake_lookup_calibration"
         ],
         "title": "TreadmillCalibrationOutput",
         "type": "object"
      }
   },
   "required": [
      "port_name"
   ]
}

Fields:
Validators:

field calibration: TreadmillCalibration | None = None[source]
Validated by:
  • _set_name

pydantic model aind_behavior_services.calibration.treadmill.TreadmillCalibration[source]

Bases: Calibration

Treadmill calibration class

Show JSON schema
{
   "title": "TreadmillCalibration",
   "description": "Treadmill calibration class",
   "type": "object",
   "properties": {
      "device_name": {
         "default": "Treadmill",
         "description": "Must match a device name in rig/instrument",
         "title": "Device name",
         "type": "string"
      },
      "input": {
         "$ref": "#/$defs/TreadmillCalibrationInput",
         "title": "Input of the calibration"
      },
      "output": {
         "$ref": "#/$defs/TreadmillCalibrationOutput",
         "title": "Output of the calibration."
      },
      "date": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Date"
      },
      "description": {
         "const": "Calibration of the treadmill system",
         "default": "Calibration of the treadmill system",
         "title": "Description",
         "type": "string"
      },
      "notes": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Notes"
      }
   },
   "$defs": {
      "TreadmillCalibrationInput": {
         "properties": {},
         "title": "TreadmillCalibrationInput",
         "type": "object"
      },
      "TreadmillCalibrationOutput": {
         "properties": {
            "wheel_diameter": {
               "default": 15,
               "description": "Wheel diameter",
               "minimum": 0,
               "title": "Wheel Diameter",
               "type": "number"
            },
            "pulses_per_revolution": {
               "default": 28800,
               "description": "Pulses per revolution",
               "minimum": 1,
               "title": "Pulses Per Revolution",
               "type": "integer"
            },
            "invert_direction": {
               "default": false,
               "description": "Invert direction",
               "title": "Invert Direction",
               "type": "boolean"
            },
            "brake_lookup_calibration": {
               "description": "Brake lookup calibration. Each pair of values define (input [torque], output [brake set-point U16])",
               "items": {
                  "items": {
                     "type": "number"
                  },
                  "maxItems": 2,
                  "minItems": 2,
                  "type": "array"
               },
               "minItems": 2,
               "title": "Brake Lookup Calibration",
               "type": "array"
            }
         },
         "required": [
            "brake_lookup_calibration"
         ],
         "title": "TreadmillCalibrationOutput",
         "type": "object"
      }
   },
   "required": [
      "input",
      "output"
   ]
}

Fields:
field description: Literal['Calibration of the treadmill system'] = 'Calibration of the treadmill system'[source]
field device_name: str = 'Treadmill'[source]

Must match a device name in rig/instrument

field input: TreadmillCalibrationInput [Required][source]
field output: TreadmillCalibrationOutput [Required][source]
pydantic model aind_behavior_services.calibration.treadmill.TreadmillCalibrationInput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "TreadmillCalibrationInput",
   "type": "object",
   "properties": {}
}

pydantic model aind_behavior_services.calibration.treadmill.TreadmillCalibrationOutput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "TreadmillCalibrationOutput",
   "type": "object",
   "properties": {
      "wheel_diameter": {
         "default": 15,
         "description": "Wheel diameter",
         "minimum": 0,
         "title": "Wheel Diameter",
         "type": "number"
      },
      "pulses_per_revolution": {
         "default": 28800,
         "description": "Pulses per revolution",
         "minimum": 1,
         "title": "Pulses Per Revolution",
         "type": "integer"
      },
      "invert_direction": {
         "default": false,
         "description": "Invert direction",
         "title": "Invert Direction",
         "type": "boolean"
      },
      "brake_lookup_calibration": {
         "description": "Brake lookup calibration. Each pair of values define (input [torque], output [brake set-point U16])",
         "items": {
            "items": {
               "type": "number"
            },
            "maxItems": 2,
            "minItems": 2,
            "type": "array"
         },
         "minItems": 2,
         "title": "Brake Lookup Calibration",
         "type": "array"
      }
   },
   "required": [
      "brake_lookup_calibration"
   ]
}

Fields:
Validators:
field brake_lookup_calibration: List[Annotated[List[float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=2), MaxLen(max_length=2)])]] [Required][source]

Brake lookup calibration. Each pair of values define (input [torque], output [brake set-point U16])

Constraints:
  • min_length = 2

Validated by:
field invert_direction: bool = False[source]

Invert direction

field pulses_per_revolution: int = 28800[source]

Pulses per revolution

Constraints:
  • ge = 1

field wheel_diameter: float = 15[source]

Wheel diameter

Constraints:
  • ge = 0

validator validate_brake_lookup_calibration  »  brake_lookup_calibration[source]
Parameters:

value (List[Annotated[List[float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=2), MaxLen(max_length=2)])]])

Return type:

List[Annotated[List[float], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=2), MaxLen(max_length=2)])]]

aind_behavior_services.calibration.water_valve module

pydantic model aind_behavior_services.calibration.water_valve.Measurement[source]

Bases: BaseModel

Input for water valve calibration class

Show JSON schema
{
   "title": "Measurement",
   "description": "Input for water valve calibration class",
   "type": "object",
   "properties": {
      "valve_open_interval": {
         "description": "Time between two consecutive valve openings (s)",
         "exclusiveMinimum": 0,
         "title": "Valve open interval",
         "type": "number"
      },
      "valve_open_time": {
         "description": "Valve open interval (s)",
         "exclusiveMinimum": 0,
         "title": "Valve open time",
         "type": "number"
      },
      "water_weight": {
         "description": "Weight of water delivered (g)",
         "items": {
            "exclusiveMinimum": 0,
            "type": "number"
         },
         "minItems": 1,
         "title": "Water weight",
         "type": "array"
      },
      "repeat_count": {
         "description": "Number of times the valve opened.",
         "minimum": 0,
         "title": "Repeat count",
         "type": "integer"
      }
   },
   "required": [
      "valve_open_interval",
      "valve_open_time",
      "water_weight",
      "repeat_count"
   ]
}

Fields:
field repeat_count: int [Required][source]

Number of times the valve opened.

Constraints:
  • ge = 0

field valve_open_interval: float [Required][source]

Time between two consecutive valve openings (s)

Constraints:
  • gt = 0

field valve_open_time: float [Required][source]

Valve open interval (s)

Constraints:
  • gt = 0

field water_weight: List[PositiveFloat] [Required][source]

Weight of water delivered (g)

Constraints:
  • min_length = 1

pydantic model aind_behavior_services.calibration.water_valve.WaterValveCalibration[source]

Bases: Calibration

Water valve calibration class

Show JSON schema
{
   "title": "WaterValveCalibration",
   "description": "Water valve calibration class",
   "type": "object",
   "properties": {
      "device_name": {
         "default": "WaterValve",
         "description": "Name of the device being calibrated",
         "title": "Device name",
         "type": "string"
      },
      "input": {
         "$ref": "#/$defs/WaterValveCalibrationInput",
         "title": "Input of the calibration"
      },
      "output": {
         "$ref": "#/$defs/WaterValveCalibrationOutput",
         "title": "Output of the calibration."
      },
      "date": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Date"
      },
      "description": {
         "const": "Calibration of the water valve delivery system",
         "default": "Calibration of the water valve delivery system",
         "title": "Description",
         "type": "string"
      },
      "notes": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Notes"
      }
   },
   "$defs": {
      "Measurement": {
         "description": "Input for water valve calibration class",
         "properties": {
            "valve_open_interval": {
               "description": "Time between two consecutive valve openings (s)",
               "exclusiveMinimum": 0,
               "title": "Valve open interval",
               "type": "number"
            },
            "valve_open_time": {
               "description": "Valve open interval (s)",
               "exclusiveMinimum": 0,
               "title": "Valve open time",
               "type": "number"
            },
            "water_weight": {
               "description": "Weight of water delivered (g)",
               "items": {
                  "exclusiveMinimum": 0,
                  "type": "number"
               },
               "minItems": 1,
               "title": "Water weight",
               "type": "array"
            },
            "repeat_count": {
               "description": "Number of times the valve opened.",
               "minimum": 0,
               "title": "Repeat count",
               "type": "integer"
            }
         },
         "required": [
            "valve_open_interval",
            "valve_open_time",
            "water_weight",
            "repeat_count"
         ],
         "title": "Measurement",
         "type": "object"
      },
      "WaterValveCalibrationInput": {
         "properties": {
            "measurements": {
               "default": [],
               "description": "List of measurements",
               "items": {
                  "$ref": "#/$defs/Measurement"
               },
               "title": "Measurements",
               "type": "array"
            }
         },
         "title": "WaterValveCalibrationInput",
         "type": "object"
      },
      "WaterValveCalibrationOutput": {
         "description": "Output for water valve calibration class",
         "properties": {
            "interval_average": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "exclusiveMinimum": 0,
                        "type": "number"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Dictionary keyed by measured valve interval and corresponding average single event volume.",
               "title": "Interval average"
            },
            "slope": {
               "description": "Slope of the linear regression : Volume(g) = Slope(g/s) * time(s) + offset(g)",
               "title": "Regression slope",
               "type": "number"
            },
            "offset": {
               "description": "Offset of the linear regression : Volume(g) = Slope(g/s) * time(s) + offset(g)",
               "title": "Regression offset",
               "type": "number"
            },
            "r2": {
               "anyOf": [
                  {
                     "maximum": 1,
                     "minimum": 0,
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "R2 metric from the linear model.",
               "title": "R2"
            },
            "valid_domain": {
               "anyOf": [
                  {
                     "items": {
                        "exclusiveMinimum": 0,
                        "type": "number"
                     },
                     "minItems": 2,
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The optional time-intervals the calibration curve was calculated on.",
               "title": "Valid domain"
            }
         },
         "required": [
            "slope",
            "offset"
         ],
         "title": "WaterValveCalibrationOutput",
         "type": "object"
      }
   },
   "required": [
      "input",
      "output"
   ]
}

Fields:
field description: Literal['Calibration of the water valve delivery system'] = 'Calibration of the water valve delivery system'[source]
field device_name: str = 'WaterValve'[source]

Name of the device being calibrated

field input: WaterValveCalibrationInput [Required][source]
field output: WaterValveCalibrationOutput [Required][source]
pydantic model aind_behavior_services.calibration.water_valve.WaterValveCalibrationInput[source]

Bases: BaseModel

Show JSON schema
{
   "title": "WaterValveCalibrationInput",
   "type": "object",
   "properties": {
      "measurements": {
         "default": [],
         "description": "List of measurements",
         "items": {
            "$ref": "#/$defs/Measurement"
         },
         "title": "Measurements",
         "type": "array"
      }
   },
   "$defs": {
      "Measurement": {
         "description": "Input for water valve calibration class",
         "properties": {
            "valve_open_interval": {
               "description": "Time between two consecutive valve openings (s)",
               "exclusiveMinimum": 0,
               "title": "Valve open interval",
               "type": "number"
            },
            "valve_open_time": {
               "description": "Valve open interval (s)",
               "exclusiveMinimum": 0,
               "title": "Valve open time",
               "type": "number"
            },
            "water_weight": {
               "description": "Weight of water delivered (g)",
               "items": {
                  "exclusiveMinimum": 0,
                  "type": "number"
               },
               "minItems": 1,
               "title": "Water weight",
               "type": "array"
            },
            "repeat_count": {
               "description": "Number of times the valve opened.",
               "minimum": 0,
               "title": "Repeat count",
               "type": "integer"
            }
         },
         "required": [
            "valve_open_interval",
            "valve_open_time",
            "water_weight",
            "repeat_count"
         ],
         "title": "Measurement",
         "type": "object"
      }
   }
}

Fields:
field measurements: List[Measurement] = [][source]

List of measurements

calibrate_output(input=None)[source]

Calibrate the water valve delivery system by populating the output field

Parameters:

input (WaterValveCalibrationInput | None)

Return type:

WaterValveCalibrationOutput

pydantic model aind_behavior_services.calibration.water_valve.WaterValveCalibrationOutput[source]

Bases: BaseModel

Output for water valve calibration class

Show JSON schema
{
   "title": "WaterValveCalibrationOutput",
   "description": "Output for water valve calibration class",
   "type": "object",
   "properties": {
      "interval_average": {
         "anyOf": [
            {
               "additionalProperties": {
                  "exclusiveMinimum": 0,
                  "type": "number"
               },
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Dictionary keyed by measured valve interval and corresponding average single event volume.",
         "title": "Interval average"
      },
      "slope": {
         "description": "Slope of the linear regression : Volume(g) = Slope(g/s) * time(s) + offset(g)",
         "title": "Regression slope",
         "type": "number"
      },
      "offset": {
         "description": "Offset of the linear regression : Volume(g) = Slope(g/s) * time(s) + offset(g)",
         "title": "Regression offset",
         "type": "number"
      },
      "r2": {
         "anyOf": [
            {
               "maximum": 1,
               "minimum": 0,
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "R2 metric from the linear model.",
         "title": "R2"
      },
      "valid_domain": {
         "anyOf": [
            {
               "items": {
                  "exclusiveMinimum": 0,
                  "type": "number"
               },
               "minItems": 2,
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The optional time-intervals the calibration curve was calculated on.",
         "title": "Valid domain"
      }
   },
   "required": [
      "slope",
      "offset"
   ]
}

Fields:
field interval_average: Dict[PositiveFloat, PositiveFloat] | None = None[source]

Dictionary keyed by measured valve interval and corresponding average single event volume.

field offset: float [Required][source]

Offset of the linear regression : Volume(g) = Slope(g/s) * time(s) + offset(g)

field r2: float | None = None[source]

R2 metric from the linear model.

Constraints:
  • ge = 0

  • le = 1

field slope: float [Required][source]

Slope of the linear regression : Volume(g) = Slope(g/s) * time(s) + offset(g)

field valid_domain: List[PositiveFloat] | None = None[source]

The optional time-intervals the calibration curve was calculated on.

Constraints:
  • min_length = 2

Module contents

pydantic model aind_behavior_services.calibration.Calibration[source]

Bases: BaseModel

Base class for all Calibration models. Stores calibration (meta)data.

Show JSON schema
{
   "title": "Calibration",
   "description": "Base class for all Calibration models. Stores calibration (meta)data.",
   "type": "object",
   "properties": {
      "device_name": {
         "description": "Name of the device being calibrated",
         "title": "Device name",
         "type": "string"
      },
      "input": {
         "anyOf": [
            {
               "$ref": "#/$defs/BaseModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Input data"
      },
      "output": {
         "anyOf": [
            {
               "$ref": "#/$defs/BaseModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Output data"
      },
      "date": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Date"
      },
      "description": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Brief description of what is being calibrated"
      },
      "notes": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Notes"
      }
   },
   "$defs": {
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      }
   },
   "required": [
      "device_name"
   ]
}

Fields:
  • date (datetime.datetime | None)

  • description (str | None)

  • device_name (str)

  • input (pydantic.main.BaseModel | None)

  • notes (str | None)

  • output (pydantic.main.BaseModel | None)

field date: datetime | None = None[source]
field description: str | None = None[source]
field device_name: str [Required][source]

Name of the device being calibrated

field input: BaseModel | None = None[source]
field notes: str | None = None[source]
field output: BaseModel | None = None[source]