np_codeocean 0.3.5__py3-none-any.whl → 0.3.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -377,4 +377,4 @@ class DynamicRoutingTaskRigEtl(NeuropixelsRigEtl):
377
377
  # calibrations
378
378
  self._transform_calibrations(extracted_source)
379
379
 
380
- return super()._transform(extracted_source.current)
380
+ return super()._transform(extracted_source.current)
@@ -1,115 +1,115 @@
1
- import datetime
2
- import logging
3
-
4
- from aind_data_schema.components import devices
5
- from aind_data_schema.core import rig
6
- from aind_data_schema_models import organizations
7
-
8
- from np_codeocean.metadata import common, rigs
9
-
10
- logger = logging.getLogger(__name__)
11
-
12
-
13
- def init(
14
- rig_name: str,
15
- modification_date: datetime.date,
16
- ) -> rig.Rig:
17
- """Initializes a rig model for an nsb behavior box.
18
-
19
- >>> rig_model = init("B6", datetime.date.today())
20
-
21
- Notes
22
- -----
23
- - rig_id is expected to be in the format:
24
- <ROOM NAME>_<RIG NAME>_<MODIFICATION DATE>
25
- - The DR task does not set the brightness and contrast of the monitor.
26
- These are hardcoded and assumed to be static.
27
- """
28
- if rigs.is_retrofitted_rig(rig_name):
29
- solenoid_valve = devices.Device(
30
- name="Solenoid Valve",
31
- device_type="Solenoid Valve",
32
- manufacturer=organizations.Organization.NRESEARCH_INC,
33
- model="161K011",
34
- notes="Model number is product number.",
35
- )
36
- else:
37
- solenoid_valve = devices.Device(
38
- name="Solenoid Valve",
39
- device_type="Solenoid Valve",
40
- manufacturer=organizations.Organization.NRESEARCH_INC,
41
- model="LVM10R1-6A-Q",
42
- notes="Manufacturer is a placeholder. Actual manufacturer is SMC.",
43
- )
44
- stimulus_devices = [
45
- devices.Monitor(
46
- name="Stim",
47
- model="PA248",
48
- manufacturer=organizations.Organization.ASUS,
49
- width=1920,
50
- height=1200,
51
- size_unit="pixel",
52
- viewing_distance=15.3,
53
- viewing_distance_unit="centimeter",
54
- refresh_rate=60,
55
- brightness=43,
56
- contrast=50,
57
- ),
58
- devices.RewardDelivery(
59
- reward_spouts=[
60
- devices.RewardSpout(
61
- name="Reward Spout",
62
- manufacturer=organizations.Organization.HAMILTON,
63
- model="8649-01 Custom",
64
- spout_diameter=0.672,
65
- spout_diameter_unit="millimeter",
66
- side=devices.SpoutSide.CENTER,
67
- solenoid_valve=solenoid_valve,
68
- lick_sensor=devices.Device(
69
- name="Lick Sensor",
70
- device_type="Lick Sensor",
71
- manufacturer=organizations.Organization.OTHER,
72
- ),
73
- lick_sensor_type=devices.LickSensorType.PIEZOELECTIC,
74
- notes=(
75
- "Spout diameter is for inner diameter. "
76
- "Outer diameter is 1.575mm. "
77
- ),
78
- ),
79
- ]
80
- ),
81
- ]
82
- if rigs.is_retrofitted_rig(rig_name):
83
- logger.debug("Adding speaker to rig model.")
84
- stimulus_devices.append(
85
- devices.Speaker(
86
- name="Speaker",
87
- manufacturer=organizations.Organization.ISL,
88
- model="SPK-I-81345",
89
- )
90
- )
91
-
92
- room_name = rigs.get_rig_room(rig_name)
93
- modification_date_str = modification_date.strftime(common.MODIFICATION_DATE_FORMAT)
94
- rig_id = f"{room_name}_{rig_name}_{modification_date_str}"
95
-
96
- model = rig.Rig(
97
- rig_id=rig_id,
98
- modification_date=modification_date,
99
- modalities=[
100
- rig.Modality.BEHAVIOR,
101
- ],
102
- mouse_platform=devices.Disc(
103
- name="Mouse Platform",
104
- radius="4.69",
105
- radius_unit="centimeter",
106
- notes=(
107
- "Radius is the distance from the center of the wheel to the " "mouse."
108
- ),
109
- ),
110
- stimulus_devices=stimulus_devices,
111
- cameras=[],
112
- calibrations=[],
113
- )
114
-
115
- return rig.Rig.model_validate(model)
1
+ import datetime
2
+ import logging
3
+
4
+ from aind_data_schema.components import devices
5
+ from aind_data_schema.core import rig
6
+ from aind_data_schema_models import organizations
7
+
8
+ from np_codeocean.metadata import common, rigs
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+
13
+ def init(
14
+ rig_name: str,
15
+ modification_date: datetime.date,
16
+ ) -> rig.Rig:
17
+ """Initializes a rig model for an nsb behavior box.
18
+
19
+ >>> rig_model = init("B6", datetime.date.today())
20
+
21
+ Notes
22
+ -----
23
+ - rig_id is expected to be in the format:
24
+ <ROOM NAME>_<RIG NAME>_<MODIFICATION DATE>
25
+ - The DR task does not set the brightness and contrast of the monitor.
26
+ These are hardcoded and assumed to be static.
27
+ """
28
+ if rigs.is_retrofitted_rig(rig_name):
29
+ solenoid_valve = devices.Device(
30
+ name="Solenoid Valve",
31
+ device_type="Solenoid Valve",
32
+ manufacturer=organizations.Organization.NRESEARCH_INC,
33
+ model="161K011",
34
+ notes="Model number is product number.",
35
+ )
36
+ else:
37
+ solenoid_valve = devices.Device(
38
+ name="Solenoid Valve",
39
+ device_type="Solenoid Valve",
40
+ manufacturer=organizations.Organization.NRESEARCH_INC,
41
+ model="LVM10R1-6A-Q",
42
+ notes="Manufacturer is a placeholder. Actual manufacturer is SMC.",
43
+ )
44
+ stimulus_devices = [
45
+ devices.Monitor(
46
+ name="Stim",
47
+ model="PA248",
48
+ manufacturer=organizations.Organization.ASUS,
49
+ width=1920,
50
+ height=1200,
51
+ size_unit="pixel",
52
+ viewing_distance=15.3,
53
+ viewing_distance_unit="centimeter",
54
+ refresh_rate=60,
55
+ brightness=43,
56
+ contrast=50,
57
+ ),
58
+ devices.RewardDelivery(
59
+ reward_spouts=[
60
+ devices.RewardSpout(
61
+ name="Reward Spout",
62
+ manufacturer=organizations.Organization.HAMILTON,
63
+ model="8649-01 Custom",
64
+ spout_diameter=0.672,
65
+ spout_diameter_unit="millimeter",
66
+ side=devices.SpoutSide.CENTER,
67
+ solenoid_valve=solenoid_valve,
68
+ lick_sensor=devices.Device(
69
+ name="Lick Sensor",
70
+ device_type="Lick Sensor",
71
+ manufacturer=organizations.Organization.OTHER,
72
+ ),
73
+ lick_sensor_type=devices.LickSensorType.PIEZOELECTIC,
74
+ notes=(
75
+ "Spout diameter is for inner diameter. "
76
+ "Outer diameter is 1.575mm. "
77
+ ),
78
+ ),
79
+ ]
80
+ ),
81
+ ]
82
+ if rigs.is_retrofitted_rig(rig_name):
83
+ logger.debug("Adding speaker to rig model.")
84
+ stimulus_devices.append(
85
+ devices.Speaker(
86
+ name="Speaker",
87
+ manufacturer=organizations.Organization.ISL,
88
+ model="SPK-I-81345",
89
+ )
90
+ )
91
+
92
+ room_name = rigs.get_rig_room(rig_name)
93
+ modification_date_str = modification_date.strftime(common.MODIFICATION_DATE_FORMAT)
94
+ rig_id = f"{room_name}_{rig_name}_{modification_date_str}"
95
+
96
+ model = rig.Rig(
97
+ rig_id=rig_id,
98
+ modification_date=modification_date,
99
+ modalities=[
100
+ rig.Modality.BEHAVIOR,
101
+ ],
102
+ mouse_platform=devices.Disc(
103
+ name="Mouse Platform",
104
+ radius="4.69",
105
+ radius_unit="centimeter",
106
+ notes=(
107
+ "Radius is the distance from the center of the wheel to the " "mouse."
108
+ ),
109
+ ),
110
+ stimulus_devices=stimulus_devices,
111
+ cameras=[],
112
+ calibrations=[],
113
+ )
114
+
115
+ return rig.Rig.model_validate(model)