sl-shared-assets 3.0.0rc9__py3-none-any.whl → 3.0.0rc11__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.
- sl_shared_assets/__init__.py +4 -0
- sl_shared_assets/__init__.pyi +4 -0
- sl_shared_assets/data_classes/__init__.py +4 -1
- sl_shared_assets/data_classes/__init__.pyi +4 -0
- sl_shared_assets/data_classes/configuration_data.py +53 -43
- sl_shared_assets/data_classes/configuration_data.pyi +22 -16
- sl_shared_assets/data_classes/runtime_data.py +57 -48
- sl_shared_assets/data_classes/runtime_data.pyi +34 -31
- sl_shared_assets/data_classes/session_data.py +168 -126
- sl_shared_assets/data_classes/session_data.pyi +94 -59
- sl_shared_assets/data_classes/surgery_data.py +1 -1
- sl_shared_assets/tools/ascension_tools.py +3 -3
- sl_shared_assets/tools/ascension_tools.pyi +1 -0
- {sl_shared_assets-3.0.0rc9.dist-info → sl_shared_assets-3.0.0rc11.dist-info}/METADATA +2 -4
- sl_shared_assets-3.0.0rc11.dist-info/RECORD +36 -0
- sl_shared_assets-3.0.0rc9.dist-info/RECORD +0 -36
- {sl_shared_assets-3.0.0rc9.dist-info → sl_shared_assets-3.0.0rc11.dist-info}/WHEEL +0 -0
- {sl_shared_assets-3.0.0rc9.dist-info → sl_shared_assets-3.0.0rc11.dist-info}/entry_points.txt +0 -0
- {sl_shared_assets-3.0.0rc9.dist-info → sl_shared_assets-3.0.0rc11.dist-info}/licenses/LICENSE +0 -0
sl_shared_assets/__init__.py
CHANGED
|
@@ -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",
|
sl_shared_assets/__init__.pyi
CHANGED
|
@@ -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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
39
|
-
|
|
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
|
|
49
|
+
"""The time, in seconds, to maintain the experiment and system state combination specified by this instance."""
|
|
42
50
|
initial_guided_trials: int
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"""Specifies the number of failed (non-rewarded)
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
53
|
-
|
|
54
|
-
field, but is triggered by repeated performance failures, rather than experiment state
|
|
55
|
-
runs this many guided trials, the system
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
72
|
-
|
|
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
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
113
|
-
need to shift the animal slightly forward relative to the
|
|
114
|
-
before the first VR wall cue when the task starts and when the animal is teleported to the beginning of the
|
|
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
|
|
117
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
|
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
|
|
29
|
-
those parameters. Reading values from this class guarantees the read value exactly matches the value
|
|
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
|
|
39
|
-
|
|
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
|
|
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
|
|
204
|
-
(axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the
|
|
205
|
-
Zaber
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
|
260
|
+
"""The Mesoscope objective X-axis position, in centimeters."""
|
|
254
261
|
mesoscope_y: float = 0.0
|
|
255
|
-
"""The Y-axis position, in centimeters
|
|
262
|
+
"""The Mesoscope objective Y-axis position, in centimeters."""
|
|
256
263
|
mesoscope_roll: float = 0.0
|
|
257
|
-
"""The Roll-axis position, in degrees
|
|
264
|
+
"""The Mesoscope objective Roll-axis position, in degrees."""
|
|
258
265
|
mesoscope_z: float = 0.0
|
|
259
|
-
"""The Z-axis position, in centimeters
|
|
266
|
+
"""The Mesoscope objective Z-axis position, in centimeters."""
|
|
260
267
|
mesoscope_fast_z: float = 0.0
|
|
261
|
-
"""The
|
|
268
|
+
"""The ScanImage FastZ (virtual Z-axis) position, in micrometers."""
|
|
262
269
|
mesoscope_tip: float = 0.0
|
|
263
|
-
"""The Tilt
|
|
270
|
+
"""The ScanImage Tilt position, in degrees.."""
|
|
264
271
|
mesoscope_tilt: float = 0.0
|
|
265
|
-
"""The Tip
|
|
272
|
+
"""The ScanImage Tip position, in degrees."""
|
|
273
|
+
laser_power_mw: float = 0.0
|
|
274
|
+
"""The laser excitation power at the sample, in milliwatts."""
|