treadmill¶
For running the calibration of the treadmill refer to this repository.
- pydantic model aind_behavior_services.calibration.treadmill.CalibrationLogic[source]¶
Bases:
AindBehaviorTaskLogicModel
Treadmill operation control model that is used to run a calibration data acquisition workflow
- 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 = CalibrationParameters(rng_seed=None, aind_behavior_services_pkg_version='0.8.8')[source]¶
- pydantic model aind_behavior_services.calibration.treadmill.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.treadmill.CalibrationRig[source]¶
Bases:
AindBehaviorRigModel
- Fields:
- Validators:
- pydantic model aind_behavior_services.calibration.treadmill.Treadmill[source]¶
Bases:
HarpTreadmill
- field calibration: TreadmillCalibration | None = None[source]¶
- pydantic model aind_behavior_services.calibration.treadmill.TreadmillCalibration[source]¶
Bases:
Calibration
Treadmill calibration class
- Fields:
- field description: Literal['Calibration of the treadmill system'] = 'Calibration of the treadmill system'[source]¶
- field input: TreadmillCalibrationInput [Required][source]¶
- field output: TreadmillCalibrationOutput [Required][source]¶
- pydantic model aind_behavior_services.calibration.treadmill.TreadmillCalibrationInput[source]¶
Bases:
BaseModel
- pydantic model aind_behavior_services.calibration.treadmill.TreadmillCalibrationOutput[source]¶
Bases:
BaseModel
- Fields:
- Validators:
- field brake_lookup_calibration: List[List[float]] [Required][source]¶
Brake lookup calibration. Each pair of values define (input [torque], output [brake set-point U16])
- Constraints:
min_length = 2
- Validated by:
- validator validate_brake_lookup_calibration » brake_lookup_calibration[source]¶
Example¶
import os
from aind_behavior_services.base import get_commit_hash
from aind_behavior_services.calibration import treadmill
from aind_behavior_services.session import AindBehaviorSessionModel
from aind_behavior_services.utils import utcnow
treadmill_calibration = treadmill.TreadmillCalibrationOutput(
wheel_diameter=10,
pulses_per_revolution=10000,
invert_direction=False,
brake_lookup_calibration=[[0, 0], [0.5, 32768], [1, 65535]],
)
calibration = treadmill.TreadmillCalibration(
device_name="Treadmill",
input=treadmill.TreadmillCalibrationInput(),
output=treadmill_calibration,
date=utcnow(),
)
calibration_logic = treadmill.CalibrationLogic()
calibration_session = AindBehaviorSessionModel(
root_path="C:\\Data",
allow_dirty_repo=False,
experiment="Calibration",
date=utcnow(),
subject="00000",
experiment_version="treadmill",
commit_hash=get_commit_hash(),
)
rig = treadmill.CalibrationRig(
treadmill=treadmill.Treadmill(calibration=calibration, port_name="COM4"),
rig_name="TreadmillCalibrationRig",
)
seed_path = "local/treadmill_{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))