sl-shared-assets 3.1.3__py3-none-any.whl → 4.0.0__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.

@@ -11,6 +11,7 @@ from .tools import (
11
11
  ProjectManifest,
12
12
  resolve_p53_marker,
13
13
  transfer_directory,
14
+ generate_project_manifest,
14
15
  calculate_directory_checksum,
15
16
  )
16
17
  from .server import Job, Server, JupyterJob, ServerCredentials
@@ -30,6 +31,7 @@ from .data_classes import (
30
31
  ExperimentState,
31
32
  ExperimentTrial,
32
33
  MesoscopeCameras,
34
+ TrackerFileNames,
33
35
  ProcessingTracker,
34
36
  AcquisitionSystems,
35
37
  MesoscopePositions,
@@ -42,6 +44,8 @@ from .data_classes import (
42
44
  MesoscopeSystemConfiguration,
43
45
  MesoscopeExperimentDescriptor,
44
46
  MesoscopeExperimentConfiguration,
47
+ generate_manager_id,
48
+ get_processing_tracker,
45
49
  get_system_configuration_data,
46
50
  set_system_configuration_file,
47
51
  )
@@ -86,9 +90,13 @@ __all__ = [
86
90
  "SessionTypes",
87
91
  "AcquisitionSystems",
88
92
  "WindowCheckingDescriptor",
93
+ "get_processing_tracker",
94
+ "generate_manager_id",
95
+ "TrackerFileNames",
89
96
  # Tools package
90
97
  "ProjectManifest",
91
98
  "resolve_p53_marker",
92
99
  "transfer_directory",
93
100
  "calculate_directory_checksum",
101
+ "generate_project_manifest",
94
102
  ]
@@ -2,6 +2,7 @@ from .tools import (
2
2
  ProjectManifest as ProjectManifest,
3
3
  resolve_p53_marker as resolve_p53_marker,
4
4
  transfer_directory as transfer_directory,
5
+ generate_project_manifest as generate_project_manifest,
5
6
  calculate_directory_checksum as calculate_directory_checksum,
6
7
  )
7
8
  from .server import (
@@ -26,6 +27,7 @@ from .data_classes import (
26
27
  ExperimentState as ExperimentState,
27
28
  ExperimentTrial as ExperimentTrial,
28
29
  MesoscopeCameras as MesoscopeCameras,
30
+ TrackerFileNames as TrackerFileNames,
29
31
  ProcessingTracker as ProcessingTracker,
30
32
  AcquisitionSystems as AcquisitionSystems,
31
33
  MesoscopePositions as MesoscopePositions,
@@ -38,6 +40,8 @@ from .data_classes import (
38
40
  MesoscopeSystemConfiguration as MesoscopeSystemConfiguration,
39
41
  MesoscopeExperimentDescriptor as MesoscopeExperimentDescriptor,
40
42
  MesoscopeExperimentConfiguration as MesoscopeExperimentConfiguration,
43
+ generate_manager_id as generate_manager_id,
44
+ get_processing_tracker as get_processing_tracker,
41
45
  get_system_configuration_data as get_system_configuration_data,
42
46
  set_system_configuration_file as set_system_configuration_file,
43
47
  )
@@ -76,8 +80,12 @@ __all__ = [
76
80
  "SessionTypes",
77
81
  "AcquisitionSystems",
78
82
  "WindowCheckingDescriptor",
83
+ "get_processing_tracker",
84
+ "generate_manager_id",
85
+ "TrackerFileNames",
79
86
  "ProjectManifest",
80
87
  "resolve_p53_marker",
81
88
  "transfer_directory",
82
89
  "calculate_directory_checksum",
90
+ "generate_project_manifest",
83
91
  ]
sl_shared_assets/cli.py CHANGED
@@ -7,7 +7,7 @@ from ataraxis_base_utilities import LogLevel, console, ensure_directory_exists
7
7
 
8
8
  from .tools import ascend_tyche_data, resolve_p53_marker, verify_session_checksum, generate_project_manifest
9
9
  from .server import Server, JupyterJob, generate_server_credentials
10
- from .data_classes import SessionData, ProcessingTracker
10
+ from .data_classes import SessionData, TrackerFileNames, get_processing_tracker
11
11
 
12
12
 
13
13
  @click.command()
@@ -18,6 +18,18 @@ from .data_classes import SessionData, ProcessingTracker
18
18
  required=True,
19
19
  help="The absolute path to the session directory whose raw data needs to be verified for potential corruption.",
20
20
  )
21
+ @click.option(
22
+ "-id",
23
+ "--manager_id",
24
+ required=True,
25
+ default=0,
26
+ show_default=True,
27
+ help=(
28
+ "The xxHash-64 hash value that represents the unique identifier for the process that manages this runtime. "
29
+ "This is primarily used when calling this CLI on remote compute servers to ensure that only a single process "
30
+ "can execute the CLI at a time."
31
+ ),
32
+ )
21
33
  @click.option(
22
34
  "-c",
23
35
  "--create_processed_directories",
@@ -54,7 +66,11 @@ from .data_classes import SessionData, ProcessingTracker
54
66
  ),
55
67
  )
56
68
  def verify_session_integrity(
57
- session_path: Path, create_processed_directories: bool, processed_data_root: Path | None, update_manifest: bool
69
+ session_path: Path,
70
+ manager_id: int,
71
+ create_processed_directories: bool,
72
+ processed_data_root: Path | None,
73
+ update_manifest: bool,
58
74
  ) -> None:
59
75
  """Checks the integrity of the target session's raw data (contents of the raw_data directory).
60
76
 
@@ -73,14 +89,15 @@ def verify_session_integrity(
73
89
 
74
90
  # Runs the verification process
75
91
  verify_session_checksum(
76
- session,
92
+ session_path=session,
93
+ manager_id=manager_id,
77
94
  create_processed_data_directory=create_processed_directories,
78
95
  processed_data_root=processed_data_root,
79
96
  update_manifest=update_manifest,
80
97
  )
81
98
 
82
99
  # Checks the outcome of the verification process
83
- tracker = ProcessingTracker(file_path=session_data.raw_data.integrity_verification_tracker_path)
100
+ tracker = get_processing_tracker(root=session_data.raw_data.raw_data_path, file_name=TrackerFileNames.INTEGRITY)
84
101
  if tracker.is_complete:
85
102
  # noinspection PyTypeChecker
86
103
  console.echo(message=f"Session {session.stem} raw data integrity: Verified.", level=LogLevel.SUCCESS)
@@ -448,11 +465,7 @@ def start_jupyter_server(
448
465
  is_flag=True,
449
466
  show_default=True,
450
467
  default=False,
451
- help=(
452
- "Determines whether the command should create or remove the dataset integration marker. Do not enable this "
453
- "flag unless you know what you are doing. It is only safe to enable this flag if the session is not currently "
454
- "being integrated into any datasets."
455
- ),
468
+ help="Determines whether the command should create or remove the dataset integration marker.",
456
469
  )
457
470
  @click.option(
458
471
  "-um",
sl_shared_assets/cli.pyi CHANGED
@@ -13,11 +13,16 @@ from .server import (
13
13
  )
14
14
  from .data_classes import (
15
15
  SessionData as SessionData,
16
- ProcessingTracker as ProcessingTracker,
16
+ TrackerFileNames as TrackerFileNames,
17
+ get_processing_tracker as get_processing_tracker,
17
18
  )
18
19
 
19
20
  def verify_session_integrity(
20
- session_path: Path, create_processed_directories: bool, processed_data_root: Path | None, update_manifest: bool
21
+ session_path: Path,
22
+ manager_id: int,
23
+ create_processed_directories: bool,
24
+ processed_data_root: Path | None,
25
+ update_manifest: bool,
21
26
  ) -> None:
22
27
  """Checks the integrity of the target session's raw data (contents of the raw_data directory).
23
28
 
@@ -12,7 +12,16 @@ from .runtime_data import (
12
12
  WindowCheckingDescriptor,
13
13
  MesoscopeExperimentDescriptor,
14
14
  )
15
- from .session_data import RawData, SessionData, SessionTypes, ProcessedData, ProcessingTracker
15
+ from .session_data import (
16
+ RawData,
17
+ SessionData,
18
+ SessionTypes,
19
+ ProcessedData,
20
+ TrackerFileNames,
21
+ ProcessingTracker,
22
+ generate_manager_id,
23
+ get_processing_tracker,
24
+ )
16
25
  from .surgery_data import (
17
26
  DrugData,
18
27
  ImplantData,
@@ -65,4 +74,7 @@ __all__ = [
65
74
  "AcquisitionSystems",
66
75
  "SessionTypes",
67
76
  "WindowCheckingDescriptor",
77
+ "get_processing_tracker",
78
+ "generate_manager_id",
79
+ "TrackerFileNames",
68
80
  ]
@@ -12,7 +12,10 @@ from .session_data import (
12
12
  SessionData as SessionData,
13
13
  SessionTypes as SessionTypes,
14
14
  ProcessedData as ProcessedData,
15
+ TrackerFileNames as TrackerFileNames,
15
16
  ProcessingTracker as ProcessingTracker,
17
+ generate_manager_id as generate_manager_id,
18
+ get_processing_tracker as get_processing_tracker,
16
19
  )
17
20
  from .surgery_data import (
18
21
  DrugData as DrugData,
@@ -66,4 +69,7 @@ __all__ = [
66
69
  "AcquisitionSystems",
67
70
  "SessionTypes",
68
71
  "WindowCheckingDescriptor",
72
+ "get_processing_tracker",
73
+ "generate_manager_id",
74
+ "TrackerFileNames",
69
75
  ]
@@ -560,7 +560,7 @@ def get_system_configuration_data() -> MesoscopeSystemConfiguration:
560
560
  app_dir = Path(appdirs.user_data_dir(appname="sun_lab_data", appauthor="sun_lab"))
561
561
  path_file = app_dir.joinpath("configuration_path.txt")
562
562
 
563
- # If the cache file or the Sun lab data directory do not exist, aborts with an error
563
+ # If the cache file or the Sun lab data directory does not exist, aborts with an error
564
564
  if not path_file.exists():
565
565
  message = (
566
566
  "Unable to resolve the path to the local system configuration file, as local machine does not have the "
@@ -87,9 +87,6 @@ class LickTrainingDescriptor(YamlConfig):
87
87
  """The ID of the experimenter running the session."""
88
88
  mouse_weight_g: float
89
89
  """The weight of the animal, in grams, at the beginning of the session."""
90
- dispensed_water_volume_ml: float
91
- """Stores the total water volume, in milliliters, dispensed during runtime. This excludes the water volume
92
- dispensed during the paused (idle) state."""
93
90
  minimum_reward_delay_s: int
94
91
  """Stores the minimum delay, in seconds, that can separate the delivery of two consecutive water rewards."""
95
92
  maximum_reward_delay_s: int
@@ -102,6 +99,9 @@ class LickTrainingDescriptor(YamlConfig):
102
99
  """Stores the maximum number of consecutive rewards that can be delivered without the animal consuming them. If
103
100
  the animal receives this many rewards without licking (consuming) them, reward delivery is paused until the animal
104
101
  consumes the rewards."""
102
+ dispensed_water_volume_ml: float = 0.0
103
+ """Stores the total water volume, in milliliters, dispensed during runtime. This excludes the water volume
104
+ dispensed during the paused (idle) state."""
105
105
  pause_dispensed_water_volume_ml: float = 0.0
106
106
  """Stores the total water volume, in milliliters, dispensed during the paused (idle) state."""
107
107
  experimenter_notes: str = "Replace this with your notes."
@@ -110,6 +110,9 @@ class LickTrainingDescriptor(YamlConfig):
110
110
  experimenter_given_water_volume_ml: float = 0.0
111
111
  """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
112
112
  """
113
+ preferred_session_water_volume_ml: float = 0.0
114
+ """The volume of water, in milliliters, the animal should be receiving during the session runtime if its
115
+ performance matches experimenter-specified threshold."""
113
116
  incomplete: bool = False
114
117
  """If this field is set to True, the session is marked as 'incomplete' and automatically excluded from all further
115
118
  Sun lab automated processing and analysis."""
@@ -123,8 +126,6 @@ class RunTrainingDescriptor(YamlConfig):
123
126
  """The ID of the experimenter running the session."""
124
127
  mouse_weight_g: float
125
128
  """The weight of the animal, in grams, at the beginning of the session."""
126
- dispensed_water_volume_ml: float
127
- """Stores the total water volume, in milliliters, dispensed during runtime."""
128
129
  final_run_speed_threshold_cm_s: float
129
130
  """Stores the final running speed threshold, in centimeters per second, that was active at the end of training."""
130
131
  final_run_duration_threshold_s: float
@@ -154,6 +155,9 @@ class RunTrainingDescriptor(YamlConfig):
154
155
  """Stores the maximum time, in seconds, the animal can dip below the running speed threshold to still receive the
155
156
  reward. This allows animals that 'run' by taking a series of large steps, briefly dipping below speed threshold at
156
157
  the end of each step, to still get water rewards."""
158
+ dispensed_water_volume_ml: float = 0.0
159
+ """Stores the total water volume, in milliliters, dispensed during runtime. This excludes the water volume
160
+ dispensed during the paused (idle) state."""
157
161
  pause_dispensed_water_volume_ml: float = 0.0
158
162
  """Stores the total water volume, in milliliters, dispensed during the paused (idle) state."""
159
163
  experimenter_notes: str = "Replace this with your notes."
@@ -162,6 +166,9 @@ class RunTrainingDescriptor(YamlConfig):
162
166
  experimenter_given_water_volume_ml: float = 0.0
163
167
  """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
164
168
  """
169
+ preferred_session_water_volume_ml: float = 0.0
170
+ """The volume of water, in milliliters, the animal should be receiving during the session runtime if its
171
+ performance matches experimenter-specified threshold."""
165
172
  incomplete: bool = False
166
173
  """If this field is set to True, the session is marked as 'incomplete' and automatically excluded from all further
167
174
  Sun lab automated processing and analysis."""
@@ -175,20 +182,24 @@ class MesoscopeExperimentDescriptor(YamlConfig):
175
182
  """The ID of the experimenter running the session."""
176
183
  mouse_weight_g: float
177
184
  """The weight of the animal, in grams, at the beginning of the session."""
178
- dispensed_water_volume_ml: float
179
- """Stores the total water volume, in milliliters, dispensed during runtime."""
180
185
  maximum_unconsumed_rewards: int = 1
181
186
  """Stores the maximum number of consecutive rewards that can be delivered without the animal consuming them. If
182
187
  the animal receives this many rewards without licking (consuming) them, reward delivery is paused until the animal
183
188
  consumes the rewards."""
189
+ dispensed_water_volume_ml: float = 0.0
190
+ """Stores the total water volume, in milliliters, dispensed during runtime. This excludes the water volume
191
+ dispensed during the paused (idle) state."""
192
+ pause_dispensed_water_volume_ml: float = 0.0
193
+ """Stores the total water volume, in milliliters, dispensed during the paused (idle) state."""
184
194
  experimenter_notes: str = "Replace this with your notes."
185
195
  """This field is not set during runtime. It is expected that each experimenter will replace this field with their
186
196
  notes made during runtime."""
187
- pause_dispensed_water_volume_ml: float = 0.0
188
- """Stores the total water volume, in milliliters, dispensed during the paused (idle) state."""
189
197
  experimenter_given_water_volume_ml: float = 0.0
190
198
  """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
191
199
  """
200
+ preferred_session_water_volume_ml: float = 0.0
201
+ """The volume of water, in milliliters, the animal should be receiving during the session runtime if its
202
+ performance matches experimenter-specified threshold."""
192
203
  incomplete: bool = False
193
204
  """If this field is set to True, the session is marked as 'incomplete' and automatically excluded from all further
194
205
  Sun lab automated processing and analysis."""
@@ -49,15 +49,16 @@ class LickTrainingDescriptor(YamlConfig):
49
49
 
50
50
  experimenter: str
51
51
  mouse_weight_g: float
52
- dispensed_water_volume_ml: float
53
52
  minimum_reward_delay_s: int
54
53
  maximum_reward_delay_s: int
55
54
  maximum_water_volume_ml: float
56
55
  maximum_training_time_m: int
57
56
  maximum_unconsumed_rewards: int = ...
57
+ dispensed_water_volume_ml: float = ...
58
58
  pause_dispensed_water_volume_ml: float = ...
59
59
  experimenter_notes: str = ...
60
60
  experimenter_given_water_volume_ml: float = ...
61
+ preferred_session_water_volume_ml: float = ...
61
62
  incomplete: bool = ...
62
63
 
63
64
  @dataclass()
@@ -66,7 +67,6 @@ class RunTrainingDescriptor(YamlConfig):
66
67
 
67
68
  experimenter: str
68
69
  mouse_weight_g: float
69
- dispensed_water_volume_ml: float
70
70
  final_run_speed_threshold_cm_s: float
71
71
  final_run_duration_threshold_s: float
72
72
  initial_run_speed_threshold_cm_s: float
@@ -78,9 +78,11 @@ class RunTrainingDescriptor(YamlConfig):
78
78
  maximum_training_time_m: int
79
79
  maximum_unconsumed_rewards: int = ...
80
80
  maximum_idle_time_s: float = ...
81
+ dispensed_water_volume_ml: float = ...
81
82
  pause_dispensed_water_volume_ml: float = ...
82
83
  experimenter_notes: str = ...
83
84
  experimenter_given_water_volume_ml: float = ...
85
+ preferred_session_water_volume_ml: float = ...
84
86
  incomplete: bool = ...
85
87
 
86
88
  @dataclass()
@@ -89,11 +91,12 @@ class MesoscopeExperimentDescriptor(YamlConfig):
89
91
 
90
92
  experimenter: str
91
93
  mouse_weight_g: float
92
- dispensed_water_volume_ml: float
93
94
  maximum_unconsumed_rewards: int = ...
94
- experimenter_notes: str = ...
95
+ dispensed_water_volume_ml: float = ...
95
96
  pause_dispensed_water_volume_ml: float = ...
97
+ experimenter_notes: str = ...
96
98
  experimenter_given_water_volume_ml: float = ...
99
+ preferred_session_water_volume_ml: float = ...
97
100
  incomplete: bool = ...
98
101
 
99
102
  @dataclass()