sl-shared-assets 3.0.0rc6__py3-none-any.whl → 3.0.0rc8__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.

@@ -26,8 +26,8 @@ from .data_classes import (
26
26
  MesoscopePaths,
27
27
  ZaberPositions,
28
28
  ExperimentState,
29
+ ExperimentTrial,
29
30
  MesoscopeCameras,
30
- TrialCueSequence,
31
31
  ProcessingTracker,
32
32
  MesoscopePositions,
33
33
  RunTrainingDescriptor,
@@ -78,7 +78,7 @@ __all__ = [
78
78
  "MesoscopeAdditionalFirmware",
79
79
  "get_system_configuration_data",
80
80
  "set_system_configuration_file",
81
- "TrialCueSequence",
81
+ "ExperimentTrial",
82
82
  # Tools package
83
83
  "resolve_p53_marker",
84
84
  "transfer_directory",
@@ -22,8 +22,8 @@ from .data_classes import (
22
22
  MesoscopePaths as MesoscopePaths,
23
23
  ZaberPositions as ZaberPositions,
24
24
  ExperimentState as ExperimentState,
25
+ ExperimentTrial as ExperimentTrial,
25
26
  MesoscopeCameras as MesoscopeCameras,
26
- TrialCueSequence as TrialCueSequence,
27
27
  ProcessingTracker as ProcessingTracker,
28
28
  MesoscopePositions as MesoscopePositions,
29
29
  RunTrainingDescriptor as RunTrainingDescriptor,
@@ -68,7 +68,7 @@ __all__ = [
68
68
  "MesoscopeAdditionalFirmware",
69
69
  "get_system_configuration_data",
70
70
  "set_system_configuration_file",
71
- "TrialCueSequence",
71
+ "ExperimentTrial",
72
72
  "resolve_p53_marker",
73
73
  "transfer_directory",
74
74
  "calculate_directory_checksum",
@@ -23,8 +23,8 @@ from .surgery_data import (
23
23
  from .configuration_data import (
24
24
  MesoscopePaths,
25
25
  ExperimentState,
26
+ ExperimentTrial,
26
27
  MesoscopeCameras,
27
- TrialCueSequence,
28
28
  MesoscopeMicroControllers,
29
29
  MesoscopeAdditionalFirmware,
30
30
  MesoscopeSystemConfiguration,
@@ -59,5 +59,5 @@ __all__ = [
59
59
  "MesoscopeMicroControllers",
60
60
  "MesoscopeAdditionalFirmware",
61
61
  "ProcessingTracker",
62
- "TrialCueSequence",
62
+ "ExperimentTrial",
63
63
  ]
@@ -23,8 +23,8 @@ from .surgery_data import (
23
23
  from .configuration_data import (
24
24
  MesoscopePaths as MesoscopePaths,
25
25
  ExperimentState as ExperimentState,
26
+ ExperimentTrial as ExperimentTrial,
26
27
  MesoscopeCameras as MesoscopeCameras,
27
- TrialCueSequence as TrialCueSequence,
28
28
  MesoscopeMicroControllers as MesoscopeMicroControllers,
29
29
  MesoscopeAdditionalFirmware as MesoscopeAdditionalFirmware,
30
30
  MesoscopeSystemConfiguration as MesoscopeSystemConfiguration,
@@ -59,5 +59,5 @@ __all__ = [
59
59
  "MesoscopeMicroControllers",
60
60
  "MesoscopeAdditionalFirmware",
61
61
  "ProcessingTracker",
62
- "TrialCueSequence",
62
+ "ExperimentTrial",
63
63
  ]
@@ -56,14 +56,14 @@ class ExperimentState:
56
56
 
57
57
 
58
58
  @dataclass()
59
- class TrialCueSequence:
60
- """Encapsulates information about the Virtual Reality (VR) wall cue sequence experienced by the animal as part of
61
- the given trial.
62
-
63
- All Virtual Reality environments can be broadly conceptualized as repeating motifs (sequences) of wall cues. Since
64
- some experimental tasks can use multiple cue sequences as part of the same experiment session, multiple instances of
65
- this class can be used to specify supported trial structures. The information stored in this class instance is used
66
- during behavior data parsing to assign trial information to data collected from various sources.
59
+ class ExperimentTrial:
60
+ """Encapsulates information about a single experiment trial.
61
+
62
+ All Virtual Reality tasks can be broadly conceptualized as repeating motifs (sequences) of wall cues,
63
+ associated with a specific rewarded goal. These repeated motifs are typically used to define experiment trials
64
+ during analysis. Since some experiments can use multiple trial types as part of the same experiment session,
65
+ multiple instances of this class can be used to specify supported trial structures and trial parameters for a
66
+ given experiment.
67
67
  """
68
68
 
69
69
  cue_sequence: list[int]
@@ -72,6 +72,8 @@ class TrialCueSequence:
72
72
  """The length of the trial cue sequence, in Unity units."""
73
73
  trial_length_cm: float
74
74
  """The length of the trial cue sequence in centimeters."""
75
+ trial_reward_size_ul: float = 5.0
76
+ """The volume of water, in microliters, to be dispensed when the animal successfully completes the trial task."""
75
77
 
76
78
 
77
79
  # noinspection PyArgumentList
@@ -98,6 +100,14 @@ class MesoscopeExperimentConfiguration(YamlConfig):
98
100
  """A dictionary that maps each integer-code associated with a wall cue used in the Virtual Reality experiment
99
101
  environment to its length in real-world centimeters. It is used to map each VR cue to the distance the animal needs
100
102
  to travel to fully traverse the wall cue region from start to end."""
103
+ cue_offset_cm: float = 10.0
104
+ """Specifies the positive offset distance, in centimeters, by which the animal's starting position is shifted
105
+ relative to experiment environment onset. Due to how the VR environment is revealed to the animal, most runtimes
106
+ need to shift the animal slightly forward relative to the track origin (0), to prevent it from seeing the area
107
+ before the first VR wall cue when the task starts and when the animal is teleported to the beginning of the track.
108
+ This offset statically shifts the entire track (in centimeters) against the set of VR wall cues used during
109
+ runtime. Storing this static offset as part of experiment configuration is crucial for correctly interpreting the
110
+ data acquiring during runtime."""
101
111
  experiment_states: dict[str, ExperimentState] = field(
102
112
  default_factory=lambda: {
103
113
  "baseline": ExperimentState(
@@ -128,15 +138,19 @@ class MesoscopeExperimentConfiguration(YamlConfig):
128
138
  )
129
139
  """A dictionary that uses human-readable state-names as keys and ExperimentState instances as values. Each
130
140
  ExperimentState instance represents a phase of the experiment."""
131
- trial_structures: dict[str, TrialCueSequence] = field(
141
+ trial_structures: dict[str, ExperimentTrial] = field(
132
142
  default_factory=lambda: {
133
- "circular 4 cue": TrialCueSequence(
134
- cue_sequence=[0, 1, 0, 2, 0, 3, 0, 4], trial_length_unity_unit=24.0, trial_length_cm=240.0
143
+ "cyclic_4_cue": ExperimentTrial(
144
+ cue_sequence=[0, 1, 0, 2, 0, 3, 0, 4],
145
+ trial_length_unity_unit=24.0,
146
+ trial_length_cm=240.0,
147
+ trial_reward_size_ul=5.0,
135
148
  )
136
149
  }
137
150
  )
138
- """A dictionary that maps human-readable trial structure names as keys and TrialCueSequence instances as values.
139
- Each TrialCueSequence instance represents a specific VR wall cue sequence used by a given trial structure."""
151
+ """A dictionary that maps human-readable trial structure names as keys and ExperimentTrial instances as values.
152
+ Each ExperimentTrial instance specifies the Virtual Reality layout and runtime parameters associated with a single
153
+ type of trials supported by the experiment runtime."""
140
154
 
141
155
 
142
156
  @dataclass()
@@ -28,19 +28,20 @@ class ExperimentState:
28
28
  recovery_guided_trials: int
29
29
 
30
30
  @dataclass()
31
- class TrialCueSequence:
32
- """Encapsulates information about the Virtual Reality (VR) wall cue sequence experienced by the animal as part of
33
- the given trial.
34
-
35
- All Virtual Reality environments can be broadly conceptualized as repeating motifs (sequences) of wall cues. Since
36
- some experimental tasks can use multiple cue sequences as part of the same experiment session, multiple instances of
37
- this class can be used to specify supported trial structures. The information stored in this class instance is used
38
- during behavior data parsing to assign trial information to data collected from various sources.
31
+ class ExperimentTrial:
32
+ """Encapsulates information about a single experiment trial.
33
+
34
+ All Virtual Reality tasks can be broadly conceptualized as repeating motifs (sequences) of wall cues,
35
+ associated with a specific rewarded goal. These repeated motifs are typically used to define experiment trials
36
+ during analysis. Since some experiments can use multiple trial types as part of the same experiment session,
37
+ multiple instances of this class can be used to specify supported trial structures and trial parameters for a
38
+ given experiment.
39
39
  """
40
40
 
41
41
  cue_sequence: list[int]
42
42
  trial_length_unity_unit: float
43
43
  trial_length_cm: float
44
+ trial_reward_size_ul: float = ...
44
45
 
45
46
  @dataclass()
46
47
  class MesoscopeExperimentConfiguration(YamlConfig):
@@ -62,8 +63,9 @@ class MesoscopeExperimentConfiguration(YamlConfig):
62
63
  """
63
64
 
64
65
  cue_map: dict[int, float] = field(default_factory=Incomplete)
66
+ cue_offset_cm: float = ...
65
67
  experiment_states: dict[str, ExperimentState] = field(default_factory=Incomplete)
66
- trial_structures: dict[str, TrialCueSequence] = field(default_factory=Incomplete)
68
+ trial_structures: dict[str, ExperimentTrial] = field(default_factory=Incomplete)
67
69
 
68
70
  @dataclass()
69
71
  class MesoscopePaths:
@@ -68,9 +68,6 @@ class RawData:
68
68
  surgery_metadata_path: Path = Path()
69
69
  """Stores the path to the surgery_metadata.yaml file. This file contains the most actual information about the
70
70
  surgical intervention(s) performed on the animal prior to the session."""
71
- project_configuration_path: Path = Path()
72
- """Stores the path to the project_configuration.yaml file. This file contains the snapshot of the configuration
73
- parameters for the session's project."""
74
71
  session_data_path: Path = Path()
75
72
  """Stores the path to the session_data.yaml file. This path is used by the SessionData instance to save itself to
76
73
  disk as a .yaml file. The file contains the paths to all raw and processed data directories used during data
@@ -106,13 +103,17 @@ class RawData:
106
103
  the long-term storage destinations (NAS and Server) and the integrity of the moved data is verified on at least one
107
104
  destination. During 'purge' sl-experiment runtimes, the library discovers and removes all session data marked with
108
105
  'ubiquitin.bin' files from the machine that runs the code."""
106
+ nk_path: Path = Path()
107
+ """Stores the path to the nk.bin file. This file is used during new data acquisition by the sl-experiment library
108
+ to mark sessions going through initial runtime initialization. Since runtime initialization is a complex process
109
+ that may fail at many different time-points, it is important to know whether the runtime initialized before
110
+ encountering an error. The presence of an nk.bin marker notifies post-runtime processes that the runtime failed to
111
+ initialize, marking that session's data for immediate deletion from all sources, as it does not contain any valid
112
+ information."""
109
113
  integrity_verification_tracker_path: Path = Path()
110
114
  """Stores the path to the integrity_verification.yaml tracker file. This file stores the current state of the data
111
115
  integrity verification pipeline. It prevents more than one instance of the pipeline from working with the data
112
116
  at a given time and communicates the outcome (success or failure) of the most recent pipeline runtime."""
113
- version_data_path: Path = Path()
114
- """Stores the path to the version_data.yaml file. This file contains the snapshot of Python and sl-experiment
115
- library versions that were used when the data was acquired."""
116
117
 
117
118
  def resolve_paths(self, root_directory_path: Path) -> None:
118
119
  """Resolves all paths managed by the class instance based on the input root directory path.
@@ -135,7 +136,6 @@ class RawData:
135
136
  self.session_descriptor_path = self.raw_data_path.joinpath("session_descriptor.yaml")
136
137
  self.hardware_state_path = self.raw_data_path.joinpath("hardware_state.yaml")
137
138
  self.surgery_metadata_path = self.raw_data_path.joinpath("surgery_metadata.yaml")
138
- self.project_configuration_path = self.raw_data_path.joinpath("project_configuration.yaml")
139
139
  self.session_data_path = self.raw_data_path.joinpath("session_data.yaml")
140
140
  self.experiment_configuration_path = self.raw_data_path.joinpath("experiment_configuration.yaml")
141
141
  self.mesoscope_positions_path = self.raw_data_path.joinpath("mesoscope_positions.yaml")
@@ -144,8 +144,8 @@ class RawData:
144
144
  self.system_configuration_path = self.raw_data_path.joinpath("system_configuration.yaml")
145
145
  self.telomere_path = self.raw_data_path.joinpath("telomere.bin")
146
146
  self.ubiquitin_path = self.raw_data_path.joinpath("ubiquitin.bin")
147
+ self.nk_path = self.raw_data_path.joinpath("nk.bin")
147
148
  self.integrity_verification_tracker_path = self.raw_data_path.joinpath("integrity_verification_tracker.yaml")
148
- self.version_data_path = self.raw_data_path.joinpath("version_data.yaml")
149
149
 
150
150
  def make_directories(self) -> None:
151
151
  """Ensures that all major subdirectories and the root directory exist, creating any missing directories."""
@@ -302,9 +302,9 @@ class SessionData(YamlConfig):
302
302
 
303
303
  This method automatically dumps the data of the created SessionData instance into the session_data.yaml file
304
304
  inside the root raw_data directory of the created hierarchy. It also finds and dumps other configuration
305
- files, such as project_configuration.yaml, experiment_configuration.yaml, and system_configuration.yaml into
306
- the same raw_data directory. This ensures that if the session's runtime is interrupted unexpectedly, the
307
- acquired data can still be processed.
305
+ files, such as experiment_configuration.yaml and system_configuration.yaml into the same raw_data directory.
306
+ This ensures that if the session's runtime is interrupted unexpectedly, the acquired data can still be
307
+ processed.
308
308
 
309
309
  Args:
310
310
  project_name: The name of the project for which the data is acquired.
@@ -401,14 +401,8 @@ class SessionData(YamlConfig):
401
401
  # preprocessing.
402
402
  instance._save()
403
403
 
404
- # Also saves the ProjectConfiguration, SystemConfiguration, and ExperimentConfiguration instances to the same
405
- # folder using the paths resolved for the RawData instance above.
406
-
407
- # Copies the project_configuration.yaml file to session's folder
408
- project_configuration_path = acquisition_system.paths.root_directory.joinpath(
409
- project_name, "configuration", "project_configuration.yaml"
410
- )
411
- sh.copy2(project_configuration_path, instance.raw_data.project_configuration_path)
404
+ # Also saves the SystemConfiguration and ExperimentConfiguration instances to the same folder using the paths
405
+ # resolved for the RawData instance above.
412
406
 
413
407
  # Dumps the acquisition system's configuration data to session's folder
414
408
  acquisition_system.save(path=instance.raw_data.system_configuration_path)
@@ -29,7 +29,6 @@ class RawData:
29
29
  session_descriptor_path: Path = ...
30
30
  hardware_state_path: Path = ...
31
31
  surgery_metadata_path: Path = ...
32
- project_configuration_path: Path = ...
33
32
  session_data_path: Path = ...
34
33
  experiment_configuration_path: Path = ...
35
34
  mesoscope_positions_path: Path = ...
@@ -38,8 +37,8 @@ class RawData:
38
37
  checksum_path: Path = ...
39
38
  telomere_path: Path = ...
40
39
  ubiquitin_path: Path = ...
40
+ nk_path: Path = ...
41
41
  integrity_verification_tracker_path: Path = ...
42
- version_data_path: Path = ...
43
42
  def resolve_paths(self, root_directory_path: Path) -> None:
44
43
  """Resolves all paths managed by the class instance based on the input root directory path.
45
44
 
@@ -140,9 +139,9 @@ class SessionData(YamlConfig):
140
139
 
141
140
  This method automatically dumps the data of the created SessionData instance into the session_data.yaml file
142
141
  inside the root raw_data directory of the created hierarchy. It also finds and dumps other configuration
143
- files, such as project_configuration.yaml, experiment_configuration.yaml, and system_configuration.yaml into
144
- the same raw_data directory. This ensures that if the session's runtime is interrupted unexpectedly, the
145
- acquired data can still be processed.
142
+ files, such as experiment_configuration.yaml and system_configuration.yaml into the same raw_data directory.
143
+ This ensures that if the session's runtime is interrupted unexpectedly, the acquired data can still be
144
+ processed.
146
145
 
147
146
  Args:
148
147
  project_name: The name of the project for which the data is acquired.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sl-shared-assets
3
- Version: 3.0.0rc6
3
+ Version: 3.0.0rc8
4
4
  Summary: Provides data acquisition and processing assets shared between Sun (NeuroAI) lab libraries.
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/
@@ -1,16 +1,16 @@
1
- sl_shared_assets/__init__.py,sha256=tNLUHtKWe-yn7LfvDv4kOqr2NLRf5BFD1MCyuVwdU6M,2199
2
- sl_shared_assets/__init__.pyi,sha256=WhQ5s5_vvTbMEtZ9F_8jYC0dJar2XAUzYnDqKsm6zNk,2402
1
+ sl_shared_assets/__init__.py,sha256=RzYuJclcE8EpbAC1wRb6eFIycPpsEmNvGkndrIxtmis,2197
2
+ sl_shared_assets/__init__.pyi,sha256=58fHlHTVMfrX4wDnYC2U_mkNMefw7odPn29nN1UnxFU,2399
3
3
  sl_shared_assets/cli.py,sha256=R_h_Dlla48mG1LpFDDE9flZ_NyDC9UguRUAYZL6gA9s,18383
4
4
  sl_shared_assets/cli.pyi,sha256=8ZJK56_jh2QlF3XCN6c7fI6Z022XtehB0eCrQDJbAsU,5515
5
5
  sl_shared_assets/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- sl_shared_assets/data_classes/__init__.py,sha256=B-kR3bGEUwuAk1q3DmwiYi1w-OeiBl9uI0K3PW4Z3RQ,1854
7
- sl_shared_assets/data_classes/__init__.pyi,sha256=YKK9Dx5RtylJLfVjgw5grLLH0FNr5FcnKrEZIMfTk0Q,2025
8
- sl_shared_assets/data_classes/configuration_data.py,sha256=CHoKs4wgg_qMNbvZHxfJJHLkeNbnUCevNG1PfiKu9kk,33786
9
- sl_shared_assets/data_classes/configuration_data.pyi,sha256=SpVnTcAVmR7uDSECbmR4wDmNdTEtavRn8gjI9Lhi5dI,10721
6
+ sl_shared_assets/data_classes/__init__.py,sha256=SUDN7gFngUPEa7Da_G0PjXwnF9Q0S4EgvjpKe3KSr5g,1852
7
+ sl_shared_assets/data_classes/__init__.pyi,sha256=J-tUXAtGEasacVU1qGFFksvfB1tFdEO-GKs90vSTAcg,2022
8
+ sl_shared_assets/data_classes/configuration_data.py,sha256=0uKfFrUO-9xI3MvWNf2xxGZ_RuxJ7MW3yjHXAqPNPeA,34782
9
+ sl_shared_assets/data_classes/configuration_data.pyi,sha256=DNsz6HCs0cPBP7Sn7G_-Y9z_fTFd0ub2s-97wlrPcb4,10723
10
10
  sl_shared_assets/data_classes/runtime_data.py,sha256=O98BZg7i7cEUlpIE16JswKOwQNRsS5RxVdBzXYvAw00,16543
11
11
  sl_shared_assets/data_classes/runtime_data.pyi,sha256=i8CuZd9p0Nu43xhpE62pB07AiovZIgtMZYN5wQjz-r0,6861
12
- sl_shared_assets/data_classes/session_data.py,sha256=aA-LSFM83ZRpD1fhtiBCmb9NEuLpTUx3Sb6XPu7gYMA,44998
13
- sl_shared_assets/data_classes/session_data.pyi,sha256=4vkQu5NFfM5kXcVds3otd8Ep1tObLTTonFjyXrS2Afs,13736
12
+ sl_shared_assets/data_classes/session_data.py,sha256=3MwnDSUJt4PLMcFfQMg7gt5ogoxP2kuc6n98qYFldOc,44699
13
+ sl_shared_assets/data_classes/session_data.pyi,sha256=rgab48TLjWMtSIg2qIuXRG1rQhs_2WfItjEl-MaRW8U,13654
14
14
  sl_shared_assets/data_classes/surgery_data.py,sha256=qsMj3NkjhylAT9b_wHBY-1XwTu2xsZcZatdECmkA7Bs,7437
15
15
  sl_shared_assets/data_classes/surgery_data.pyi,sha256=rf59lJ3tGSYKHQlEGXg75MnjajBwl0DYhL4TClAO4SM,2605
16
16
  sl_shared_assets/server/__init__.py,sha256=w7y73RXXjBrWQsjU5g1QNCv_gsXDYnHos3NpOoR2AHA,452
@@ -29,8 +29,8 @@ sl_shared_assets/tools/project_management_tools.py,sha256=Z_U0R26w9Le1O-u66gyF5C
29
29
  sl_shared_assets/tools/project_management_tools.pyi,sha256=4kok98nOZ4KnT-Sg-ZCZYg-WIM5qZqiyK8g1XiiDjHM,10375
30
30
  sl_shared_assets/tools/transfer_tools.py,sha256=J26kwOp_NpPSY0-xu5FTw9udte-rm_mW1FJyaTNoqQI,6606
31
31
  sl_shared_assets/tools/transfer_tools.pyi,sha256=FoH7eYZe7guGHfPr0MK5ggO62uXKwD2aJ7h1Bu7PaEE,3294
32
- sl_shared_assets-3.0.0rc6.dist-info/METADATA,sha256=eyfN8WiE6r7cK7hUvcJB9w9xEgUfStk6cHdKFl8eZMM,49309
33
- sl_shared_assets-3.0.0rc6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
- sl_shared_assets-3.0.0rc6.dist-info/entry_points.txt,sha256=UmO1rl7ly9N7HWPwWyP9E0b5KBUStpBo4TRoqNtizDY,430
35
- sl_shared_assets-3.0.0rc6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
- sl_shared_assets-3.0.0rc6.dist-info/RECORD,,
32
+ sl_shared_assets-3.0.0rc8.dist-info/METADATA,sha256=pvUOjPIynm4Ue5yT2eV4eg4-cNw8_fGT_HPot8lbRcE,49309
33
+ sl_shared_assets-3.0.0rc8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
+ sl_shared_assets-3.0.0rc8.dist-info/entry_points.txt,sha256=UmO1rl7ly9N7HWPwWyP9E0b5KBUStpBo4TRoqNtizDY,430
35
+ sl_shared_assets-3.0.0rc8.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
+ sl_shared_assets-3.0.0rc8.dist-info/RECORD,,