sl-shared-assets 1.0.0rc13__py3-none-any.whl → 1.0.0rc15__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.

Potentially problematic release.


This version of sl-shared-assets might be problematic. Click here for more details.

Files changed (42) hide show
  1. sl_shared_assets/__init__.py +27 -9
  2. sl_shared_assets/__init__.pyi +71 -0
  3. sl_shared_assets/cli.py +13 -14
  4. sl_shared_assets/cli.pyi +28 -0
  5. sl_shared_assets/data_classes/__init__.py +63 -0
  6. sl_shared_assets/data_classes/__init__.pyi +61 -0
  7. sl_shared_assets/data_classes/configuration_data.py +64 -0
  8. sl_shared_assets/data_classes/configuration_data.pyi +37 -0
  9. sl_shared_assets/data_classes/runtime_data.py +233 -0
  10. sl_shared_assets/data_classes/runtime_data.pyi +145 -0
  11. sl_shared_assets/data_classes/session_data.py +1275 -0
  12. sl_shared_assets/data_classes/session_data.pyi +527 -0
  13. sl_shared_assets/data_classes/surgery_data.py +152 -0
  14. sl_shared_assets/data_classes/surgery_data.pyi +89 -0
  15. sl_shared_assets/server/__init__.py +8 -0
  16. sl_shared_assets/server/__init__.pyi +8 -0
  17. sl_shared_assets/server/job.py +140 -0
  18. sl_shared_assets/server/job.pyi +94 -0
  19. sl_shared_assets/server/server.py +213 -0
  20. sl_shared_assets/server/server.pyi +95 -0
  21. sl_shared_assets/suite2p/__init__.py +8 -0
  22. sl_shared_assets/suite2p/__init__.pyi +4 -0
  23. sl_shared_assets/suite2p/multi_day.py +193 -0
  24. sl_shared_assets/suite2p/multi_day.pyi +99 -0
  25. sl_shared_assets/{suite2p.py → suite2p/single_day.py} +55 -32
  26. sl_shared_assets/suite2p/single_day.pyi +192 -0
  27. sl_shared_assets/tools/__init__.py +8 -0
  28. sl_shared_assets/tools/__init__.pyi +5 -0
  29. sl_shared_assets/{ascension_tools.py → tools/ascension_tools.py} +3 -6
  30. sl_shared_assets/tools/ascension_tools.pyi +68 -0
  31. sl_shared_assets/tools/packaging_tools.pyi +52 -0
  32. sl_shared_assets/tools/transfer_tools.pyi +53 -0
  33. {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/METADATA +1 -1
  34. sl_shared_assets-1.0.0rc15.dist-info/RECORD +40 -0
  35. sl_shared_assets/data_classes.py +0 -1656
  36. sl_shared_assets/server.py +0 -293
  37. sl_shared_assets-1.0.0rc13.dist-info/RECORD +0 -14
  38. /sl_shared_assets/{packaging_tools.py → tools/packaging_tools.py} +0 -0
  39. /sl_shared_assets/{transfer_tools.py → tools/transfer_tools.py} +0 -0
  40. {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/WHEEL +0 -0
  41. {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/entry_points.txt +0 -0
  42. {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,233 @@
1
+ """This module provides classes used to store the training and experiment data acquired by the sl-experiment library.
2
+ Some classes from this library store raw data later processed by Sun lab data processing pipelines. Others are used to
3
+ restore the Mesoscope-VR system to the same state across training or experiment sessions of the same animal.
4
+ """
5
+
6
+ from dataclasses import dataclass
7
+
8
+ from ataraxis_data_structures import YamlConfig
9
+
10
+
11
+ @dataclass()
12
+ class HardwareConfiguration(YamlConfig):
13
+ """This class is used to save the runtime hardware configuration parameters as a .yaml file.
14
+
15
+ This information is used to read and decode the data saved to the .npz log files during runtime as part of data
16
+ processing.
17
+
18
+ Notes:
19
+ All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
20
+ module that provides the data stored in a field will be processed, unless that field is None. Therefore, setting
21
+ any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
22
+ module that provides this field's information.
23
+
24
+ This class is automatically configured by MesoscopeExperiment and BehaviorTraining classes from sl-experiment
25
+ library to facilitate log parsing.
26
+ """
27
+
28
+ cue_map: dict[int, float] | None = None
29
+ """MesoscopeExperiment instance property. Stores the dictionary that maps the integer id-codes associated with each
30
+ wall cue in the Virtual Reality task environment with distances in real-world centimeters animals should run on the
31
+ wheel to fully traverse the cue region on a linearized track."""
32
+ cm_per_pulse: float | None = None
33
+ """EncoderInterface instance property. Stores the conversion factor used to translate encoder pulses into
34
+ real-world centimeters."""
35
+ maximum_break_strength: float | None = None
36
+ """BreakInterface instance property. Stores the breaking torque, in Newton centimeters, applied by the break to
37
+ the edge of the running wheel when it is engaged at 100% strength."""
38
+ minimum_break_strength: float | None = None
39
+ """BreakInterface instance property. Stores the breaking torque, in Newton centimeters, applied by the break to
40
+ the edge of the running wheel when it is engaged at 0% strength (completely disengaged)."""
41
+ lick_threshold: int | None = None
42
+ """LickInterface instance property. Determines the threshold, in 12-bit Analog to Digital Converter (ADC) units,
43
+ above which an interaction value reported by the lick sensor is considered a lick (compared to noise or non-lick
44
+ touch)."""
45
+ valve_scale_coefficient: float | None = None
46
+ """ValveInterface instance property. To dispense precise water volumes during runtime, ValveInterface uses power
47
+ law equation applied to valve calibration data to determine how long to keep the valve open. This stores the
48
+ scale_coefficient of the power law equation that describes the relationship between valve open time and dispensed
49
+ water volume, derived from calibration data."""
50
+ valve_nonlinearity_exponent: float | None = None
51
+ """ValveInterface instance property. To dispense precise water volumes during runtime, ValveInterface uses power
52
+ law equation applied to valve calibration data to determine how long to keep the valve open. This stores the
53
+ nonlinearity_exponent of the power law equation that describes the relationship between valve open time and
54
+ dispensed water volume, derived from calibration data."""
55
+ torque_per_adc_unit: float | None = None
56
+ """TorqueInterface instance property. Stores the conversion factor used to translate torque values reported by the
57
+ sensor as 12-bit Analog to Digital Converter (ADC) units, into real-world Newton centimeters (N·cm) of torque that
58
+ had to be applied to the edge of the running wheel to produce the observed ADC value."""
59
+ screens_initially_on: bool | None = None
60
+ """ScreenInterface instance property. Stores the initial state of the Virtual Reality screens at the beginning of
61
+ the session runtime."""
62
+ recorded_mesoscope_ttl: bool | None = None
63
+ """TTLInterface instance property. A boolean flag that determines whether the processed session recorded brain
64
+ activity data with the mesoscope."""
65
+
66
+
67
+ @dataclass()
68
+ class LickTrainingDescriptor(YamlConfig):
69
+ """This class is used to save the description information specific to lick training sessions as a .yaml file.
70
+
71
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
72
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
73
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
74
+
75
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
76
+ trained animal.
77
+ """
78
+
79
+ experimenter: str
80
+ """The ID of the experimenter running the session."""
81
+ mouse_weight_g: float
82
+ """The weight of the animal, in grams, at the beginning of the session."""
83
+ dispensed_water_volume_ml: float
84
+ """Stores the total water volume, in milliliters, dispensed during runtime."""
85
+ minimum_reward_delay: int
86
+ """Stores the minimum delay, in seconds, that can separate the delivery of two consecutive water rewards."""
87
+ maximum_reward_delay_s: int
88
+ """Stores the maximum delay, in seconds, that can separate the delivery of two consecutive water rewards."""
89
+ maximum_water_volume_ml: float
90
+ """Stores the maximum volume of water the system is allowed to dispense during training."""
91
+ maximum_training_time_m: int
92
+ """Stores the maximum time, in minutes, the system is allowed to run the training for."""
93
+ experimenter_notes: str = "Replace this with your notes."
94
+ """This field is not set during runtime. It is expected that each experimenter replaces this field with their
95
+ notes made during runtime."""
96
+ experimenter_given_water_volume_ml: float = 0.0
97
+ """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
98
+ """
99
+
100
+
101
+ @dataclass()
102
+ class RunTrainingDescriptor(YamlConfig):
103
+ """This class is used to save the description information specific to run training sessions as a .yaml file.
104
+
105
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
106
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
107
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
108
+
109
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
110
+ trained animal.
111
+ """
112
+
113
+ experimenter: str
114
+ """The ID of the experimenter running the session."""
115
+ mouse_weight_g: float
116
+ """The weight of the animal, in grams, at the beginning of the session."""
117
+ dispensed_water_volume_ml: float
118
+ """Stores the total water volume, in milliliters, dispensed during runtime."""
119
+ final_run_speed_threshold_cm_s: float
120
+ """Stores the final running speed threshold, in centimeters per second, that was active at the end of training."""
121
+ final_run_duration_threshold_s: float
122
+ """Stores the final running duration threshold, in seconds, that was active at the end of training."""
123
+ initial_run_speed_threshold_cm_s: float
124
+ """Stores the initial running speed threshold, in centimeters per second, used during training."""
125
+ initial_run_duration_threshold_s: float
126
+ """Stores the initial running duration threshold, in seconds, used during training."""
127
+ increase_threshold_ml: float
128
+ """Stores the volume of water delivered to the animal, in milliliters, that triggers the increase in the running
129
+ speed and duration thresholds."""
130
+ run_speed_increase_step_cm_s: float
131
+ """Stores the value, in centimeters per second, used by the system to increment the running speed threshold each
132
+ time the animal receives 'increase_threshold' volume of water."""
133
+ run_duration_increase_step_s: float
134
+ """Stores the value, in seconds, used by the system to increment the duration threshold each time the animal
135
+ receives 'increase_threshold' volume of water."""
136
+ maximum_water_volume_ml: float
137
+ """Stores the maximum volume of water the system is allowed to dispense during training."""
138
+ maximum_training_time_m: int
139
+ """Stores the maximum time, in minutes, the system is allowed to run the training for."""
140
+ experimenter_notes: str = "Replace this with your notes."
141
+ """This field is not set during runtime. It is expected that each experimenter will replace this field with their
142
+ notes made during runtime."""
143
+ experimenter_given_water_volume_ml: float = 0.0
144
+ """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
145
+ """
146
+
147
+
148
+ @dataclass()
149
+ class MesoscopeExperimentDescriptor(YamlConfig):
150
+ """This class is used to save the description information specific to experiment sessions as a .yaml file.
151
+
152
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
153
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
154
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
155
+
156
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
157
+ animal participating in the experiment runtime.
158
+ """
159
+
160
+ experimenter: str
161
+ """The ID of the experimenter running the session."""
162
+ mouse_weight_g: float
163
+ """The weight of the animal, in grams, at the beginning of the session."""
164
+ dispensed_water_volume_ml: float
165
+ """Stores the total water volume, in milliliters, dispensed during runtime."""
166
+ experimenter_notes: str = "Replace this with your notes."
167
+ """This field is not set during runtime. It is expected that each experimenter will replace this field with their
168
+ notes made during runtime."""
169
+ experimenter_given_water_volume_ml: float = 0.0
170
+ """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
171
+ """
172
+
173
+
174
+ @dataclass()
175
+ class ZaberPositions(YamlConfig):
176
+ """This class is used to save Zaber motor positions as a .yaml file to reuse them between sessions.
177
+
178
+ The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
179
+ (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
180
+ Zaber motor positions across consecutive runtimes for the same project and animal combination.
181
+
182
+ Notes:
183
+ All positions are saved using native motor units. All class fields initialize to default placeholders that are
184
+ likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
185
+ certain they are safe to use.
186
+
187
+ Exercise caution when working with Zaber motors. The motors are powerful enough to damage the surrounding
188
+ equipment and manipulated objects. Do not modify the data stored inside the .yaml file unless you know what you
189
+ are doing.
190
+ """
191
+
192
+ headbar_z: int = 0
193
+ """The absolute position, in native motor units, of the HeadBar z-axis motor."""
194
+ headbar_pitch: int = 0
195
+ """The absolute position, in native motor units, of the HeadBar pitch-axis motor."""
196
+ headbar_roll: int = 0
197
+ """The absolute position, in native motor units, of the HeadBar roll-axis motor."""
198
+ lickport_z: int = 0
199
+ """The absolute position, in native motor units, of the LickPort z-axis motor."""
200
+ lickport_x: int = 0
201
+ """The absolute position, in native motor units, of the LickPort x-axis motor."""
202
+ lickport_y: int = 0
203
+ """The absolute position, in native motor units, of the LickPort y-axis motor."""
204
+
205
+
206
+ @dataclass()
207
+ class MesoscopePositions(YamlConfig):
208
+ """This class is used to save the real and virtual Mesoscope objective positions as a .yaml file to reuse it
209
+ between experiment sessions.
210
+
211
+ Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
212
+ multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
213
+ X, Y, Z, and Roll axes and the virtual (ScanImage software) tip, tilt, and fastZ focus axes.
214
+
215
+ Notes:
216
+ Since the API to read and write these positions automatically is currently not available, this class relies on
217
+ the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
218
+ """
219
+
220
+ mesoscope_x_position: float = 0.0
221
+ """The X-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
222
+ mesoscope_y_position: float = 0.0
223
+ """The Y-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
224
+ mesoscope_roll_position: float = 0.0
225
+ """The Roll-axis position, in degrees, of the Mesoscope objective used during session runtime."""
226
+ mesoscope_z_position: float = 0.0
227
+ """The Z-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
228
+ mesoscope_fast_z_position: float = 0.0
229
+ """The Fast-Z-axis position, in micrometers, of the Mesoscope objective used during session runtime."""
230
+ mesoscope_tip_position: float = 0.0
231
+ """The Tilt-axis position, in degrees, of the Mesoscope objective used during session runtime."""
232
+ mesoscope_tilt_position: float = 0.0
233
+ """The Tip-axis position, in degrees, of the Mesoscope objective used during session runtime."""
@@ -0,0 +1,145 @@
1
+ from dataclasses import dataclass
2
+
3
+ from ataraxis_data_structures import YamlConfig
4
+
5
+ @dataclass()
6
+ class HardwareConfiguration(YamlConfig):
7
+ """This class is used to save the runtime hardware configuration parameters as a .yaml file.
8
+
9
+ This information is used to read and decode the data saved to the .npz log files during runtime as part of data
10
+ processing.
11
+
12
+ Notes:
13
+ All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
14
+ module that provides the data stored in a field will be processed, unless that field is None. Therefore, setting
15
+ any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
16
+ module that provides this field's information.
17
+
18
+ This class is automatically configured by MesoscopeExperiment and BehaviorTraining classes from sl-experiment
19
+ library to facilitate log parsing.
20
+ """
21
+
22
+ cue_map: dict[int, float] | None = ...
23
+ cm_per_pulse: float | None = ...
24
+ maximum_break_strength: float | None = ...
25
+ minimum_break_strength: float | None = ...
26
+ lick_threshold: int | None = ...
27
+ valve_scale_coefficient: float | None = ...
28
+ valve_nonlinearity_exponent: float | None = ...
29
+ torque_per_adc_unit: float | None = ...
30
+ screens_initially_on: bool | None = ...
31
+ recorded_mesoscope_ttl: bool | None = ...
32
+
33
+ @dataclass()
34
+ class LickTrainingDescriptor(YamlConfig):
35
+ """This class is used to save the description information specific to lick training sessions as a .yaml file.
36
+
37
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
38
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
39
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
40
+
41
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
42
+ trained animal.
43
+ """
44
+
45
+ experimenter: str
46
+ mouse_weight_g: float
47
+ dispensed_water_volume_ml: float
48
+ minimum_reward_delay: int
49
+ maximum_reward_delay_s: int
50
+ maximum_water_volume_ml: float
51
+ maximum_training_time_m: int
52
+ experimenter_notes: str = ...
53
+ experimenter_given_water_volume_ml: float = ...
54
+
55
+ @dataclass()
56
+ class RunTrainingDescriptor(YamlConfig):
57
+ """This class is used to save the description information specific to run training sessions as a .yaml file.
58
+
59
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
60
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
61
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
62
+
63
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
64
+ trained animal.
65
+ """
66
+
67
+ experimenter: str
68
+ mouse_weight_g: float
69
+ dispensed_water_volume_ml: float
70
+ final_run_speed_threshold_cm_s: float
71
+ final_run_duration_threshold_s: float
72
+ initial_run_speed_threshold_cm_s: float
73
+ initial_run_duration_threshold_s: float
74
+ increase_threshold_ml: float
75
+ run_speed_increase_step_cm_s: float
76
+ run_duration_increase_step_s: float
77
+ maximum_water_volume_ml: float
78
+ maximum_training_time_m: int
79
+ experimenter_notes: str = ...
80
+ experimenter_given_water_volume_ml: float = ...
81
+
82
+ @dataclass()
83
+ class MesoscopeExperimentDescriptor(YamlConfig):
84
+ """This class is used to save the description information specific to experiment sessions as a .yaml file.
85
+
86
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
87
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
88
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
89
+
90
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
91
+ animal participating in the experiment runtime.
92
+ """
93
+
94
+ experimenter: str
95
+ mouse_weight_g: float
96
+ dispensed_water_volume_ml: float
97
+ experimenter_notes: str = ...
98
+ experimenter_given_water_volume_ml: float = ...
99
+
100
+ @dataclass()
101
+ class ZaberPositions(YamlConfig):
102
+ """This class is used to save Zaber motor positions as a .yaml file to reuse them between sessions.
103
+
104
+ The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
105
+ (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
106
+ Zaber motor positions across consecutive runtimes for the same project and animal combination.
107
+
108
+ Notes:
109
+ All positions are saved using native motor units. All class fields initialize to default placeholders that are
110
+ likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
111
+ certain they are safe to use.
112
+
113
+ Exercise caution when working with Zaber motors. The motors are powerful enough to damage the surrounding
114
+ equipment and manipulated objects. Do not modify the data stored inside the .yaml file unless you know what you
115
+ are doing.
116
+ """
117
+
118
+ headbar_z: int = ...
119
+ headbar_pitch: int = ...
120
+ headbar_roll: int = ...
121
+ lickport_z: int = ...
122
+ lickport_x: int = ...
123
+ lickport_y: int = ...
124
+
125
+ @dataclass()
126
+ class MesoscopePositions(YamlConfig):
127
+ """This class is used to save the real and virtual Mesoscope objective positions as a .yaml file to reuse it
128
+ between experiment sessions.
129
+
130
+ Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
131
+ multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
132
+ X, Y, Z, and Roll axes and the virtual (ScanImage software) tip, tilt, and fastZ focus axes.
133
+
134
+ Notes:
135
+ Since the API to read and write these positions automatically is currently not available, this class relies on
136
+ the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
137
+ """
138
+
139
+ mesoscope_x_position: float = ...
140
+ mesoscope_y_position: float = ...
141
+ mesoscope_roll_position: float = ...
142
+ mesoscope_z_position: float = ...
143
+ mesoscope_fast_z_position: float = ...
144
+ mesoscope_tip_position: float = ...
145
+ mesoscope_tilt_position: float = ...