Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed lick sensor #1035

Merged
merged 9 commits into from
Aug 31, 2024
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
44 changes: 40 additions & 4 deletions examples/fip_behavior_rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"reward_spouts": [
{
"device_type": "Reward spout",
"name": "Janelia_Lick_Detector Left",
"name": "Left spout",
"serial_number": null,
"manufacturer": null,
"model": null,
Expand All @@ -66,12 +66,30 @@
"additional_settings": {},
"notes": null
},
"lick_sensor": null,
"lick_sensor": {
"device_type": "Lick detector",
"name": "Janelia_Lick_Detector Left",
"serial_number": null,
"manufacturer": {
"name": "Janelia Research Campus",
"abbreviation": "Janelia",
"registry": {
"name": "Research Organization Registry",
"abbreviation": "ROR"
},
"registry_identifier": "013sk6x84"
},
"model": null,
"path_to_cad": null,
"port_index": null,
"additional_settings": {},
"notes": null
},
"lick_sensor_type": "Capacitive"
},
{
"device_type": "Reward spout",
"name": "Janelia_Lick_Detector Right",
"name": "Right spout",
"serial_number": null,
"manufacturer": null,
"model": null,
Expand All @@ -94,7 +112,25 @@
"additional_settings": {},
"notes": null
},
"lick_sensor": null,
"lick_sensor": {
"device_type": "Lick detector",
"name": "Janelia_Lick_Detector Right",
"serial_number": null,
"manufacturer": {
"name": "Janelia Research Campus",
"abbreviation": "Janelia",
"registry": {
"name": "Research Organization Registry",
"abbreviation": "ROR"
},
"registry_identifier": "013sk6x84"
},
"model": null,
"path_to_cad": null,
"port_index": null,
"additional_settings": {},
"notes": null
},
"lick_sensor_type": "Capacitive"
}
]
Expand Down
14 changes: 12 additions & 2 deletions examples/fip_behavior_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,27 @@
d.RewardDelivery(
reward_spouts=[
d.RewardSpout(
name="Janelia_Lick_Detector Left",
name="Left spout",
side=d.SpoutSide.LEFT,
spout_diameter=1.2,
solenoid_valve=d.Device(device_type="Solenoid", name="Solenoid Left"),
lick_sensor=d.Device(
name="Janelia_Lick_Detector Left",
device_type="Lick detector",
manufacturer=d.Organization.JANELIA,
),
lick_sensor_type=d.LickSensorType("Capacitive"),
),
d.RewardSpout(
name="Janelia_Lick_Detector Right",
name="Right spout",
side=d.SpoutSide.RIGHT,
spout_diameter=1.2,
solenoid_valve=d.Device(device_type="Solenoid", name="Solenoid Right"),
lick_sensor=d.Device(
name="Janelia_Lick_Detector Right",
device_type="Lick detector",
manufacturer=d.Organization.JANELIA,
),
lick_sensor_type=d.LickSensorType("Capacitive"),
),
],
Expand Down
28 changes: 24 additions & 4 deletions examples/fip_ophys_rig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"reward_spouts": [
{
"device_type": "Reward spout",
"name": "Lick-o-meter Left",
"name": "Left spout",
"serial_number": null,
"manufacturer": null,
"model": null,
Expand All @@ -52,12 +52,22 @@
"additional_settings": {},
"notes": null
},
"lick_sensor": null,
"lick_sensor": {
"device_type": "Lick detector",
"name": "Lick-o-meter Left",
"serial_number": null,
"manufacturer": null,
"model": null,
"path_to_cad": null,
"port_index": null,
"additional_settings": {},
"notes": null
},
"lick_sensor_type": null
},
{
"device_type": "Reward spout",
"name": "Lick-o-meter Right",
"name": "Right spout",
"serial_number": null,
"manufacturer": null,
"model": null,
Expand All @@ -80,7 +90,17 @@
"additional_settings": {},
"notes": null
},
"lick_sensor": null,
"lick_sensor": {
"device_type": "Lick detector",
"name": "Lick-o-meter Right",
"serial_number": null,
"manufacturer": null,
"model": null,
"path_to_cad": null,
"port_index": null,
"additional_settings": {},
"notes": null
},
"lick_sensor_type": null
}
]
Expand Down
12 changes: 10 additions & 2 deletions examples/fip_ophys_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,24 @@
d.RewardDelivery(
reward_spouts=[
d.RewardSpout(
name="Lick-o-meter Left",
name="Left spout",
side=d.SpoutSide.LEFT,
spout_diameter=1.2,
solenoid_valve=d.Device(device_type="Solenoid", name="Solenoid Left"),
lick_sensor=d.Device(
name="Lick-o-meter Left",
device_type="Lick detector",
),
),
d.RewardSpout(
name="Lick-o-meter Right",
name="Right spout",
side=d.SpoutSide.RIGHT,
spout_diameter=1.2,
solenoid_valve=d.Device(device_type="Solenoid", name="Solenoid Right"),
lick_sensor=d.Device(
name="Lick-o-meter Right",
device_type="Lick detector",
),
),
]
)
Expand Down
2 changes: 1 addition & 1 deletion src/aind_data_schema/components/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ class RewardSpout(Device):
spout_diameter_unit: SizeUnit = Field(default=SizeUnit.MM, title="Spout diameter unit")
spout_position: Optional[RelativePosition] = Field(default=None, title="Spout stage position")
solenoid_valve: Device = Field(..., title="Solenoid valve")
lick_sensor: Optional[Device] = Field(default=None, title="Lick sensor")
lick_sensor: Device = Field(..., title="Lick sensor")
lick_sensor_type: Optional[LickSensorType] = Field(default=None, title="Lick sensor type")
notes: Optional[str] = Field(default=None, title="Notes")

Expand Down
2 changes: 1 addition & 1 deletion src/aind_data_schema/core/rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def validate_device_names(cls, value: List[DAQDevice], info: ValidationInfo) ->
reward_delivery_device_names = []
for rd in reward_deliveries:
for rs in rd.reward_spouts:
reward_delivery_device_names += [rs.name, rs.solenoid_valve.name]
reward_delivery_device_names += [rs.name, rs.solenoid_valve.name, rs.lick_sensor.name]

all_device_names = (
standard_device_names
Expand Down
4 changes: 4 additions & 0 deletions tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def test_other_validators(self):
device_type="solenoid",
name="test_solenoid",
),
lick_sensor=Device(
device_type="Lick sensor",
name="Sensor_test",
),
side=SpoutSide.OTHER,
)

Expand Down
26 changes: 20 additions & 6 deletions tests/test_rig_session_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,11 @@ def read_json(filepath: Path) -> dict:
channels=[
d.DAQChannel(channel_name="DO0", device_name="Solenoid Left", channel_type="Digital Output"),
d.DAQChannel(channel_name="DO1", device_name="Solenoid Right", channel_type="Digital Output"),
d.DAQChannel(channel_name="DI0", device_name="Lick-o-meter Left", channel_type="Digital Input"),
d.DAQChannel(
channel_name="DI1", device_name="Lick-o-meter Right", channel_type="Digital Input"
channel_name="DI0", device_name="Janelia_Lick_Detector Left", channel_type="Digital Input"
),
d.DAQChannel(
channel_name="DI1", device_name="Janelia_Lick_Detector Right", channel_type="Digital Input"
),
d.DAQChannel(channel_name="DI3", device_name="Photometry Clock", channel_type="Digital Input"),
],
Expand All @@ -723,19 +725,31 @@ def read_json(filepath: Path) -> dict:
d.RewardDelivery(
reward_spouts=[
d.RewardSpout(
name="Lick-o-meter Left",
name="Left spout",
side=d.SpoutSide.LEFT,
spout_diameter=1.2,
solenoid_valve=d.Device(device_type="Solenoid", name="Solenoid Left"),
lick_sensor=d.Device(
name="Janelia_Lick_Detector Left",
device_type="Lick detector",
manufacturer=d.Organization.JANELIA,
),
lick_sensor_type=d.LickSensorType("Capacitive"),
),
d.RewardSpout(
name="Lick-o-meter Right",
name="Right spout",
side=d.SpoutSide.RIGHT,
spout_diameter=1.2,
solenoid_valve=d.Device(device_type="Solenoid", name="Solenoid Right"),
lick_sensor=d.Device(
name="Janelia_Lick_Detector Right",
device_type="Lick detector",
manufacturer=d.Organization.JANELIA,
),
lick_sensor_type=d.LickSensorType("Capacitive"),
),
]
)
],
),
],
additional_devices=[d.Device(device_type="Photometry Clock", name="Photometry Clock")],
calibrations=[
Expand Down
Loading