Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def _map(self) -> Acquisition:
output_parameters=metrics.model_dump(),
)

curriculum_status = str(trainer_state.stage.name) if trainer_state.stage is not None else None

stimulus_epoch = StimulusEpoch(
stimulus_start_time=session_model.date,
stimulus_end_time=acquisition_end_time,
Expand All @@ -169,6 +171,7 @@ def _map(self) -> Acquisition:
stimulus_modalities=[StimulusModality.AUDITORY],
performance_metrics=performance_metrics,
training_protocol_name=str(trainer_state.curriculum.name),
curriculum_status=curriculum_status,
)

# Construct aind-data-schema session
Expand All @@ -179,7 +182,7 @@ def _map(self) -> Acquisition:
acquisition_end_time=acquisition_end_time,
acquisition_start_time=session_model.date,
experimenters=session_model.experimenter,
acquisition_type=session_model.experiment or task_logic_model.name,
acquisition_type=task_logic_model.name,
coordinate_system=None,
data_streams=data_streams,
stimulus_epochs=[stimulus_epoch],
Expand All @@ -189,7 +192,7 @@ def _map(self) -> Acquisition:
def _get_subject_details(data_path: os.PathLike) -> AcquisitionSubjectDetails:
water = calculate_consumed_water(data_path)
return AcquisitionSubjectDetails(
mouse_platform_name="tube",
mouse_platform_name="mouse_tube_foraging",
reward_consumed_total=None if not water else Decimal(str(water)),
reward_consumed_unit=units.VolumeUnit.ML,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from aind_behavior_services.rig import water_valve as abs_water_valve
from aind_behavior_services.utils import get_fields_of_type, utcnow
from aind_data_schema.components.connections import Connection
from aind_data_schema.components.coordinates import Axis, AxisName, CoordinateSystem, Direction, Origin
from aind_data_schema.components.coordinates import Axis, AxisName, CoordinateSystem, Direction, Origin, Scale
from aind_data_schema.components.devices import (
AnatomicalRelative,
Camera,
Expand All @@ -20,11 +20,17 @@
Cooling,
DataInterface,
Device,
Enclosure,
HarpDevice,
HarpDeviceType,
Lens,
LickSensorType,
LickSpout,
LickSpoutAssembly,
LightEmittingDiode,
MotorizedStage,
SizeUnit,
Tube,
)
from aind_data_schema.components.measurements import CalibrationFit, FitType, GenericModel, VolumeCalibration
from aind_data_schema.core.acquisition import CALIBRATIONS
Expand Down Expand Up @@ -140,6 +146,13 @@ def _map(self) -> Instrument:
controller = rig.triggered_camera_controller
fps = float(controller.frame_rate) if controller.frame_rate else float("nan")
for name, cam in rig.triggered_camera_controller.cameras.items():
additional_settings = cam.model_dump()
additional_settings["note"] = (
"The additional_settings values are the input parameters used to initialize the camera. Model found at https://github.com/AllenNeuralDynamics/Aind.Behavior.Services/blob/a6c0f539275f73af87da82a8ea0101836389f1b3/src/aind_behavior_services/rig/cameras.py#L226. Enum clarifications: adc_bit_depth is an "
"Spinnaker SDK enum-coded value (0=ADC8BIT, 1=ADC10BIT, 2=ADC12BIT), and pixel_format "
"is also enum-coded (for this configuration, 0=MONO8)."
)

Comment thread
micahwoodard marked this conversation as resolved.
camera = Camera(
name=name,
manufacturer=Organization.FLIR,
Expand All @@ -160,7 +173,7 @@ def _map(self) -> Instrument:
crop_width=cam.region_of_interest.width if cam.region_of_interest.width > 0 else None,
crop_height=cam.region_of_interest.height if cam.region_of_interest.height > 0 else None,
crop_unit=SizeUnit.PX,
additional_settings=GenericModel.model_validate(cam.model_dump()),
additional_settings=GenericModel.model_validate(additional_settings),
)
assembly = CameraAssembly(
name=f"{name}Assembly",
Expand Down Expand Up @@ -269,32 +282,90 @@ def _map(self) -> Instrument:
)
)

# manipulator\
# lick spout assembly
components.append(
MotorizedStage(
name="motorized_stage",
manufacturer=Organization.AIND,
model="328-300-00",
travel=Decimal("30"),
travel_unit=SizeUnit.CM,
notes="This stage is driven by the manipulator device.",
LickSpoutAssembly(
name="LickSpoutAssembly",
lick_spouts=[
LickSpout(
name="Left lick spout",
manufacturer=Organization.OTHER,
notes=" (v1v2 upgrade): 'manufacturer' field was missing, defaulting to 'Other'.",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spout_diameter=Decimal("1.2"),
spout_diameter_unit=SizeUnit.MM,
solenoid_valve=Device(
name="Solenoid Left",
manufacturer=Organization.THE_LEE_COMPANY,
model="LHDB1233518H",
),
lick_sensor=Device(
name="Lick Sensor Left",
manufacturer=Organization.JANELIA,
),
lick_sensor_type=LickSensorType.CAPACITIVE,
),
LickSpout(
name="Right lick spout",
manufacturer=Organization.OTHER,
notes="Lick spout manufacturer is unknown.",
spout_diameter=Decimal("1.2"),
spout_diameter_unit=SizeUnit.MM,
solenoid_valve=Device(
name="Solenoid Right",
manufacturer=Organization.THE_LEE_COMPANY,
model="LHDB1233518H",
),
lick_sensor=Device(
name="Lick Sensor Right",
manufacturer=Organization.JANELIA,
),
lick_sensor_type=LickSensorType.CAPACITIVE,
),
],
motorized_stage=MotorizedStage(
name="motorized_stage",
manufacturer=Organization.AIND,
model="328-300-00",
travel=Decimal("30"),
travel_unit=SizeUnit.MM,
notes="This stage is driven by the manipulator device.",
),
)
)

# solenoid
# mouse platform
components.append(
Device(
name="left_water_valve_solenoid",
manufacturer=Organization.THE_LEE_COMPANY,
model="LHDB1233518H",
Tube(
name="mouse_tube_foraging",
manufacturer=Organization.CUSTOM,
diameter=Decimal("3.0"),
diameter_unit=SizeUnit.CM,
)
)

# IR light source
components.append(
Device(
name="right_water_valve_solenoid",
manufacturer=Organization.THE_LEE_COMPANY,
model="LHDB1233518H",
LightEmittingDiode(
name="IR LED",
manufacturer=Organization.THORLABS,
model="M810L5",
wavelength=810,
)
)

# enclosure
components.append(
Enclosure(
name="Behavior enclosure",
manufacturer=Organization.AIND,
size=Scale(scale=[54, 54, 54]),
size_unit=SizeUnit.CM,
internal_material="",
external_material="",
grounded=False,
laser_interlock=False,
air_filtration=False,
notes=" (v1v2 upgrade): Scale is width/length/height",
)
)

Expand All @@ -317,14 +388,12 @@ def _map(self) -> Instrument:
connections.append(
Connection(
source_device="BehaviorBoard",
target_device="left_water_valve_solenoid",
target_device="Solenoid Left",
source_port="SupplyPort0",
)
)
connections.append(
Connection(
source_device="BehaviorBoard", target_device="right_water_valve_solenoid", source_port="SupplyPort1"
)
Connection(source_device="BehaviorBoard", target_device="Solenoid Right", source_port="SupplyPort1")
)

return Instrument(
Expand Down