aind_manipulator¶
- pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorCalibration[source]¶
Bases:
Calibration
Aind manipulator calibration class
- Fields:
- field description: Literal['Calibration of the load cells system'] = 'Calibration of the load cells system'[source]¶
- field input: AindManipulatorCalibrationInput [Required][source]¶
- field output: AindManipulatorCalibrationOutput [Required][source]¶
- pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorCalibrationInput[source]¶
Bases:
BaseModel
- Fields:
axis_configuration (List[aind_behavior_services.calibration.aind_manipulator.AxisConfiguration])
full_step_to_mm (aind_behavior_services.calibration.aind_manipulator.ManipulatorPosition)
homing_order (List[aind_behavior_services.calibration.aind_manipulator.Axis])
initial_position (aind_behavior_services.calibration.aind_manipulator.ManipulatorPosition)
- 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 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
- pydantic model aind_behavior_services.calibration.aind_manipulator.AindManipulatorDevice[source]¶
Bases:
HarpStepperDriver
- Fields:
- field calibration: AindManipulatorCalibration | None = None[source]¶
- class aind_behavior_services.calibration.aind_manipulator.Axis(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
Motor axis available
- pydantic model aind_behavior_services.calibration.aind_manipulator.AxisConfiguration[source]¶
Bases:
BaseModel
Axis configuration
- Fields:
- field microstep_resolution: MicrostepResolution = MicrostepResolution.MICROSTEP8[source]¶
- field motor_operation_mode: MotorOperationMode = MotorOperationMode.QUIET[source]¶
- pydantic model aind_behavior_services.calibration.aind_manipulator.CalibrationLogic[source]¶
Bases:
AindBehaviorTaskLogicModel
- Config:
extra: str = forbid
validate_assignment: bool = True
validate_defaults: bool = True
strict: bool = True
str_strip_whitespace: bool = True
- Fields:
- Validators:
coerce_version
»version
- field task_parameters: CalibrationParameters [Required][source]¶
- pydantic model aind_behavior_services.calibration.aind_manipulator.CalibrationParameters[source]¶
Bases:
TaskParameters
- Config:
extra: str = allow
validate_assignment: bool = True
validate_defaults: bool = True
strict: bool = True
str_strip_whitespace: bool = True
- Fields:
- Validators:
- pydantic model aind_behavior_services.calibration.aind_manipulator.CalibrationRig[source]¶
Bases:
AindBehaviorRigModel
- Fields:
- Validators:
- field manipulator: AindManipulatorDevice = None[source]¶
- pydantic model aind_behavior_services.calibration.aind_manipulator.ManipulatorPosition[source]¶
Bases:
BaseModel
- Fields:
- class aind_behavior_services.calibration.aind_manipulator.MicrostepResolution(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
- class aind_behavior_services.calibration.aind_manipulator.MotorOperationMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
Example¶
import os
from aind_behavior_services.base import get_commit_hash
from aind_behavior_services.calibration import aind_manipulator as m
from aind_behavior_services.session import AindBehaviorSessionModel
from aind_behavior_services.utils import utcnow
calibration_data = m.AindManipulatorCalibration(
device_name="AindManipulatorCalibration",
input=m.AindManipulatorCalibrationInput(
full_step_to_mm=m.ManipulatorPosition(x=0.01, y1=0.01, y2=0.01, z=0.01),
axis_configuration=[
m.AxisConfiguration(axis=m.Axis.X),
m.AxisConfiguration(axis=m.Axis.Y1),
m.AxisConfiguration(axis=m.Axis.Y2),
m.AxisConfiguration(axis=m.Axis.Z),
],
homing_order=[m.Axis.Y2, m.Axis.Y1, m.Axis.X, m.Axis.Z],
initial_position=m.ManipulatorPosition(y1=0, y2=0, x=0, z=10000),
),
output=m.AindManipulatorCalibrationOutput(),
date=utcnow(),
)
calibration_logic = m.CalibrationLogic(task_parameters=m.CalibrationParameters())
calibration_session = AindBehaviorSessionModel(
root_path="C:\\Data",
allow_dirty_repo=False,
experiment="AindManipulatorCalibration",
date=utcnow(),
subject="AindManipulator",
experiment_version="manipulator_control",
commit_hash=get_commit_hash(),
)
rig = m.CalibrationRig(
manipulator=m.AindManipulatorDevice(port_name="COM4", calibration=calibration_data),
rig_name="AindManipulatorRig",
)
seed_path = "local/aind_manipulator_{suffix}.json"
os.makedirs(os.path.dirname(seed_path), exist_ok=True)
with open(seed_path.format(suffix="calibration_logic"), "w") as f:
f.write(calibration_logic.model_dump_json(indent=3))
with open(seed_path.format(suffix="session"), "w") as f:
f.write(calibration_session.model_dump_json(indent=3))
with open(seed_path.format(suffix="rig"), "w") as f:
f.write(rig.model_dump_json(indent=3))