sl-shared-assets 1.0.0rc24__tar.gz → 1.0.0rc26__tar.gz

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 (45) hide show
  1. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/PKG-INFO +1 -1
  2. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/pyproject.toml +1 -1
  3. sl_shared_assets-1.0.0rc26/src/sl_shared_assets/data_classes/configuration_data.pyi +199 -0
  4. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/session_data.py +8 -0
  5. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/session_data.pyi +2 -0
  6. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/server/server.py +1 -1
  7. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/.gitignore +0 -0
  8. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/LICENSE +0 -0
  9. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/README.md +0 -0
  10. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/docs/Makefile +0 -0
  11. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/docs/make.bat +0 -0
  12. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/docs/source/api.rst +0 -0
  13. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/docs/source/conf.py +0 -0
  14. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/docs/source/index.rst +0 -0
  15. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/docs/source/welcome.rst +0 -0
  16. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/envs/slsa_dev_lin.yml +0 -0
  17. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/envs/slsa_dev_lin_spec.txt +0 -0
  18. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/__init__.py +0 -0
  19. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/__init__.pyi +0 -0
  20. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/cli.py +0 -0
  21. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/cli.pyi +0 -0
  22. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/__init__.py +0 -0
  23. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/__init__.pyi +0 -0
  24. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/configuration_data.py +0 -0
  25. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/runtime_data.py +0 -0
  26. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/runtime_data.pyi +0 -0
  27. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/surgery_data.py +0 -0
  28. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/data_classes/surgery_data.pyi +0 -0
  29. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/py.typed +0 -0
  30. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/server/__init__.py +0 -0
  31. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/server/__init__.pyi +0 -0
  32. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/server/job.py +0 -0
  33. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/server/job.pyi +0 -0
  34. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/server/server.pyi +0 -0
  35. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/__init__.py +0 -0
  36. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/__init__.pyi +0 -0
  37. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/ascension_tools.py +0 -0
  38. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/ascension_tools.pyi +0 -0
  39. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/packaging_tools.py +0 -0
  40. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/packaging_tools.pyi +0 -0
  41. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/project_management_tools.py +0 -0
  42. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/project_management_tools.pyi +0 -0
  43. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/transfer_tools.py +0 -0
  44. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/src/sl_shared_assets/tools/transfer_tools.pyi +0 -0
  45. {sl_shared_assets-1.0.0rc24 → sl_shared_assets-1.0.0rc26}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sl-shared-assets
3
- Version: 1.0.0rc24
3
+ Version: 1.0.0rc26
4
4
  Summary: Stores assets shared between multiple Sun (NeuroAI) lab data pipelines.
5
5
  Project-URL: Homepage, https://github.com/Sun-Lab-NBB/sl-shared-assets
6
6
  Project-URL: Documentation, https://sl-shared-assets-api-docs.netlify.app/
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
8
  # Project metdata section. Provides the genral ID information about the project.
9
9
  [project]
10
10
  name = "sl-shared-assets"
11
- version = "1.0.0rc24"
11
+ version = "1.0.0rc26"
12
12
  description = "Stores assets shared between multiple Sun (NeuroAI) lab data pipelines."
13
13
  readme = "README.md"
14
14
  license = { file = "LICENSE" }
@@ -0,0 +1,199 @@
1
+ from pathlib import Path
2
+ from dataclasses import field, dataclass
3
+
4
+ from _typeshed import Incomplete
5
+ from ataraxis_data_structures import YamlConfig
6
+
7
+ @dataclass()
8
+ class ExperimentState:
9
+ """Encapsulates the information used to set and maintain the desired experiment and system state.
10
+
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.
21
+ """
22
+
23
+ experiment_state_code: int
24
+ system_state_code: int
25
+ state_duration_s: float
26
+
27
+ @dataclass()
28
+ class MesoscopeExperimentConfiguration(YamlConfig):
29
+ """Stores the configuration of a single experiment runtime that uses the Mesoscope_VR data acquisition system.
30
+
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.
36
+
37
+ Each project should define one or more experiment configurations and save them as .yaml files inside the project
38
+ 'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
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.
44
+ """
45
+
46
+ cue_map: dict[int, float] = field(default_factory=Incomplete)
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
+ server_processed_data_root: Path = ...
62
+ server_raw_data_root: Path = ...
63
+
64
+ @dataclass()
65
+ class MesoscopeCameras:
66
+ """Stores the configuration parameters for the cameras used by the Mesoscope-VR system to record behavior videos."""
67
+
68
+ face_camera_index: int = ...
69
+ left_camera_index: int = ...
70
+ right_camera_index: int = ...
71
+ face_camera_quantization_parameter: int = ...
72
+ body_camera_quantization_parameter: int = ...
73
+ display_face_camera_frames: bool = ...
74
+ display_body_camera_frames: bool = ...
75
+
76
+ @dataclass()
77
+ class MesoscopeMicroControllers:
78
+ """Stores the configuration parameters for the microcontrollers used by the Mesoscope-VR system."""
79
+
80
+ actor_port: str = ...
81
+ sensor_port: str = ...
82
+ encoder_port: str = ...
83
+ debug: bool = ...
84
+ mesoscope_ttl_pulse_duration_ms: int = ...
85
+ minimum_break_strength_g_cm: float = ...
86
+ maximum_break_strength_g_cm: float = ...
87
+ wheel_diameter_cm: float = ...
88
+ lick_threshold_adc: int = ...
89
+ lick_signal_threshold_adc: int = ...
90
+ lick_delta_threshold_adc: int = ...
91
+ lick_averaging_pool_size: int = ...
92
+ torque_baseline_voltage_adc: int = ...
93
+ torque_maximum_voltage_adc: int = ...
94
+ torque_sensor_capacity_g_cm: float = ...
95
+ torque_report_cw: bool = ...
96
+ torque_report_ccw: bool = ...
97
+ torque_signal_threshold_adc: int = ...
98
+ torque_delta_threshold_adc: int = ...
99
+ torque_averaging_pool_size: int = ...
100
+ wheel_encoder_ppr = ...
101
+ wheel_encoder_report_cw: bool = ...
102
+ wheel_encoder_report_ccw: bool = ...
103
+ wheel_encoder_delta_threshold_pulse: int = ...
104
+ wheel_encoder_polling_delay_us = ...
105
+ cm_per_unity_unit = ...
106
+ screen_trigger_pulse_duration_ms: int = ...
107
+ auditory_tone_duration_ms: int = ...
108
+ valve_calibration_pulse_count: int = ...
109
+ sensor_polling_delay_ms: int = ...
110
+ valve_calibration_data: dict[int | float, int | float] | tuple[tuple[int | float, int | float], ...] = ...
111
+
112
+ @dataclass()
113
+ class MesoscopeAdditionalFirmware:
114
+ """Stores the configuration parameters for all firmware and hardware components not assembled in the Sun lab."""
115
+
116
+ headbar_port: str = ...
117
+ lickport_port: str = ...
118
+ wheel_port: str = ...
119
+ unity_ip: str = ...
120
+ unity_port: int = ...
121
+
122
+ @dataclass()
123
+ class MesoscopeSystemConfiguration(YamlConfig):
124
+ """Stores the hardware and filesystem configuration parameters for the Mesoscope-VR data acquisition system used in
125
+ the Sun lab.
126
+
127
+ This class is specifically designed to encapsulate the configuration parameters for the Mesoscope-VR system. It
128
+ expects the system to be configured according to the specifications available from the sl_experiment repository
129
+ (https://github.com/Sun-Lab-NBB/sl-experiment) and should be used exclusively by the VRPC machine
130
+ (main Mesoscope-VR PC).
131
+
132
+ Notes:
133
+ Each SystemConfiguration class is uniquely tied to a specific hardware configuration used in the lab. This
134
+ class will only work with the Mesoscope-VR system. Any other data acquisition and runtime management system in
135
+ the lab should define its own SystemConfiguration class to specify its own hardware and filesystem configuration
136
+ parameters.
137
+ """
138
+
139
+ name: str = ...
140
+ paths: MesoscopePaths = field(default_factory=MesoscopePaths)
141
+ cameras: MesoscopeCameras = field(default_factory=MesoscopeCameras)
142
+ microcontrollers: MesoscopeMicroControllers = field(default_factory=MesoscopeMicroControllers)
143
+ additional_firmware: MesoscopeAdditionalFirmware = field(default_factory=MesoscopeAdditionalFirmware)
144
+ def __post_init__(self) -> None:
145
+ """Ensures that variables converted to different types for storage purposes are always set to expected types
146
+ upon class instantiation."""
147
+ def save(self, path: Path) -> None:
148
+ """Saves class instance data to disk as a 'mesoscope_system_configuration.yaml' file.
149
+
150
+ This method converts certain class variables to yaml-safe types (for example, Path objects -> strings) and
151
+ saves class data to disk as a .yaml file. The method is intended to be used solely by the
152
+ set_system_configuration_file() function and should not be called from any other context.
153
+
154
+ Args:
155
+ path: The path to the .yaml file to save the data to.
156
+ """
157
+
158
+ _supported_configuration_files: Incomplete
159
+
160
+ def set_system_configuration_file(path: Path) -> None:
161
+ """Sets the system configuration .yaml file specified by the input path as the default system configuration file for
162
+ the managed machine (PC).
163
+
164
+ This function is used to initially configure or override the existing configuration of any data acquisition system
165
+ used in the lab. The path to the configuration file is stored inside the user's data directory, so that all
166
+ Sun lab libraries can automatically access that information during every runtime. Since the storage directory is
167
+ typically hidden and varies between OSes and machines, this function provides a convenient way for setting that
168
+ path without manually editing the storage cache.
169
+
170
+ Notes:
171
+ If the input path does not point to an existing file, but the file name and extension are correct, the function
172
+ will automatically generate a default SystemConfiguration class instance and save it under the specified path.
173
+
174
+ A data acquisition system can include multiple machines (PCs). However, the configuration file is typically
175
+ only present on the 'main' machine that manages all runtimes.
176
+
177
+ Args:
178
+ path: The path to the new system configuration file to be used by the local data acquisition system (PC).
179
+
180
+ Raises:
181
+ ValueError: If the input path is not a valid system configuration file or does not use a supported data
182
+ acquisition system name.
183
+ """
184
+
185
+ def get_system_configuration_data() -> MesoscopeSystemConfiguration:
186
+ """Resolves the path to the local system configuration file and loads the system configuration data.
187
+
188
+ This service function is used by all Sun lab data acquisition runtimes to load the system configuration data from
189
+ the shared configuration file. It supports resolving and returning the data for all data acquisition systems used
190
+ in the lab.
191
+
192
+ Returns:
193
+ The initialized SystemConfiguration class instance for the local acquisition system that stores the loaded
194
+ configuration parameters.
195
+
196
+ Raises:
197
+ FileNotFoundError: If the local machine does not have the Sun lab data directory, or the system configuration
198
+ file does not exist.
199
+ """
@@ -381,6 +381,14 @@ class SessionData(YamlConfig):
381
381
  """Stores the paths to all subfolders and files found under the /project/animal/session/processed_data directory of
382
382
  any PC used to work with Sun lab data."""
383
383
 
384
+ def __post_init__(self) -> None:
385
+ """Ensures raw_data and processed_data are always instances of RawData and ProcessedData."""
386
+ if not isinstance(self.raw_data, RawData):
387
+ self.raw_data = RawData()
388
+
389
+ if not isinstance(self.processed_data, ProcessedData):
390
+ self.processed_data = ProcessedData()
391
+
384
392
  @classmethod
385
393
  def create(
386
394
  cls,
@@ -172,6 +172,8 @@ class SessionData(YamlConfig):
172
172
  experiment_name: str | None
173
173
  raw_data: RawData = field(default_factory=Incomplete)
174
174
  processed_data: ProcessedData = field(default_factory=Incomplete)
175
+ def __post_init__(self) -> None:
176
+ """Ensures raw_data and processed_data are always instances of RawData and ProcessedData."""
175
177
  @classmethod
176
178
  def create(
177
179
  cls,
@@ -162,7 +162,7 @@ class Server:
162
162
  # If batch_job is not in the output received from SLURM in response to issuing the submission command, raises an
163
163
  # error.
164
164
  if "Submitted batch job" not in job_output:
165
- message = f"Failed to submit the {job.job_name} job to the BioHPC cluster."
165
+ message = f"Failed to submit the '{job.job_name}' job to the BioHPC cluster."
166
166
  console.error(message, RuntimeError)
167
167
 
168
168
  # Fallback to appease mypy, should not be reachable