sl-shared-assets 3.0.0rc9__tar.gz → 3.0.0rc11__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-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/PKG-INFO +2 -4
  2. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/pyproject.toml +2 -3
  3. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/__init__.py +4 -0
  4. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/__init__.pyi +4 -0
  5. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/__init__.py +4 -1
  6. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/__init__.pyi +4 -0
  7. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/configuration_data.py +53 -43
  8. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/configuration_data.pyi +22 -16
  9. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/runtime_data.py +57 -48
  10. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/runtime_data.pyi +34 -31
  11. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/session_data.py +168 -126
  12. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/session_data.pyi +94 -59
  13. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/surgery_data.py +1 -1
  14. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/ascension_tools.py +3 -3
  15. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/ascension_tools.pyi +1 -0
  16. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/.gitignore +0 -0
  17. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/LICENSE +0 -0
  18. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/README.md +0 -0
  19. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/docs/Makefile +0 -0
  20. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/docs/make.bat +0 -0
  21. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/docs/source/api.rst +0 -0
  22. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/docs/source/conf.py +0 -0
  23. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/docs/source/index.rst +0 -0
  24. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/docs/source/welcome.rst +0 -0
  25. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/envs/slsa_dev_lin.yml +0 -0
  26. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/envs/slsa_dev_lin_spec.txt +0 -0
  27. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/cli.py +0 -0
  28. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/cli.pyi +0 -0
  29. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/data_classes/surgery_data.pyi +0 -0
  30. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/py.typed +0 -0
  31. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/server/__init__.py +0 -0
  32. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/server/__init__.pyi +0 -0
  33. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/server/job.py +0 -0
  34. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/server/job.pyi +0 -0
  35. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/server/server.py +0 -0
  36. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/server/server.pyi +0 -0
  37. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/__init__.py +0 -0
  38. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/__init__.pyi +0 -0
  39. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/packaging_tools.py +0 -0
  40. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/packaging_tools.pyi +0 -0
  41. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/project_management_tools.py +0 -0
  42. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/project_management_tools.pyi +0 -0
  43. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/transfer_tools.py +0 -0
  44. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/src/sl_shared_assets/tools/transfer_tools.pyi +0 -0
  45. {sl_shared_assets-3.0.0rc9 → sl_shared_assets-3.0.0rc11}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sl-shared-assets
3
- Version: 3.0.0rc9
3
+ Version: 3.0.0rc11
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/
@@ -691,7 +691,7 @@ Classifier: Programming Language :: Python :: 3.12
691
691
  Classifier: Programming Language :: Python :: 3.13
692
692
  Requires-Python: >=3.11
693
693
  Requires-Dist: appdirs==1.4.4
694
- Requires-Dist: ataraxis-base-utilities==3.0.1
694
+ Requires-Dist: ataraxis-base-utilities==3.1.0
695
695
  Requires-Dist: ataraxis-data-structures==3.1.1
696
696
  Requires-Dist: ataraxis-time==3.0.0
697
697
  Requires-Dist: click==8.2.1
@@ -706,7 +706,6 @@ Requires-Dist: simple-slurm==0.3.6
706
706
  Requires-Dist: tqdm==4.67.1
707
707
  Requires-Dist: xxhash==3.5.0
708
708
  Provides-Extra: conda
709
- Requires-Dist: grayskull<3,>=2; extra == 'conda'
710
709
  Requires-Dist: hatchling<2,>=1; extra == 'conda'
711
710
  Requires-Dist: importlib-metadata<9,>=8; extra == 'conda'
712
711
  Requires-Dist: mypy<2,>=1; extra == 'conda'
@@ -734,7 +733,6 @@ Requires-Dist: tqdm==4.67.1; extra == 'condarun'
734
733
  Provides-Extra: dev
735
734
  Requires-Dist: ataraxis-automation<6,>=5; extra == 'dev'
736
735
  Requires-Dist: build<2,>=1; extra == 'dev'
737
- Requires-Dist: grayskull<3,>=2; extra == 'dev'
738
736
  Requires-Dist: hatchling<2,>=1; extra == 'dev'
739
737
  Requires-Dist: importlib-metadata<9,>=8; extra == 'dev'
740
738
  Requires-Dist: mypy<2,>=1; extra == 'dev'
@@ -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 = "3.0.0rc9"
11
+ version = "3.0.0rc11"
12
12
  description = "Provides data acquisition and processing assets shared between Sun (NeuroAI) lab libraries."
13
13
  readme = "README.md"
14
14
  license = { file = "LICENSE" }
@@ -42,7 +42,7 @@ classifiers = [
42
42
  # Runtime project dependencies. This overlaps with the 'condarun' optional list.
43
43
  dependencies = [
44
44
  "ataraxis-time==3.0.0",
45
- "ataraxis-base-utilities==3.0.1",
45
+ "ataraxis-base-utilities==3.1.0",
46
46
  "ataraxis-data-structures==3.1.1",
47
47
  "numpy==2.2.6",
48
48
  "appdirs==1.4.4",
@@ -100,7 +100,6 @@ conda = [
100
100
 
101
101
  # Distribution
102
102
  "twine>=6,<7",
103
- "grayskull>=2,<3",
104
103
 
105
104
  # Types:
106
105
  "types-appdirs>=1,<2",
@@ -20,6 +20,7 @@ from .data_classes import (
20
20
  SessionData,
21
21
  SubjectData,
22
22
  SurgeryData,
23
+ SessionTypes,
23
24
  InjectionData,
24
25
  ProcedureData,
25
26
  ProcessedData,
@@ -29,6 +30,7 @@ from .data_classes import (
29
30
  ExperimentTrial,
30
31
  MesoscopeCameras,
31
32
  ProcessingTracker,
33
+ AcquisitionSystems,
32
34
  MesoscopePositions,
33
35
  RunTrainingDescriptor,
34
36
  LickTrainingDescriptor,
@@ -79,6 +81,8 @@ __all__ = [
79
81
  "get_system_configuration_data",
80
82
  "set_system_configuration_file",
81
83
  "ExperimentTrial",
84
+ "SessionTypes",
85
+ "AcquisitionSystems",
82
86
  # Tools package
83
87
  "resolve_p53_marker",
84
88
  "transfer_directory",
@@ -16,6 +16,7 @@ from .data_classes import (
16
16
  SessionData as SessionData,
17
17
  SubjectData as SubjectData,
18
18
  SurgeryData as SurgeryData,
19
+ SessionTypes as SessionTypes,
19
20
  InjectionData as InjectionData,
20
21
  ProcedureData as ProcedureData,
21
22
  ProcessedData as ProcessedData,
@@ -25,6 +26,7 @@ from .data_classes import (
25
26
  ExperimentTrial as ExperimentTrial,
26
27
  MesoscopeCameras as MesoscopeCameras,
27
28
  ProcessingTracker as ProcessingTracker,
29
+ AcquisitionSystems as AcquisitionSystems,
28
30
  MesoscopePositions as MesoscopePositions,
29
31
  RunTrainingDescriptor as RunTrainingDescriptor,
30
32
  LickTrainingDescriptor as LickTrainingDescriptor,
@@ -69,6 +71,8 @@ __all__ = [
69
71
  "get_system_configuration_data",
70
72
  "set_system_configuration_file",
71
73
  "ExperimentTrial",
74
+ "SessionTypes",
75
+ "AcquisitionSystems",
72
76
  "resolve_p53_marker",
73
77
  "transfer_directory",
74
78
  "calculate_directory_checksum",
@@ -11,7 +11,7 @@ from .runtime_data import (
11
11
  MesoscopeHardwareState,
12
12
  MesoscopeExperimentDescriptor,
13
13
  )
14
- from .session_data import RawData, SessionData, ProcessedData, ProcessingTracker
14
+ from .session_data import RawData, SessionData, SessionTypes, ProcessedData, ProcessingTracker
15
15
  from .surgery_data import (
16
16
  DrugData,
17
17
  ImplantData,
@@ -25,6 +25,7 @@ from .configuration_data import (
25
25
  ExperimentState,
26
26
  ExperimentTrial,
27
27
  MesoscopeCameras,
28
+ AcquisitionSystems,
28
29
  MesoscopeMicroControllers,
29
30
  MesoscopeAdditionalFirmware,
30
31
  MesoscopeSystemConfiguration,
@@ -60,4 +61,6 @@ __all__ = [
60
61
  "MesoscopeAdditionalFirmware",
61
62
  "ProcessingTracker",
62
63
  "ExperimentTrial",
64
+ "AcquisitionSystems",
65
+ "SessionTypes",
63
66
  ]
@@ -9,6 +9,7 @@ from .runtime_data import (
9
9
  from .session_data import (
10
10
  RawData as RawData,
11
11
  SessionData as SessionData,
12
+ SessionTypes as SessionTypes,
12
13
  ProcessedData as ProcessedData,
13
14
  ProcessingTracker as ProcessingTracker,
14
15
  )
@@ -25,6 +26,7 @@ from .configuration_data import (
25
26
  ExperimentState as ExperimentState,
26
27
  ExperimentTrial as ExperimentTrial,
27
28
  MesoscopeCameras as MesoscopeCameras,
29
+ AcquisitionSystems as AcquisitionSystems,
28
30
  MesoscopeMicroControllers as MesoscopeMicroControllers,
29
31
  MesoscopeAdditionalFirmware as MesoscopeAdditionalFirmware,
30
32
  MesoscopeSystemConfiguration as MesoscopeSystemConfiguration,
@@ -60,4 +62,6 @@ __all__ = [
60
62
  "MesoscopeAdditionalFirmware",
61
63
  "ProcessingTracker",
62
64
  "ExperimentTrial",
65
+ "AcquisitionSystems",
66
+ "SessionTypes",
63
67
  ]
@@ -3,6 +3,7 @@ projects use classes from this module to configure experiment runtimes and deter
3
3
  particular data acquisition and runtime management system (hardware) they run on."""
4
4
 
5
5
  import copy
6
+ from enum import StrEnum
6
7
  from pathlib import Path
7
8
  from dataclasses import field, dataclass
8
9
 
@@ -11,16 +12,23 @@ from ataraxis_base_utilities import LogLevel, console, ensure_directory_exists
11
12
  from ataraxis_data_structures import YamlConfig
12
13
 
13
14
 
15
+ class AcquisitionSystems(StrEnum):
16
+ """Defines the set of data acquisition systems used in the Sun lab and supported by all data-related libraries."""
17
+
18
+ MESOSCOPE_VR = "mesoscope-vr"
19
+ """The Mesoscope-VR data acquisition system. It is built around 2-Photon Random Access Mesoscope (2P-RAM) and
20
+ relies on Unity-backed virtual reality task-environments to conduct experiments."""
21
+
22
+
14
23
  @dataclass()
15
24
  class ExperimentState:
16
25
  """Encapsulates the information used to set and maintain the desired experiment and system state.
17
26
 
18
- Broadly, each experiment runtime can be conceptualized as a two state-system. The first state is that of the
19
- experimental task, which reflects the behavior goal, the rules for achieving the goal, and the reward for
20
- achieving the goal. The second state is that of the data acquisition and experiment control system, which is a
21
- snapshot of all hardware module states that make up the system that acquires the data and controls the task
22
- environment. Overall, experiment state is about 'what the animal is doing', while the system state is about
23
- 'what the hardware is doing'.
27
+ Broadly, each experiment runtime can be conceptualized as a two state-system. The first is the experiment task,
28
+ which reflects the behavior goal, the rules for achieving the goal, and the reward for achieving the goal. The
29
+ second is the data acquisition system state, which is a snapshot of all hardware module states that make up the
30
+ system that acquires the data and controls the task environment. Overall, experiment state is about
31
+ 'what the animal is doing', while the system state is about 'what the hardware is doing'.
24
32
 
25
33
  Note:
26
34
  This class is acquisition-system-agnostic. It can be used to define the ExperimentConfiguration class for any
@@ -35,24 +43,25 @@ class ExperimentState:
35
43
  while maintaining the same experiment state."""
36
44
  system_state_code: int
37
45
  """One of the supported system state-codes. Note, the meaning of each system state code depends on the specific
38
- data acquisition and experiment control system used by the project. For example, projects using the 'mesoscope-vr'
39
- system currently support two system state codes: REST (1) and RUN (2)."""
46
+ data acquisition and experiment control system used by the project. For details on available system-states, see
47
+ the sl-experiment library documentation."""
40
48
  state_duration_s: float
41
- """The time, in seconds, to maintain the current combination of the experiment and system states."""
49
+ """The time, in seconds, to maintain the experiment and system state combination specified by this instance."""
42
50
  initial_guided_trials: int
43
- """Specifies the number of trials (laps) at the onset of the experiment state, for which lick guidance will be
44
- automatically enabled. Specifically, if the experiment state supports running linearized Virtual Reality track, the
45
- system will enable lick guidance for this many trials at the beginning of the experiment state and automatically
46
- disable it for the following trials."""
47
- failed_trial_threshold: int
48
- """Specifies the number of failed (non-rewarded) non-guided trials (laps), after which the system will re-enable
49
- guidance for the 'recovery_guided_trials' number of following trials. For this to take effect, the trials must be
50
- failed this many times in a row."""
51
+ """The number of trials (laps) at the onset of the experiment state, for which to enable lick guidance. This
52
+ determines the number of trials, counting from the onset of the experiment state, for which the animal will receive
53
+ water rewards from entering the reward zone. Once the specified number of guided trial passes, the system disables
54
+ guidance, requiring the animal to lick in the reward zone to get water rewards."""
55
+ recovery_failed_trial_threshold: int
56
+ """Specifies the number of failed (non-rewarded) trials (laps), after which the system will re-enable lick guidance
57
+ for the 'recovery_guided_trials' number of following trials. Note, engaging the recovery guided trial system
58
+ requires the specified number of failed trials to occur sequentially."""
51
59
  recovery_guided_trials: int
52
- """Specifies the number of trials (laps) for which the system will re-enable lick guidance, when the animal
53
- repeatedly fails 'failed_trial_threshold' number of trials. This field works similar to the 'initial_guided_trials'
54
- field, but is triggered by repeated performance failures, rather than experiment state onset. After the animal
55
- runs this many guided trials, the system will automatically disable guidance for the following trials."""
60
+ """Specifies the number of trials (laps) for which the system should re-enable lick guidance, when the animal
61
+ sequentially fails 'failed_trial_threshold' number of trials. This field works similar to the
62
+ 'initial_guided_trials' field, but is triggered by repeated performance failures, rather than experiment state
63
+ onset. After the animal runs this many guided trials, the system automatically disables guidance for the following
64
+ trials."""
56
65
 
57
66
 
58
67
  @dataclass()
@@ -60,16 +69,15 @@ class ExperimentTrial:
60
69
  """Encapsulates information about a single experiment trial.
61
70
 
62
71
  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.
72
+ associated with a specific goal, for which animals receive water rewards. Since some experiments can use multiple
73
+ trial types as part of the same experiment session, multiple instances of this class can be used to specify
74
+ supported trial structures and trial parameters for a given experiment.
67
75
  """
68
76
 
69
77
  cue_sequence: list[int]
70
- """Specifies the sequence of wall cues experienced by the animal while running this trial."""
71
- trial_length_unity_unit: float
72
- """The length of the trial cue sequence, in Unity units."""
78
+ """Specifies the sequence of wall cues experienced by the animal while running this trial. Note, the cues must be
79
+ specified as integer-codes, where each code has the same meaning as in the 'cue_map' dictionary of the main
80
+ ExperimentConfiguration class for that experiment."""
73
81
  trial_length_cm: float
74
82
  """The length of the trial cue sequence in centimeters."""
75
83
  trial_reward_size_ul: float
@@ -89,10 +97,11 @@ class MesoscopeExperimentConfiguration(YamlConfig):
89
97
  """Stores the configuration of a single experiment runtime that uses the Mesoscope_VR data acquisition system.
90
98
 
91
99
  Primarily, this includes the sequence of experiment and system states that defines the flow of the experiment
92
- runtime. During runtime, the main runtime control function traverses the sequence of states stored in this class
93
- instance start-to-end in the exact order specified by the user. Together with custom Unity projects that define
94
- the task logic (how the system responds to animal interactions with the VR system) this class allows flexibly
95
- implementing a wide range of experiments using the Mesoscope-VR system.
100
+ runtime and the configuration of various trials supported by the experiment runtime. During runtime, the main
101
+ runtime control function traverses the sequence of states stored in this class instance start-to-end in the exact
102
+ order specified by the user. Together with custom Unity projects that define the task logic (how the system
103
+ responds to animal interactions with the VR system) this class allows flexibly implementing a wide range of
104
+ experiments using the Mesoscope-VR system.
96
105
 
97
106
  Each project should define one or more experiment configurations and save them as .yaml files inside the project
98
107
  'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
@@ -101,6 +110,8 @@ class MesoscopeExperimentConfiguration(YamlConfig):
101
110
  Notes:
102
111
  This class is designed exclusively for the Mesoscope-VR system. Any other system needs to define a separate
103
112
  ExperimentConfiguration class to specify its experiment runtimes and additional data.
113
+
114
+ To create a new experiment configuration, use the 'sl-create-experiment' CLI command.
104
115
  """
105
116
 
106
117
  cue_map: dict[int, float] = field(default_factory=lambda: {0: 30.0, 1: 30.0, 2: 30.0, 3: 30.0, 4: 30.0})
@@ -109,12 +120,12 @@ class MesoscopeExperimentConfiguration(YamlConfig):
109
120
  to travel to fully traverse the wall cue region from start to end."""
110
121
  cue_offset_cm: float = 10.0
111
122
  """Specifies the positive offset distance, in centimeters, by which the animal's running track is shifted
112
- relative to experiment environment onset. Due to how the VR environment is revealed to the animal, most runtimes
113
- need to shift the animal slightly forward relative to the track origin (0), to prevent it from seeing the area
114
- before the first VR wall cue when the task starts and when the animal is teleported to the beginning of the track.
115
- This offset statically shifts the entire track (in centimeters) against the set of VR wall cues used during
116
- runtime. Storing this static offset as part of experiment configuration is crucial for correctly interpreting the
117
- data acquiring during runtime."""
123
+ relative to VR wall cue sequence. Due to how the VR environment is revealed to the animal, most runtimes
124
+ need to shift the animal slightly forward relative to the VR cue sequence origin (0), to prevent it from seeing the
125
+ area before the first VR wall cue when the task starts and when the animal is teleported to the beginning of the
126
+ track. This offset statically shifts the entire track (in centimeters) against the set of VR wall cues used during
127
+ runtime. Storing this static offset as part of experiment configuration is crucial for correctly mapping what the
128
+ animal sees during runtime to the real-world distance it travels on the running wheel."""
118
129
  experiment_states: dict[str, ExperimentState] = field(
119
130
  default_factory=lambda: {
120
131
  "baseline": ExperimentState(
@@ -122,7 +133,7 @@ class MesoscopeExperimentConfiguration(YamlConfig):
122
133
  system_state_code=1,
123
134
  state_duration_s=30,
124
135
  initial_guided_trials=0,
125
- failed_trial_threshold=0,
136
+ recovery_failed_trial_threshold=0,
126
137
  recovery_guided_trials=0,
127
138
  ),
128
139
  "experiment": ExperimentState(
@@ -130,7 +141,7 @@ class MesoscopeExperimentConfiguration(YamlConfig):
130
141
  system_state_code=2,
131
142
  state_duration_s=120,
132
143
  initial_guided_trials=3,
133
- failed_trial_threshold=6,
144
+ recovery_failed_trial_threshold=6,
134
145
  recovery_guided_trials=3,
135
146
  ),
136
147
  "cooldown": ExperimentState(
@@ -138,7 +149,7 @@ class MesoscopeExperimentConfiguration(YamlConfig):
138
149
  system_state_code=1,
139
150
  state_duration_s=15,
140
151
  initial_guided_trials=1000000,
141
- failed_trial_threshold=0,
152
+ recovery_failed_trial_threshold=0,
142
153
  recovery_guided_trials=0,
143
154
  ),
144
155
  }
@@ -149,7 +160,6 @@ class MesoscopeExperimentConfiguration(YamlConfig):
149
160
  default_factory=lambda: {
150
161
  "cyclic_4_cue": ExperimentTrial(
151
162
  cue_sequence=[1, 0, 2, 0, 3, 0, 4, 0],
152
- trial_length_unity_unit=24.0,
153
163
  trial_length_cm=240.0,
154
164
  trial_reward_size_ul=5.0,
155
165
  reward_zone_start_cm=208.0,
@@ -158,7 +168,7 @@ class MesoscopeExperimentConfiguration(YamlConfig):
158
168
  )
159
169
  }
160
170
  )
161
- """A dictionary that maps human-readable trial structure names as keys and ExperimentTrial instances as values.
171
+ """A dictionary that uses human-readable trial structure names as keys and ExperimentTrial instances as values.
162
172
  Each ExperimentTrial instance specifies the Virtual Reality layout and runtime parameters associated with a single
163
173
  type of trials supported by the experiment runtime."""
164
174
 
@@ -1,19 +1,24 @@
1
+ from enum import StrEnum
1
2
  from pathlib import Path
2
3
  from dataclasses import field, dataclass
3
4
 
4
5
  from _typeshed import Incomplete
5
6
  from ataraxis_data_structures import YamlConfig
6
7
 
8
+ class AcquisitionSystems(StrEnum):
9
+ """Defines the set of data acquisition systems used in the Sun lab and supported by all data-related libraries."""
10
+
11
+ MESOSCOPE_VR = "mesoscope-vr"
12
+
7
13
  @dataclass()
8
14
  class ExperimentState:
9
15
  """Encapsulates the information used to set and maintain the desired experiment and system state.
10
16
 
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
+ Broadly, each experiment runtime can be conceptualized as a two state-system. The first is the experiment task,
18
+ which reflects the behavior goal, the rules for achieving the goal, and the reward for achieving the goal. The
19
+ second is the data acquisition system state, which is a snapshot of all hardware module states that make up the
20
+ system that acquires the data and controls the task environment. Overall, experiment state is about
21
+ 'what the animal is doing', while the system state is about 'what the hardware is doing'.
17
22
 
18
23
  Note:
19
24
  This class is acquisition-system-agnostic. It can be used to define the ExperimentConfiguration class for any
@@ -24,7 +29,7 @@ class ExperimentState:
24
29
  system_state_code: int
25
30
  state_duration_s: float
26
31
  initial_guided_trials: int
27
- failed_trial_threshold: int
32
+ recovery_failed_trial_threshold: int
28
33
  recovery_guided_trials: int
29
34
 
30
35
  @dataclass()
@@ -32,14 +37,12 @@ class ExperimentTrial:
32
37
  """Encapsulates information about a single experiment trial.
33
38
 
34
39
  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.
40
+ associated with a specific goal, for which animals receive water rewards. Since some experiments can use multiple
41
+ trial types as part of the same experiment session, multiple instances of this class can be used to specify
42
+ supported trial structures and trial parameters for a given experiment.
39
43
  """
40
44
 
41
45
  cue_sequence: list[int]
42
- trial_length_unity_unit: float
43
46
  trial_length_cm: float
44
47
  trial_reward_size_ul: float
45
48
  reward_zone_start_cm: float
@@ -51,10 +54,11 @@ class MesoscopeExperimentConfiguration(YamlConfig):
51
54
  """Stores the configuration of a single experiment runtime that uses the Mesoscope_VR data acquisition system.
52
55
 
53
56
  Primarily, this includes the sequence of experiment and system states that defines the flow of the experiment
54
- runtime. During runtime, the main runtime control function traverses the sequence of states stored in this class
55
- instance start-to-end in the exact order specified by the user. Together with custom Unity projects that define
56
- the task logic (how the system responds to animal interactions with the VR system) this class allows flexibly
57
- implementing a wide range of experiments using the Mesoscope-VR system.
57
+ runtime and the configuration of various trials supported by the experiment runtime. During runtime, the main
58
+ runtime control function traverses the sequence of states stored in this class instance start-to-end in the exact
59
+ order specified by the user. Together with custom Unity projects that define the task logic (how the system
60
+ responds to animal interactions with the VR system) this class allows flexibly implementing a wide range of
61
+ experiments using the Mesoscope-VR system.
58
62
 
59
63
  Each project should define one or more experiment configurations and save them as .yaml files inside the project
60
64
  'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
@@ -63,6 +67,8 @@ class MesoscopeExperimentConfiguration(YamlConfig):
63
67
  Notes:
64
68
  This class is designed exclusively for the Mesoscope-VR system. Any other system needs to define a separate
65
69
  ExperimentConfiguration class to specify its experiment runtimes and additional data.
70
+
71
+ To create a new experiment configuration, use the 'sl-create-experiment' CLI command.
66
72
  """
67
73
 
68
74
  cue_map: dict[int, float] = field(default_factory=Incomplete)
@@ -19,15 +19,15 @@ class MesoscopeHardwareState(YamlConfig):
19
19
 
20
20
  Notes:
21
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.
22
+ session runtime. This is in contrast to MesoscopeExperimentConfiguration class, which reflects the 'dynamic'
23
+ state of the Mesoscope-VR system during each experiment.
24
24
 
25
25
  This class partially overlaps with the MesoscopeSystemConfiguration class, which is also stored in the
26
26
  raw_data folder of each session. The primary reason to keep both classes is to ensure that the math (rounding)
27
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.
28
+ not do any rounding or otherwise attempt to be repeatable, which is in contrast to hardware modules that read
29
+ and apply those parameters. Reading values from this class guarantees the read value exactly matches the value
30
+ used during runtime.
31
31
 
32
32
  Notes:
33
33
  All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
@@ -35,17 +35,14 @@ class MesoscopeHardwareState(YamlConfig):
35
35
  any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
36
36
  module that provides this field's information.
37
37
 
38
- This class is automatically configured by _MesoscopeExperiment and _BehaviorTraining classes from sl-experiment
39
- library to facilitate log parsing.
38
+ This class is automatically configured by _MesoscopeVRSystem class from sl-experiment library to facilitate
39
+ proper log parsing.
40
40
  """
41
41
 
42
- cue_map: dict[int, float] | None = None
43
- """MesoscopeExperiment instance property. Stores the dictionary that maps the integer id-codes associated with each
44
- wall cue in the Virtual Reality task environment with distances in real-world centimeters animals should run on the
45
- wheel to fully traverse the cue region on a linearized track."""
46
42
  cm_per_pulse: float | None = None
47
43
  """EncoderInterface instance property. Stores the conversion factor used to translate encoder pulses into
48
- real-world centimeters."""
44
+ real-world centimeters. This conversion factor is fixed for each data acquisition system and does not change
45
+ between experiments."""
49
46
  maximum_break_strength: float | None = None
50
47
  """BreakInterface instance property. Stores the breaking torque, in Newton centimeters, applied by the break to
51
48
  the edge of the running wheel when it is engaged at 100% strength."""
@@ -75,10 +72,11 @@ class MesoscopeHardwareState(YamlConfig):
75
72
  the session runtime."""
76
73
  recorded_mesoscope_ttl: bool | None = None
77
74
  """TTLInterface instance property. A boolean flag that determines whether the processed session recorded brain
78
- activity data with the mesoscope."""
75
+ activity data with the mesoscope. In that case, attempts to parse the Mesoscope frame scanning TTL pulse data to
76
+ synchronize Mesoscope data to behavior data."""
79
77
  system_state_codes: dict[str, int] | None = None
80
- """A MesoscopeVRSystem property. A dictionary that maps integer state-codes used by the Mesoscope-VR system to
81
- communicate its states to human-readable state names."""
78
+ """A _MesoscopeVRSystem instance property. A dictionary that maps integer state-codes used by the Mesoscope-VR
79
+ system to communicate its states (system states) to human-readable state names."""
82
80
 
83
81
 
84
82
  @dataclass()
@@ -196,26 +194,40 @@ class MesoscopeExperimentDescriptor(YamlConfig):
196
194
  Sun lab automated processing and analysis."""
197
195
 
198
196
 
197
+ @dataclass()
198
+ class WindowCheckingDescriptor(YamlConfig):
199
+ """Stores the outcome information specific to window checking sessions that use the Mesoscope-VR system.
200
+
201
+ Notes:
202
+ Window Checking sessions are different from all other sessions. Unlike other sessions, their purpose is not to
203
+ generate data, but rather to assess the suitability of the particular animal to be included in training and
204
+ experiment cohorts. These sessions are automatically excluded from any automated data processing and analysis.
205
+ """
206
+
207
+ experimenter: str
208
+ """The ID of the experimenter running the session."""
209
+ experimenter_notes: str = "Replace this with your notes."
210
+ """The notes on the quality of the cranial window and animal's suitability for the target project."""
211
+ surgery_quality: int = 0
212
+ """The quality of the cranial window and surgical intervention on a scale from 0 (non-usable) to
213
+ 3 (high-tier publication grade) inclusive."""
214
+ incomplete: bool = True
215
+ """Window checking sessions are always considered 'incomplete', as they do not contain the full range of
216
+ information collected as part of a 'standard' behavior training or experiment session."""
217
+
218
+
199
219
  @dataclass()
200
220
  class ZaberPositions(YamlConfig):
201
221
  """Stores Zaber motor positions reused between experiment sessions that use the Mesoscope-VR system.
202
222
 
203
- The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
204
- (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
205
- Zaber motor positions across consecutive runtimes for the same project and animal combination.
223
+ The class is specifically designed to store, save, and load the positions of the LickPort, HeadBar, and Wheel motors
224
+ (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the
225
+ Zaber motors to the same positions across consecutive runtimes for the same project and animal combination.
206
226
 
207
227
  Notes:
208
- The HeadBar axis (connection) also manages the motor that moves the running wheel along the x-axis. While the
209
- motor itself is not part of the HeadBar assembly, it is related to positioning the mouse in the VR system. This
210
- is in contrast to the LickPort group, which is related to positioning the lick tube relative to the mouse.
211
-
212
- All positions are saved using native motor units. All class fields initialize to default placeholders that are
213
- likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
214
- certain they are safe to use.
215
-
216
- Exercise caution when working with Zaber motors. The motors are powerful enough to damage the surrounding
217
- equipment and manipulated objects. Do not modify the data stored inside the .yaml file unless you know what you
218
- are doing.
228
+ By default, the class initializes all fields to 0, which is the position of the home sensor for each motor. The
229
+ class assumes that the motor groups are assembled and arranged in a way that ensures all motors can safely move
230
+ to the home sensor positions from any runtime configuration.
219
231
  """
220
232
 
221
233
  headbar_z: int = 0
@@ -226,40 +238,37 @@ class ZaberPositions(YamlConfig):
226
238
  """The absolute position, in native motor units, of the HeadBar roll-axis motor."""
227
239
  lickport_z: int = 0
228
240
  """The absolute position, in native motor units, of the LickPort z-axis motor."""
229
- lickport_x: int = 0
230
- """The absolute position, in native motor units, of the LickPort x-axis motor."""
231
241
  lickport_y: int = 0
232
242
  """The absolute position, in native motor units, of the LickPort y-axis motor."""
243
+ lickport_x: int = 0
244
+ """The absolute position, in native motor units, of the LickPort x-axis motor."""
233
245
  wheel_x: int = 0
234
- """The absolute position, in native motor units, of the running wheel platform x-axis motor. Although this motor is
235
- not itself part of the HeadBar assembly, it is controlled through the HeadBar controller port."""
246
+ """The absolute position, in native motor units, of the running wheel platform x-axis motor."""
236
247
 
237
248
 
238
249
  @dataclass()
239
250
  class MesoscopePositions(YamlConfig):
240
- """Stores real and virtual Mesoscope objective positions reused between experiment sessions that use the
251
+ """Stores the positions of real and virtual Mesoscope objective axes reused between experiment sessions that use the
241
252
  Mesoscope-VR system.
242
253
 
243
- Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
244
- multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
245
- X, Y, Z, and Roll axes and the virtual (ScanImage software) tip, tilt, and fastZ focus axes.
246
-
247
- Notes:
248
- Since the API to read and write these positions automatically is currently not available, this class relies on
249
- the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
254
+ This class is designed to help the experimenter move the Mesoscope to the same imaging plane across imaging
255
+ sessions. It stores both the physical (real) position of the objective along the motorized X, Y, Z, and Roll axes,
256
+ and the virtual (ScanImage software) tip, tilt, and fastZ (virtual zoom) axes.
250
257
  """
251
258
 
252
259
  mesoscope_x: float = 0.0
253
- """The X-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
260
+ """The Mesoscope objective X-axis position, in centimeters."""
254
261
  mesoscope_y: float = 0.0
255
- """The Y-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
262
+ """The Mesoscope objective Y-axis position, in centimeters."""
256
263
  mesoscope_roll: float = 0.0
257
- """The Roll-axis position, in degrees, of the Mesoscope objective used during session runtime."""
264
+ """The Mesoscope objective Roll-axis position, in degrees."""
258
265
  mesoscope_z: float = 0.0
259
- """The Z-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
266
+ """The Mesoscope objective Z-axis position, in centimeters."""
260
267
  mesoscope_fast_z: float = 0.0
261
- """The Fast-Z-axis position, in micrometers, of the Mesoscope objective used during session runtime."""
268
+ """The ScanImage FastZ (virtual Z-axis) position, in micrometers."""
262
269
  mesoscope_tip: float = 0.0
263
- """The Tilt-axis position, in degrees, of the Mesoscope objective used during session runtime."""
270
+ """The ScanImage Tilt position, in degrees.."""
264
271
  mesoscope_tilt: float = 0.0
265
- """The Tip-axis position, in degrees, of the Mesoscope objective used during session runtime."""
272
+ """The ScanImage Tip position, in degrees."""
273
+ laser_power_mw: float = 0.0
274
+ """The laser excitation power at the sample, in milliwatts."""