sl-shared-assets 1.0.0rc20__py3-none-any.whl → 1.0.0rc22__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 (35) hide show
  1. sl_shared_assets/__init__.py +27 -27
  2. sl_shared_assets/__init__.pyi +24 -22
  3. sl_shared_assets/cli.py +266 -40
  4. sl_shared_assets/cli.pyi +73 -14
  5. sl_shared_assets/data_classes/__init__.py +23 -20
  6. sl_shared_assets/data_classes/__init__.pyi +18 -18
  7. sl_shared_assets/data_classes/configuration_data.py +408 -26
  8. sl_shared_assets/data_classes/configuration_data.pyi +173 -15
  9. sl_shared_assets/data_classes/runtime_data.py +49 -43
  10. sl_shared_assets/data_classes/runtime_data.pyi +37 -40
  11. sl_shared_assets/data_classes/session_data.py +168 -914
  12. sl_shared_assets/data_classes/session_data.pyi +55 -350
  13. sl_shared_assets/data_classes/surgery_data.py +3 -3
  14. sl_shared_assets/data_classes/surgery_data.pyi +2 -2
  15. sl_shared_assets/tools/__init__.py +8 -1
  16. sl_shared_assets/tools/__init__.pyi +11 -1
  17. sl_shared_assets/tools/ascension_tools.py +27 -26
  18. sl_shared_assets/tools/ascension_tools.pyi +5 -5
  19. sl_shared_assets/tools/packaging_tools.py +14 -1
  20. sl_shared_assets/tools/packaging_tools.pyi +4 -0
  21. sl_shared_assets/tools/project_management_tools.py +164 -0
  22. sl_shared_assets/tools/project_management_tools.pyi +48 -0
  23. {sl_shared_assets-1.0.0rc20.dist-info → sl_shared_assets-1.0.0rc22.dist-info}/METADATA +21 -4
  24. sl_shared_assets-1.0.0rc22.dist-info/RECORD +36 -0
  25. sl_shared_assets-1.0.0rc22.dist-info/entry_points.txt +8 -0
  26. sl_shared_assets/suite2p/__init__.py +0 -8
  27. sl_shared_assets/suite2p/__init__.pyi +0 -4
  28. sl_shared_assets/suite2p/multi_day.py +0 -224
  29. sl_shared_assets/suite2p/multi_day.pyi +0 -104
  30. sl_shared_assets/suite2p/single_day.py +0 -564
  31. sl_shared_assets/suite2p/single_day.pyi +0 -220
  32. sl_shared_assets-1.0.0rc20.dist-info/RECORD +0 -40
  33. sl_shared_assets-1.0.0rc20.dist-info/entry_points.txt +0 -4
  34. {sl_shared_assets-1.0.0rc20.dist-info → sl_shared_assets-1.0.0rc22.dist-info}/WHEEL +0 -0
  35. {sl_shared_assets-1.0.0rc20.dist-info → sl_shared_assets-1.0.0rc22.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- from pathlib import Path as Path
1
+ from pathlib import Path
2
2
  from dataclasses import field, dataclass
3
3
 
4
4
  from _typeshed import Incomplete
@@ -6,32 +6,190 @@ from ataraxis_data_structures import YamlConfig
6
6
 
7
7
  @dataclass()
8
8
  class ExperimentState:
9
- """Encapsulates the information used to set and maintain the desired experiment and Mesoscope-VR system state.
9
+ """Encapsulates the information used to set and maintain the desired experiment and system state.
10
10
 
11
- Primarily, experiment runtime logic (task logic) is resolved by the Unity game engine. However, the Mesoscope-VR
12
- system configuration may also need to change throughout the experiment to optimize the runtime by disabling or
13
- reconfiguring specific hardware modules. For example, some experiment stages may require the running wheel to be
14
- locked to prevent the animal from running, and other may require the VR screens to be turned off.
11
+ Broadly, each experiment runtime can be conceptualized as a two state-system. The first state is that of the
12
+ experimental task, which reflects the behavior goal, the rules for achieving the goal, and the reward for
13
+ achieving the goal. The second state is that of the data acquisition and experiment control system, which is a
14
+ snapshot of all hardware module states that make up the system that acquires the data and controls the task
15
+ environment. Overall, experiment state is about 'what the animal is doing', while the system state is about
16
+ 'what the hardware is doing'.
17
+
18
+ Note:
19
+ This class is acquisition-system-agnostic. It can be used to define the ExperimentConfiguration class for any
20
+ valid data acquisition system.
15
21
  """
16
22
 
17
23
  experiment_state_code: int
18
- vr_state_code: int
24
+ system_state_code: int
19
25
  state_duration_s: float
20
26
 
21
27
  @dataclass()
22
- class ExperimentConfiguration(YamlConfig):
23
- """Stores the configuration of a single experiment runtime.
28
+ class MesoscopeExperimentConfiguration(YamlConfig):
29
+ """Stores the configuration of a single experiment runtime that uses the Mesoscope_VR data acquisition system.
24
30
 
25
- Primarily, this includes the sequence of experiment and Virtual Reality (Mesoscope-VR) states that defines the flow
26
- of the experiment runtime. During runtime, the main runtime control function traverses the sequence of states
27
- stored in this class instance start-to-end in the exact order specified by the user. Together with custom Unity
28
- projects that define the task logic (how the system responds to animal interactions with the VR system) this class
29
- allows flexibly implementing a wide range of experiments.
31
+ Primarily, this includes the sequence of experiment and system states that defines the flow of the experiment
32
+ runtime. During runtime, the main runtime control function traverses the sequence of states stored in this class
33
+ instance start-to-end in the exact order specified by the user. Together with custom Unity projects that define
34
+ the task logic (how the system responds to animal interactions with the VR system) this class allows flexibly
35
+ implementing a wide range of experiments using the Mesoscope-VR system.
30
36
 
31
37
  Each project should define one or more experiment configurations and save them as .yaml files inside the project
32
38
  'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
33
- the experiment configuration when 'sl-run-experiment' CLI command exposed by the sl-experiment library is executed.
39
+ the experiment configuration when 'sl-experiment' CLI command exposed by the sl-experiment library is executed.
40
+
41
+ Notes:
42
+ This class is designed exclusively for the Mesoscope-VR system. Any other system needs to define a separate
43
+ ExperimentConfiguration class to specify its experiment runtimes and additional data.
34
44
  """
35
45
 
36
46
  cue_map: dict[int, float] = field(default_factory=Incomplete)
37
47
  experiment_states: dict[str, ExperimentState] = field(default_factory=Incomplete)
48
+
49
+ @dataclass()
50
+ class MesoscopePaths:
51
+ """Stores the filesystem configuration parameters for the Mesoscope-VR data acquisition system."""
52
+
53
+ server_credentials_path: Path = ...
54
+ google_credentials_path: Path = ...
55
+ root_directory: Path = ...
56
+ server_storage_directory: Path = ...
57
+ server_working_directory: Path = ...
58
+ nas_directory: Path = ...
59
+ mesoscope_directory: Path = ...
60
+ harvesters_cti_path: Path = ...
61
+
62
+ @dataclass()
63
+ class MesoscopeCameras:
64
+ """Stores the configuration parameters for the cameras used by the Mesoscope-VR system to record behavior videos."""
65
+
66
+ face_camera_index: int = ...
67
+ left_camera_index: int = ...
68
+ right_camera_index: int = ...
69
+ quantization_parameter: int = ...
70
+
71
+ @dataclass()
72
+ class MesoscopeMicroControllers:
73
+ """Stores the configuration parameters for the microcontrollers used by the Mesoscope-VR system."""
74
+
75
+ actor_port: str = ...
76
+ sensor_port: str = ...
77
+ encoder_port: str = ...
78
+ mesoscope_start_ttl_module_id: int = ...
79
+ mesoscope_stop_ttl_module_id: int = ...
80
+ mesoscope_ttl_pulse_duration_ms: int = ...
81
+ minimum_break_strength_g_cm: float = ...
82
+ maximum_break_strength_g_cm: float = ...
83
+ wheel_diameter_cm: float = ...
84
+ lick_threshold_adc: int = ...
85
+ lick_signal_threshold_adc: int = ...
86
+ lick_delta_threshold_adc: int = ...
87
+ lick_averaging_pool_size: int = ...
88
+ torque_baseline_voltage_adc: int = ...
89
+ torque_maximum_voltage_adc: int = ...
90
+ torque_sensor_capacity_g_cm: float = ...
91
+ torque_report_cw: bool = ...
92
+ torque_report_ccw: bool = ...
93
+ torque_signal_threshold_adc: int = ...
94
+ torque_delta_threshold_adc: int = ...
95
+ torque_averaging_pool_size: int = ...
96
+ wheel_encoder_ppr = ...
97
+ wheel_encoder_report_cw: bool = ...
98
+ wheel_encoder_report_ccw: bool = ...
99
+ wheel_encoder_delta_threshold_pulse: int = ...
100
+ wheel_encoder_polling_delay_us = ...
101
+ cm_per_unity_unit = ...
102
+ screen_trigger_pulse_duration_ms: int = ...
103
+ auditory_tone_duration_ms: int = ...
104
+ valve_calibration_pulse_count: int = ...
105
+ sensor_polling_delay_ms: int = ...
106
+ valve_calibration_data: dict[int | float, int | float] | tuple[tuple[int | float, int | float], ...] = ...
107
+
108
+ @dataclass()
109
+ class MesoscopeAdditionalFirmware:
110
+ """Stores the configuration parameters for all firmware and hardware components not assembled in the Sun lab."""
111
+
112
+ headbar_port: str = ...
113
+ lickport_port: str = ...
114
+ wheel_port: str = ...
115
+ unity_ip: str = ...
116
+ unity_port: int = ...
117
+
118
+ @dataclass()
119
+ class MesoscopeSystemConfiguration(YamlConfig):
120
+ """Stores the hardware and filesystem configuration parameters for the Mesoscope-VR data acquisition system used in
121
+ the Sun lab.
122
+
123
+ This class is specifically designed to encapsulate the configuration parameters for the Mesoscope-VR system. It
124
+ expects the system to be configured according to the specifications available from the sl_experiment repository
125
+ (https://github.com/Sun-Lab-NBB/sl-experiment) and should be used exclusively by the VRPC machine
126
+ (main Mesoscope-VR PC).
127
+
128
+ Notes:
129
+ Each SystemConfiguration class is uniquely tied to a specific hardware configuration used in the lab. This
130
+ class will only work with the Mesoscope-VR system. Any other data acquisition and runtime management system in
131
+ the lab should define its own SystemConfiguration class to specify its own hardware and filesystem configuration
132
+ parameters.
133
+ """
134
+
135
+ name: str = ...
136
+ paths: MesoscopePaths = field(default_factory=MesoscopePaths)
137
+ cameras: MesoscopeCameras = field(default_factory=MesoscopeCameras)
138
+ microcontrollers: MesoscopeMicroControllers = field(default_factory=MesoscopeMicroControllers)
139
+ additional_firmware: MesoscopeAdditionalFirmware = field(default_factory=MesoscopeAdditionalFirmware)
140
+ def __post_init__(self) -> None:
141
+ """Ensures that variables converted to different types for storage purposes are always set to expected types
142
+ upon class instantiation."""
143
+ def save(self, path: Path) -> None:
144
+ """Saves class instance data to disk as a 'mesoscope_system_configuration.yaml' file.
145
+
146
+ This method converts certain class variables to yaml-safe types (for example, Path objects -> strings) and
147
+ saves class data to disk as a .yaml file. The method is intended to be used solely by the
148
+ set_system_configuration_file() function and should not be called from any other context.
149
+
150
+ Args:
151
+ path: The path to the .yaml file to save the data to.
152
+ """
153
+
154
+ _supported_configuration_files: Incomplete
155
+
156
+ def set_system_configuration_file(path: Path) -> None:
157
+ """Sets the system configuration .yaml file specified by the input path as the default system configuration file for
158
+ the managed machine (PC).
159
+
160
+ This function is used to initially configure or override the existing configuration of any data acquisition system
161
+ used in the lab. The path to the configuration file is stored inside the user's data directory, so that all
162
+ Sun lab libraries can automatically access that information during every runtime. Since the storage directory is
163
+ typically hidden and varies between OSes and machines, this function provides a convenient way for setting that
164
+ path without manually editing the storage cache.
165
+
166
+ Notes:
167
+ If the input path does not point to an existing file, but the file name and extension are correct, the function
168
+ will automatically generate a default SystemConfiguration class instance and save it under the specified path.
169
+
170
+ A data acquisition system can include multiple machines (PCs). However, the configuration file is typically
171
+ only present on the 'main' machine that manages all runtimes.
172
+
173
+ Args:
174
+ path: The path to the new system configuration file to be used by the local data acquisition system (PC).
175
+
176
+ Raises:
177
+ ValueError: If the input path is not a valid system configuration file or does not use a supported data
178
+ acquisition system name.
179
+ """
180
+
181
+ def get_system_configuration_data() -> MesoscopeSystemConfiguration:
182
+ """Resolves the path to the local system configuration file and loads the system configuration data.
183
+
184
+ This service function is used by all Sun lab data acquisition runtimes to load the system configuration data from
185
+ the shared configuration file. It supports resolving and returning the data for all data acquisition systems used
186
+ in the lab.
187
+
188
+ Returns:
189
+ The initialized SystemConfiguration class instance for the local acquisition system that stores the loaded
190
+ configuration parameters.
191
+
192
+ Raises:
193
+ FileNotFoundError: If the local machine does not have the Sun lab data directory, or the system configuration
194
+ file does not exist.
195
+ """
@@ -1,6 +1,7 @@
1
1
  """This module provides classes used to store the training and experiment data acquired by the sl-experiment library.
2
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.
3
+ restore the data acquisition and runtime management system to the same state across training or experiment sessions for
4
+ the same animal.
4
5
  """
5
6
 
6
7
  from dataclasses import dataclass
@@ -9,19 +10,32 @@ from ataraxis_data_structures import YamlConfig
9
10
 
10
11
 
11
12
  @dataclass()
12
- class HardwareConfiguration(YamlConfig):
13
- """This class is used to save the runtime hardware configuration parameters as a .yaml file.
13
+ class MesoscopeHardwareState(YamlConfig):
14
+ """Stores configuration parameters (states) of the Mesoscope-VR system hardware modules used during training or
15
+ experiment runtime.
14
16
 
15
17
  This information is used to read and decode the data saved to the .npz log files during runtime as part of data
16
18
  processing.
17
19
 
20
+ Notes:
21
+ This class stores 'static' Mesoscope-VR system configuration that does not change during experiment or training
22
+ session runtime. This is in contrast to MesoscopeExperimentState class, which reflects the 'dynamic' state of
23
+ the Mesoscope-VR system.
24
+
25
+ This class partially overlaps with the MesoscopeSystemConfiguration class, which is also stored in the
26
+ raw_data folder of each session. The primary reason to keep both classes is to ensure that the math (rounding)
27
+ used during runtime matches the math (rounding) used during data processing. MesoscopeSystemConfiguration does
28
+ not do any rounding or otherwise attempt to be repeatable, which is in contrast to hardware module that read
29
+ those parameters. Reading values from this class guarantees the read value exactly matches the value used
30
+ during runtime.
31
+
18
32
  Notes:
19
33
  All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
20
34
  module that provides the data stored in a field will be processed, unless that field is None. Therefore, setting
21
35
  any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
22
36
  module that provides this field's information.
23
37
 
24
- This class is automatically configured by MesoscopeExperiment and BehaviorTraining classes from sl-experiment
38
+ This class is automatically configured by _MesoscopeExperiment and _BehaviorTraining classes from sl-experiment
25
39
  library to facilitate log parsing.
26
40
  """
27
41
 
@@ -66,15 +80,7 @@ class HardwareConfiguration(YamlConfig):
66
80
 
67
81
  @dataclass()
68
82
  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
- """
83
+ """Stores the task and outcome information specific to lick training sessions that use the Mesoscope-VR system."""
78
84
 
79
85
  experimenter: str
80
86
  """The ID of the experimenter running the session."""
@@ -90,7 +96,7 @@ class LickTrainingDescriptor(YamlConfig):
90
96
  """Stores the maximum volume of water the system is allowed to dispense during training."""
91
97
  maximum_training_time_m: int
92
98
  """Stores the maximum time, in minutes, the system is allowed to run the training for."""
93
- maximum_unconsumed_rewards: int = 3
99
+ maximum_unconsumed_rewards: int = 1
94
100
  """Stores the maximum number of consecutive rewards that can be delivered without the animal consuming them. If
95
101
  the animal receives this many rewards without licking (consuming) them, reward delivery is paused until the animal
96
102
  consumes the rewards."""
@@ -100,19 +106,14 @@ class LickTrainingDescriptor(YamlConfig):
100
106
  experimenter_given_water_volume_ml: float = 0.0
101
107
  """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
102
108
  """
109
+ incomplete: bool = False
110
+ """If this field is set to True, the session is marked as 'incomplete' and automatically excluded from all further
111
+ Sun lab automated processing and analysis."""
103
112
 
104
113
 
105
114
  @dataclass()
106
115
  class RunTrainingDescriptor(YamlConfig):
107
- """This class is used to save the description information specific to run training sessions as a .yaml file.
108
-
109
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
110
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
111
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
112
-
113
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
114
- trained animal.
115
- """
116
+ """Stores the task and outcome information specific to run training sessions that use the Mesoscope-VR system."""
116
117
 
117
118
  experimenter: str
118
119
  """The ID of the experimenter running the session."""
@@ -141,7 +142,7 @@ class RunTrainingDescriptor(YamlConfig):
141
142
  """Stores the maximum volume of water the system is allowed to dispense during training."""
142
143
  maximum_training_time_m: int
143
144
  """Stores the maximum time, in minutes, the system is allowed to run the training for."""
144
- maximum_unconsumed_rewards: int = 3
145
+ maximum_unconsumed_rewards: int = 1
145
146
  """Stores the maximum number of consecutive rewards that can be delivered without the animal consuming them. If
146
147
  the animal receives this many rewards without licking (consuming) them, reward delivery is paused until the animal
147
148
  consumes the rewards."""
@@ -155,19 +156,14 @@ class RunTrainingDescriptor(YamlConfig):
155
156
  experimenter_given_water_volume_ml: float = 0.0
156
157
  """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
157
158
  """
159
+ incomplete: bool = False
160
+ """If this field is set to True, the session is marked as 'incomplete' and automatically excluded from all further
161
+ Sun lab automated processing and analysis."""
158
162
 
159
163
 
160
164
  @dataclass()
161
165
  class MesoscopeExperimentDescriptor(YamlConfig):
162
- """This class is used to save the description information specific to experiment sessions as a .yaml file.
163
-
164
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
165
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
166
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
167
-
168
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
169
- animal participating in the experiment runtime.
170
- """
166
+ """Stores the task and outcome information specific to experiment sessions that use the Mesoscope-VR system."""
171
167
 
172
168
  experimenter: str
173
169
  """The ID of the experimenter running the session."""
@@ -181,17 +177,24 @@ class MesoscopeExperimentDescriptor(YamlConfig):
181
177
  experimenter_given_water_volume_ml: float = 0.0
182
178
  """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
183
179
  """
180
+ incomplete: bool = False
181
+ """If this field is set to True, the session is marked as 'incomplete' and automatically excluded from all further
182
+ Sun lab automated processing and analysis."""
184
183
 
185
184
 
186
185
  @dataclass()
187
186
  class ZaberPositions(YamlConfig):
188
- """This class is used to save Zaber motor positions as a .yaml file to reuse them between sessions.
187
+ """Stores Zaber motor positions reused between experiment sessions that use the Mesoscope-VR system.
189
188
 
190
189
  The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
191
190
  (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
192
191
  Zaber motor positions across consecutive runtimes for the same project and animal combination.
193
192
 
194
193
  Notes:
194
+ The HeadBar axis (connection) also manages the motor that moves the running wheel along the x-axis. While the
195
+ motor itself is not part of the HeadBar assembly, it is related to positioning the mouse in the VR system. This
196
+ is in contrast to the LickPort group, which is related to positioning the lick tube relative to the mouse.
197
+
195
198
  All positions are saved using native motor units. All class fields initialize to default placeholders that are
196
199
  likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
197
200
  certain they are safe to use.
@@ -207,6 +210,9 @@ class ZaberPositions(YamlConfig):
207
210
  """The absolute position, in native motor units, of the HeadBar pitch-axis motor."""
208
211
  headbar_roll: int = 0
209
212
  """The absolute position, in native motor units, of the HeadBar roll-axis motor."""
213
+ wheel_x: int = 0
214
+ """The absolute position, in native motor units, of the running wheel platform x-axis motor. Although this motor is
215
+ not itself part of the HeadBar assembly, it is controlled through the HeadBar controller port."""
210
216
  lickport_z: int = 0
211
217
  """The absolute position, in native motor units, of the LickPort z-axis motor."""
212
218
  lickport_x: int = 0
@@ -217,8 +223,8 @@ class ZaberPositions(YamlConfig):
217
223
 
218
224
  @dataclass()
219
225
  class MesoscopePositions(YamlConfig):
220
- """This class is used to save the real and virtual Mesoscope objective positions as a .yaml file to reuse it
221
- between experiment sessions.
226
+ """Stores real and virtual Mesoscope objective positions reused between experiment sessions that use the
227
+ Mesoscope-VR system.
222
228
 
223
229
  Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
224
230
  multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
@@ -229,17 +235,17 @@ class MesoscopePositions(YamlConfig):
229
235
  the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
230
236
  """
231
237
 
232
- mesoscope_x_position: float = 0.0
238
+ mesoscope_x: float = 0.0
233
239
  """The X-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
234
- mesoscope_y_position: float = 0.0
240
+ mesoscope_y: float = 0.0
235
241
  """The Y-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
236
- mesoscope_roll_position: float = 0.0
242
+ mesoscope_roll: float = 0.0
237
243
  """The Roll-axis position, in degrees, of the Mesoscope objective used during session runtime."""
238
- mesoscope_z_position: float = 0.0
244
+ mesoscope_z: float = 0.0
239
245
  """The Z-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
240
- mesoscope_fast_z_position: float = 0.0
246
+ mesoscope_fast_z: float = 0.0
241
247
  """The Fast-Z-axis position, in micrometers, of the Mesoscope objective used during session runtime."""
242
- mesoscope_tip_position: float = 0.0
248
+ mesoscope_tip: float = 0.0
243
249
  """The Tilt-axis position, in degrees, of the Mesoscope objective used during session runtime."""
244
- mesoscope_tilt_position: float = 0.0
250
+ mesoscope_tilt: float = 0.0
245
251
  """The Tip-axis position, in degrees, of the Mesoscope objective used during session runtime."""
@@ -3,19 +3,32 @@ from dataclasses import dataclass
3
3
  from ataraxis_data_structures import YamlConfig
4
4
 
5
5
  @dataclass()
6
- class HardwareConfiguration(YamlConfig):
7
- """This class is used to save the runtime hardware configuration parameters as a .yaml file.
6
+ class MesoscopeHardwareState(YamlConfig):
7
+ """Stores configuration parameters (states) of the Mesoscope-VR system hardware modules used during training or
8
+ experiment runtime.
8
9
 
9
10
  This information is used to read and decode the data saved to the .npz log files during runtime as part of data
10
11
  processing.
11
12
 
13
+ Notes:
14
+ This class stores 'static' Mesoscope-VR system configuration that does not change during experiment or training
15
+ session runtime. This is in contrast to MesoscopeExperimentState class, which reflects the 'dynamic' state of
16
+ the Mesoscope-VR system.
17
+
18
+ This class partially overlaps with the MesoscopeSystemConfiguration class, which is also stored in the
19
+ raw_data folder of each session. The primary reason to keep both classes is to ensure that the math (rounding)
20
+ used during runtime matches the math (rounding) used during data processing. MesoscopeSystemConfiguration does
21
+ not do any rounding or otherwise attempt to be repeatable, which is in contrast to hardware module that read
22
+ those parameters. Reading values from this class guarantees the read value exactly matches the value used
23
+ during runtime.
24
+
12
25
  Notes:
13
26
  All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
14
27
  module that provides the data stored in a field will be processed, unless that field is None. Therefore, setting
15
28
  any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
16
29
  module that provides this field's information.
17
30
 
18
- This class is automatically configured by MesoscopeExperiment and BehaviorTraining classes from sl-experiment
31
+ This class is automatically configured by _MesoscopeExperiment and _BehaviorTraining classes from sl-experiment
19
32
  library to facilitate log parsing.
20
33
  """
21
34
 
@@ -32,15 +45,7 @@ class HardwareConfiguration(YamlConfig):
32
45
 
33
46
  @dataclass()
34
47
  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
- """
48
+ """Stores the task and outcome information specific to lick training sessions that use the Mesoscope-VR system."""
44
49
 
45
50
  experimenter: str
46
51
  mouse_weight_g: float
@@ -52,18 +57,11 @@ class LickTrainingDescriptor(YamlConfig):
52
57
  maximum_unconsumed_rewards: int = ...
53
58
  experimenter_notes: str = ...
54
59
  experimenter_given_water_volume_ml: float = ...
60
+ incomplete: bool = ...
55
61
 
56
62
  @dataclass()
57
63
  class RunTrainingDescriptor(YamlConfig):
58
- """This class is used to save the description information specific to run training sessions as a .yaml file.
59
-
60
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
61
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
62
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
63
-
64
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
65
- trained animal.
66
- """
64
+ """Stores the task and outcome information specific to run training sessions that use the Mesoscope-VR system."""
67
65
 
68
66
  experimenter: str
69
67
  mouse_weight_g: float
@@ -81,34 +79,32 @@ class RunTrainingDescriptor(YamlConfig):
81
79
  maximum_idle_time_s: float = ...
82
80
  experimenter_notes: str = ...
83
81
  experimenter_given_water_volume_ml: float = ...
82
+ incomplete: bool = ...
84
83
 
85
84
  @dataclass()
86
85
  class MesoscopeExperimentDescriptor(YamlConfig):
87
- """This class is used to save the description information specific to experiment sessions as a .yaml file.
88
-
89
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
90
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
91
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
92
-
93
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
94
- animal participating in the experiment runtime.
95
- """
86
+ """Stores the task and outcome information specific to experiment sessions that use the Mesoscope-VR system."""
96
87
 
97
88
  experimenter: str
98
89
  mouse_weight_g: float
99
90
  dispensed_water_volume_ml: float
100
91
  experimenter_notes: str = ...
101
92
  experimenter_given_water_volume_ml: float = ...
93
+ incomplete: bool = ...
102
94
 
103
95
  @dataclass()
104
96
  class ZaberPositions(YamlConfig):
105
- """This class is used to save Zaber motor positions as a .yaml file to reuse them between sessions.
97
+ """Stores Zaber motor positions reused between experiment sessions that use the Mesoscope-VR system.
106
98
 
107
99
  The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
108
100
  (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
109
101
  Zaber motor positions across consecutive runtimes for the same project and animal combination.
110
102
 
111
103
  Notes:
104
+ The HeadBar axis (connection) also manages the motor that moves the running wheel along the x-axis. While the
105
+ motor itself is not part of the HeadBar assembly, it is related to positioning the mouse in the VR system. This
106
+ is in contrast to the LickPort group, which is related to positioning the lick tube relative to the mouse.
107
+
112
108
  All positions are saved using native motor units. All class fields initialize to default placeholders that are
113
109
  likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
114
110
  certain they are safe to use.
@@ -121,14 +117,15 @@ class ZaberPositions(YamlConfig):
121
117
  headbar_z: int = ...
122
118
  headbar_pitch: int = ...
123
119
  headbar_roll: int = ...
120
+ wheel_x: int = ...
124
121
  lickport_z: int = ...
125
122
  lickport_x: int = ...
126
123
  lickport_y: int = ...
127
124
 
128
125
  @dataclass()
129
126
  class MesoscopePositions(YamlConfig):
130
- """This class is used to save the real and virtual Mesoscope objective positions as a .yaml file to reuse it
131
- between experiment sessions.
127
+ """Stores real and virtual Mesoscope objective positions reused between experiment sessions that use the
128
+ Mesoscope-VR system.
132
129
 
133
130
  Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
134
131
  multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
@@ -139,10 +136,10 @@ class MesoscopePositions(YamlConfig):
139
136
  the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
140
137
  """
141
138
 
142
- mesoscope_x_position: float = ...
143
- mesoscope_y_position: float = ...
144
- mesoscope_roll_position: float = ...
145
- mesoscope_z_position: float = ...
146
- mesoscope_fast_z_position: float = ...
147
- mesoscope_tip_position: float = ...
148
- mesoscope_tilt_position: float = ...
139
+ mesoscope_x: float = ...
140
+ mesoscope_y: float = ...
141
+ mesoscope_roll: float = ...
142
+ mesoscope_z: float = ...
143
+ mesoscope_fast_z: float = ...
144
+ mesoscope_tip: float = ...
145
+ mesoscope_tilt: float = ...