sl-shared-assets 1.0.0rc13__py3-none-any.whl → 1.0.0rc15__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 +27 -9
- sl_shared_assets/__init__.pyi +71 -0
- sl_shared_assets/cli.py +13 -14
- sl_shared_assets/cli.pyi +28 -0
- sl_shared_assets/data_classes/__init__.py +63 -0
- sl_shared_assets/data_classes/__init__.pyi +61 -0
- sl_shared_assets/data_classes/configuration_data.py +64 -0
- sl_shared_assets/data_classes/configuration_data.pyi +37 -0
- sl_shared_assets/data_classes/runtime_data.py +233 -0
- sl_shared_assets/data_classes/runtime_data.pyi +145 -0
- sl_shared_assets/data_classes/session_data.py +1275 -0
- sl_shared_assets/data_classes/session_data.pyi +527 -0
- sl_shared_assets/data_classes/surgery_data.py +152 -0
- sl_shared_assets/data_classes/surgery_data.pyi +89 -0
- sl_shared_assets/server/__init__.py +8 -0
- sl_shared_assets/server/__init__.pyi +8 -0
- sl_shared_assets/server/job.py +140 -0
- sl_shared_assets/server/job.pyi +94 -0
- sl_shared_assets/server/server.py +213 -0
- sl_shared_assets/server/server.pyi +95 -0
- sl_shared_assets/suite2p/__init__.py +8 -0
- sl_shared_assets/suite2p/__init__.pyi +4 -0
- sl_shared_assets/suite2p/multi_day.py +193 -0
- sl_shared_assets/suite2p/multi_day.pyi +99 -0
- sl_shared_assets/{suite2p.py → suite2p/single_day.py} +55 -32
- sl_shared_assets/suite2p/single_day.pyi +192 -0
- sl_shared_assets/tools/__init__.py +8 -0
- sl_shared_assets/tools/__init__.pyi +5 -0
- sl_shared_assets/{ascension_tools.py → tools/ascension_tools.py} +3 -6
- sl_shared_assets/tools/ascension_tools.pyi +68 -0
- sl_shared_assets/tools/packaging_tools.pyi +52 -0
- sl_shared_assets/tools/transfer_tools.pyi +53 -0
- {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/METADATA +1 -1
- sl_shared_assets-1.0.0rc15.dist-info/RECORD +40 -0
- sl_shared_assets/data_classes.py +0 -1656
- sl_shared_assets/server.py +0 -293
- sl_shared_assets-1.0.0rc13.dist-info/RECORD +0 -14
- /sl_shared_assets/{packaging_tools.py → tools/packaging_tools.py} +0 -0
- /sl_shared_assets/{transfer_tools.py → tools/transfer_tools.py} +0 -0
- {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/WHEEL +0 -0
- {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/entry_points.txt +0 -0
- {sl_shared_assets-1.0.0rc13.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/licenses/LICENSE +0 -0
sl_shared_assets/__init__.py
CHANGED
|
@@ -5,42 +5,61 @@ API documentation: https://sl-shared-assets-api-docs.netlify.app/
|
|
|
5
5
|
Authors: Ivan Kondratyev (Inkaros), Kushaan Gupta, Yuantao Deng
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
from ataraxis_base_utilities import console
|
|
9
|
+
|
|
10
|
+
from .tools import transfer_directory, calculate_directory_checksum
|
|
8
11
|
from .server import Server, ServerCredentials
|
|
9
|
-
from .suite2p import
|
|
10
|
-
Suite2PConfiguration,
|
|
11
|
-
)
|
|
12
|
+
from .suite2p import MultiDayS2PConfiguration, SingleDayS2PConfiguration
|
|
12
13
|
from .data_classes import (
|
|
14
|
+
RawData,
|
|
13
15
|
DrugData,
|
|
14
16
|
ImplantData,
|
|
15
17
|
SessionData,
|
|
16
18
|
SubjectData,
|
|
17
19
|
SurgeryData,
|
|
18
20
|
InjectionData,
|
|
21
|
+
MesoscopeData,
|
|
19
22
|
ProcedureData,
|
|
23
|
+
ProcessedData,
|
|
24
|
+
DeepLabCutData,
|
|
20
25
|
ZaberPositions,
|
|
21
26
|
ExperimentState,
|
|
22
|
-
|
|
27
|
+
VRPCDestinations,
|
|
28
|
+
ConfigurationData,
|
|
23
29
|
MesoscopePositions,
|
|
30
|
+
VRPCPersistentData,
|
|
24
31
|
ProjectConfiguration,
|
|
25
32
|
HardwareConfiguration,
|
|
26
33
|
RunTrainingDescriptor,
|
|
27
34
|
LickTrainingDescriptor,
|
|
28
35
|
ExperimentConfiguration,
|
|
36
|
+
ScanImagePCPersistentData,
|
|
29
37
|
MesoscopeExperimentDescriptor,
|
|
30
38
|
)
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
|
|
40
|
+
# Ensures console is enabled when this library is imported
|
|
41
|
+
if not console.enabled:
|
|
42
|
+
console.enable()
|
|
33
43
|
|
|
34
44
|
__all__ = [
|
|
35
45
|
# Server module
|
|
36
46
|
"Server",
|
|
37
47
|
"ServerCredentials",
|
|
38
|
-
# Suite2p
|
|
39
|
-
"
|
|
48
|
+
# Suite2p package
|
|
49
|
+
"SingleDayS2PConfiguration",
|
|
50
|
+
"MultiDayS2PConfiguration",
|
|
40
51
|
# Data classes module
|
|
41
52
|
"DrugData",
|
|
42
53
|
"ImplantData",
|
|
43
54
|
"SessionData",
|
|
55
|
+
"RawData",
|
|
56
|
+
"ProcessedData",
|
|
57
|
+
"ConfigurationData",
|
|
58
|
+
"DeepLabCutData",
|
|
59
|
+
"VRPCPersistentData",
|
|
60
|
+
"ScanImagePCPersistentData",
|
|
61
|
+
"MesoscopeData",
|
|
62
|
+
"VRPCDestinations",
|
|
44
63
|
"SubjectData",
|
|
45
64
|
"SurgeryData",
|
|
46
65
|
"InjectionData",
|
|
@@ -54,7 +73,6 @@ __all__ = [
|
|
|
54
73
|
"LickTrainingDescriptor",
|
|
55
74
|
"ExperimentConfiguration",
|
|
56
75
|
"MesoscopeExperimentDescriptor",
|
|
57
|
-
"ProcessingTracker"
|
|
58
76
|
# Transfer tools module
|
|
59
77
|
"transfer_directory",
|
|
60
78
|
# Packaging tools module
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from .tools import (
|
|
2
|
+
transfer_directory as transfer_directory,
|
|
3
|
+
calculate_directory_checksum as calculate_directory_checksum,
|
|
4
|
+
)
|
|
5
|
+
from .server import (
|
|
6
|
+
Server as Server,
|
|
7
|
+
ServerCredentials as ServerCredentials,
|
|
8
|
+
)
|
|
9
|
+
from .suite2p import (
|
|
10
|
+
MultiDayS2PConfiguration as MultiDayS2PConfiguration,
|
|
11
|
+
SingleDayS2PConfiguration as SingleDayS2PConfiguration,
|
|
12
|
+
)
|
|
13
|
+
from .data_classes import (
|
|
14
|
+
RawData as RawData,
|
|
15
|
+
DrugData as DrugData,
|
|
16
|
+
ImplantData as ImplantData,
|
|
17
|
+
SessionData as SessionData,
|
|
18
|
+
SubjectData as SubjectData,
|
|
19
|
+
SurgeryData as SurgeryData,
|
|
20
|
+
InjectionData as InjectionData,
|
|
21
|
+
MesoscopeData as MesoscopeData,
|
|
22
|
+
ProcedureData as ProcedureData,
|
|
23
|
+
ProcessedData as ProcessedData,
|
|
24
|
+
DeepLabCutData as DeepLabCutData,
|
|
25
|
+
ZaberPositions as ZaberPositions,
|
|
26
|
+
ExperimentState as ExperimentState,
|
|
27
|
+
VRPCDestinations as VRPCDestinations,
|
|
28
|
+
ConfigurationData as ConfigurationData,
|
|
29
|
+
MesoscopePositions as MesoscopePositions,
|
|
30
|
+
VRPCPersistentData as VRPCPersistentData,
|
|
31
|
+
ProjectConfiguration as ProjectConfiguration,
|
|
32
|
+
HardwareConfiguration as HardwareConfiguration,
|
|
33
|
+
RunTrainingDescriptor as RunTrainingDescriptor,
|
|
34
|
+
LickTrainingDescriptor as LickTrainingDescriptor,
|
|
35
|
+
ExperimentConfiguration as ExperimentConfiguration,
|
|
36
|
+
ScanImagePCPersistentData as ScanImagePCPersistentData,
|
|
37
|
+
MesoscopeExperimentDescriptor as MesoscopeExperimentDescriptor,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"Server",
|
|
42
|
+
"ServerCredentials",
|
|
43
|
+
"SingleDayS2PConfiguration",
|
|
44
|
+
"MultiDayS2PConfiguration",
|
|
45
|
+
"DrugData",
|
|
46
|
+
"ImplantData",
|
|
47
|
+
"SessionData",
|
|
48
|
+
"RawData",
|
|
49
|
+
"ProcessedData",
|
|
50
|
+
"ConfigurationData",
|
|
51
|
+
"DeepLabCutData",
|
|
52
|
+
"VRPCPersistentData",
|
|
53
|
+
"ScanImagePCPersistentData",
|
|
54
|
+
"MesoscopeData",
|
|
55
|
+
"VRPCDestinations",
|
|
56
|
+
"SubjectData",
|
|
57
|
+
"SurgeryData",
|
|
58
|
+
"InjectionData",
|
|
59
|
+
"ProcedureData",
|
|
60
|
+
"ZaberPositions",
|
|
61
|
+
"ExperimentState",
|
|
62
|
+
"MesoscopePositions",
|
|
63
|
+
"ProjectConfiguration",
|
|
64
|
+
"HardwareConfiguration",
|
|
65
|
+
"RunTrainingDescriptor",
|
|
66
|
+
"LickTrainingDescriptor",
|
|
67
|
+
"ExperimentConfiguration",
|
|
68
|
+
"MesoscopeExperimentDescriptor",
|
|
69
|
+
"transfer_directory",
|
|
70
|
+
"calculate_directory_checksum",
|
|
71
|
+
]
|
sl_shared_assets/cli.py
CHANGED
|
@@ -4,9 +4,9 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
import click
|
|
6
6
|
|
|
7
|
+
from .tools import ascend_tyche_data
|
|
7
8
|
from .server import generate_server_credentials
|
|
8
9
|
from .data_classes import replace_root_path
|
|
9
|
-
from .ascension_tools import ascend_tyche_data
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@click.command()
|
|
@@ -22,9 +22,9 @@ def replace_local_root_directory(path: str) -> None:
|
|
|
22
22
|
"""Replaces the root directory used to store all lab projects on the local PC with the specified directory.
|
|
23
23
|
|
|
24
24
|
To ensure all projects are saved in the same location, this library resolves and saves the absolute path to the
|
|
25
|
-
project directory
|
|
26
|
-
|
|
27
|
-
path, if necessary.
|
|
25
|
+
project directory the first time ProjectConfiguration class instance is created on a new PC. All future projects
|
|
26
|
+
automatically reuse the same 'root' directory path. Since this information is stored in a typically hidden user
|
|
27
|
+
directory, this CLI can be used to replace the local directory path, if necessary.
|
|
28
28
|
"""
|
|
29
29
|
replace_root_path(path=Path(path))
|
|
30
30
|
|
|
@@ -35,8 +35,7 @@ def replace_local_root_directory(path: str) -> None:
|
|
|
35
35
|
"--output_directory",
|
|
36
36
|
type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
|
|
37
37
|
required=True,
|
|
38
|
-
|
|
39
|
-
help="The path to the directory where to create the credentials file.",
|
|
38
|
+
help="The absolute path to the directory where to create the credentials file.",
|
|
40
39
|
)
|
|
41
40
|
@click.option(
|
|
42
41
|
"-h",
|
|
@@ -64,7 +63,8 @@ def replace_local_root_directory(path: str) -> None:
|
|
|
64
63
|
def generate_server_credentials_file(output_directory: str, host: str, username: str, password: str) -> None:
|
|
65
64
|
"""Generates a new server_credentials.yaml file under the specified directory, using input information.
|
|
66
65
|
|
|
67
|
-
This CLI is used
|
|
66
|
+
This CLI is used to set up new PCs to work with the lab BioHPC server. While this is primarily intended for the
|
|
67
|
+
VRPC, any machined that interacts with BioHPC server can use this CLI to build the access credentials file.
|
|
68
68
|
"""
|
|
69
69
|
generate_server_credentials(
|
|
70
70
|
output_directory=Path(output_directory), username=username, password=password, host=host
|
|
@@ -77,7 +77,6 @@ def generate_server_credentials_file(output_directory: str, host: str, username:
|
|
|
77
77
|
"--path",
|
|
78
78
|
type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
|
|
79
79
|
required=True,
|
|
80
|
-
prompt="Enter the absolute path to the directory that stores original Tyche animal folders: ",
|
|
81
80
|
help="The absolute path to the directory that stores original Tyche animal folders.",
|
|
82
81
|
)
|
|
83
82
|
@click.option(
|
|
@@ -85,7 +84,6 @@ def generate_server_credentials_file(output_directory: str, host: str, username:
|
|
|
85
84
|
"--output_directory",
|
|
86
85
|
type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
|
|
87
86
|
required=True,
|
|
88
|
-
prompt="Enter the absolute path to the local directory where to create the ascended Tyche project hierarchy: ",
|
|
89
87
|
help="The absolute path to the local directory where to create the ascended Tyche project hierarchy.",
|
|
90
88
|
)
|
|
91
89
|
@click.option(
|
|
@@ -93,17 +91,18 @@ def generate_server_credentials_file(output_directory: str, host: str, username:
|
|
|
93
91
|
"--server_directory",
|
|
94
92
|
type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
|
|
95
93
|
required=True,
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
"hierarchy
|
|
94
|
+
help=(
|
|
95
|
+
"The path to the SMB-mounted BioHPC server directory where to transfer the ascended Tyche project "
|
|
96
|
+
"hierarchy after it is created."
|
|
99
97
|
),
|
|
100
|
-
help="The path to the SMB-mounted BioHPC server directory where to create the ascended Tyche project hierarchy.",
|
|
101
98
|
)
|
|
102
99
|
def ascend_tyche_directory(path: str, output_directory: str, server_directory: str) -> None:
|
|
103
100
|
"""Restructures old Tyche project data to use the modern Sun lab data structure.
|
|
104
101
|
|
|
105
102
|
This CLI is used to convert ('ascend') the old Tyche project data to the modern Sun lab structure. After
|
|
106
|
-
ascension, the data can be processed and analyzed using all modern Sun lab (sl-) tools and libraries.
|
|
103
|
+
ascension, the data can be processed and analyzed using all modern Sun lab (sl-) tools and libraries. Note, this
|
|
104
|
+
process expects the input data to be preprocessed using an old Sun lab mesoscope data preprocessing pipeline. It
|
|
105
|
+
will not work for any other project or data.
|
|
107
106
|
"""
|
|
108
107
|
ascend_tyche_data(
|
|
109
108
|
root_directory=Path(path),
|
sl_shared_assets/cli.pyi
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .tools import ascend_tyche_data as ascend_tyche_data
|
|
2
|
+
from .server import generate_server_credentials as generate_server_credentials
|
|
3
|
+
from .data_classes import replace_root_path as replace_root_path
|
|
4
|
+
|
|
5
|
+
def replace_local_root_directory(path: str) -> None:
|
|
6
|
+
"""Replaces the root directory used to store all lab projects on the local PC with the specified directory.
|
|
7
|
+
|
|
8
|
+
To ensure all projects are saved in the same location, this library resolves and saves the absolute path to the
|
|
9
|
+
project directory the first time ProjectConfiguration class instance is created on a new PC. All future projects
|
|
10
|
+
automatically reuse the same 'root' directory path. Since this information is stored in a typically hidden user
|
|
11
|
+
directory, this CLI can be used to replace the local directory path, if necessary.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def generate_server_credentials_file(output_directory: str, host: str, username: str, password: str) -> None:
|
|
15
|
+
"""Generates a new server_credentials.yaml file under the specified directory, using input information.
|
|
16
|
+
|
|
17
|
+
This CLI is used to set up new PCs to work with the lab BioHPC server. While this is primarily intended for the
|
|
18
|
+
VRPC, any machined that interacts with BioHPC server can use this CLI to build the access credentials file.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def ascend_tyche_directory(path: str, output_directory: str, server_directory: str) -> None:
|
|
22
|
+
"""Restructures old Tyche project data to use the modern Sun lab data structure.
|
|
23
|
+
|
|
24
|
+
This CLI is used to convert ('ascend') the old Tyche project data to the modern Sun lab structure. After
|
|
25
|
+
ascension, the data can be processed and analyzed using all modern Sun lab (sl-) tools and libraries. Note, this
|
|
26
|
+
process expects the input data to be preprocessed using an old Sun lab mesoscope data preprocessing pipeline. It
|
|
27
|
+
will not work for any other project or data.
|
|
28
|
+
"""
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""This package provides the classes used to store data acquired at various stages of the data workflow and to
|
|
2
|
+
configure various pipelines used in the Sun lab. These classes are used across all stages of data acquisition,
|
|
3
|
+
preprocessing, and processing in the lab, across multiple machines (PCs). Many classes in this package are designed to
|
|
4
|
+
be saved to disk as .yaml files and restored from the .yaml files as needed."""
|
|
5
|
+
|
|
6
|
+
from .runtime_data import (
|
|
7
|
+
ZaberPositions,
|
|
8
|
+
MesoscopePositions,
|
|
9
|
+
HardwareConfiguration,
|
|
10
|
+
RunTrainingDescriptor,
|
|
11
|
+
LickTrainingDescriptor,
|
|
12
|
+
MesoscopeExperimentDescriptor,
|
|
13
|
+
)
|
|
14
|
+
from .session_data import (
|
|
15
|
+
RawData,
|
|
16
|
+
SessionData,
|
|
17
|
+
MesoscopeData,
|
|
18
|
+
ProcessedData,
|
|
19
|
+
DeepLabCutData,
|
|
20
|
+
VRPCDestinations,
|
|
21
|
+
ConfigurationData,
|
|
22
|
+
VRPCPersistentData,
|
|
23
|
+
ProjectConfiguration,
|
|
24
|
+
ScanImagePCPersistentData,
|
|
25
|
+
replace_root_path,
|
|
26
|
+
)
|
|
27
|
+
from .surgery_data import (
|
|
28
|
+
DrugData,
|
|
29
|
+
ImplantData,
|
|
30
|
+
SubjectData,
|
|
31
|
+
SurgeryData,
|
|
32
|
+
InjectionData,
|
|
33
|
+
ProcedureData,
|
|
34
|
+
)
|
|
35
|
+
from .configuration_data import ExperimentState, ExperimentConfiguration
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"DrugData",
|
|
39
|
+
"ImplantData",
|
|
40
|
+
"SessionData",
|
|
41
|
+
"RawData",
|
|
42
|
+
"ProcessedData",
|
|
43
|
+
"ConfigurationData",
|
|
44
|
+
"DeepLabCutData",
|
|
45
|
+
"VRPCPersistentData",
|
|
46
|
+
"ScanImagePCPersistentData",
|
|
47
|
+
"MesoscopeData",
|
|
48
|
+
"VRPCDestinations",
|
|
49
|
+
"SubjectData",
|
|
50
|
+
"SurgeryData",
|
|
51
|
+
"InjectionData",
|
|
52
|
+
"ProcedureData",
|
|
53
|
+
"ZaberPositions",
|
|
54
|
+
"ExperimentState",
|
|
55
|
+
"MesoscopePositions",
|
|
56
|
+
"ProjectConfiguration",
|
|
57
|
+
"HardwareConfiguration",
|
|
58
|
+
"RunTrainingDescriptor",
|
|
59
|
+
"LickTrainingDescriptor",
|
|
60
|
+
"ExperimentConfiguration",
|
|
61
|
+
"MesoscopeExperimentDescriptor",
|
|
62
|
+
"replace_root_path",
|
|
63
|
+
]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from .runtime_data import (
|
|
2
|
+
ZaberPositions as ZaberPositions,
|
|
3
|
+
MesoscopePositions as MesoscopePositions,
|
|
4
|
+
HardwareConfiguration as HardwareConfiguration,
|
|
5
|
+
RunTrainingDescriptor as RunTrainingDescriptor,
|
|
6
|
+
LickTrainingDescriptor as LickTrainingDescriptor,
|
|
7
|
+
MesoscopeExperimentDescriptor as MesoscopeExperimentDescriptor,
|
|
8
|
+
)
|
|
9
|
+
from .session_data import (
|
|
10
|
+
RawData as RawData,
|
|
11
|
+
SessionData as SessionData,
|
|
12
|
+
MesoscopeData as MesoscopeData,
|
|
13
|
+
ProcessedData as ProcessedData,
|
|
14
|
+
DeepLabCutData as DeepLabCutData,
|
|
15
|
+
VRPCDestinations as VRPCDestinations,
|
|
16
|
+
ConfigurationData as ConfigurationData,
|
|
17
|
+
VRPCPersistentData as VRPCPersistentData,
|
|
18
|
+
ProjectConfiguration as ProjectConfiguration,
|
|
19
|
+
ScanImagePCPersistentData as ScanImagePCPersistentData,
|
|
20
|
+
replace_root_path as replace_root_path,
|
|
21
|
+
)
|
|
22
|
+
from .surgery_data import (
|
|
23
|
+
DrugData as DrugData,
|
|
24
|
+
ImplantData as ImplantData,
|
|
25
|
+
SubjectData as SubjectData,
|
|
26
|
+
SurgeryData as SurgeryData,
|
|
27
|
+
InjectionData as InjectionData,
|
|
28
|
+
ProcedureData as ProcedureData,
|
|
29
|
+
)
|
|
30
|
+
from .configuration_data import (
|
|
31
|
+
ExperimentState as ExperimentState,
|
|
32
|
+
ExperimentConfiguration as ExperimentConfiguration,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
"DrugData",
|
|
37
|
+
"ImplantData",
|
|
38
|
+
"SessionData",
|
|
39
|
+
"RawData",
|
|
40
|
+
"ProcessedData",
|
|
41
|
+
"ConfigurationData",
|
|
42
|
+
"DeepLabCutData",
|
|
43
|
+
"VRPCPersistentData",
|
|
44
|
+
"ScanImagePCPersistentData",
|
|
45
|
+
"MesoscopeData",
|
|
46
|
+
"VRPCDestinations",
|
|
47
|
+
"SubjectData",
|
|
48
|
+
"SurgeryData",
|
|
49
|
+
"InjectionData",
|
|
50
|
+
"ProcedureData",
|
|
51
|
+
"ZaberPositions",
|
|
52
|
+
"ExperimentState",
|
|
53
|
+
"MesoscopePositions",
|
|
54
|
+
"ProjectConfiguration",
|
|
55
|
+
"HardwareConfiguration",
|
|
56
|
+
"RunTrainingDescriptor",
|
|
57
|
+
"LickTrainingDescriptor",
|
|
58
|
+
"ExperimentConfiguration",
|
|
59
|
+
"MesoscopeExperimentDescriptor",
|
|
60
|
+
"replace_root_path",
|
|
61
|
+
]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""This module provides classes used to configure data acquisition and processing runtimes in the Sun lab.
|
|
2
|
+
Classes from this library are saved as .yaml files to be edited by the user when a new project and / or session
|
|
3
|
+
is created by the sl-experiment library. The runtime settings are then loaded from user-edited .yaml files by various
|
|
4
|
+
lab pipelines."""
|
|
5
|
+
|
|
6
|
+
import copy
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from dataclasses import field, dataclass
|
|
9
|
+
|
|
10
|
+
from ataraxis_data_structures import YamlConfig
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass()
|
|
14
|
+
class ExperimentState:
|
|
15
|
+
"""Encapsulates the information used to set and maintain the desired experiment and Mesoscope-VR system state.
|
|
16
|
+
|
|
17
|
+
Primarily, experiment runtime logic (task logic) is resolved by the Unity game engine. However, the Mesoscope-VR
|
|
18
|
+
system configuration may also need to change throughout the experiment to optimize the runtime by disabling or
|
|
19
|
+
reconfiguring specific hardware modules. For example, some experiment stages may require the running wheel to be
|
|
20
|
+
locked to prevent the animal from running, and other may require the VR screens to be turned off.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
experiment_state_code: int
|
|
24
|
+
"""The integer code of the experiment state. Experiment states do not have a predefined meaning, Instead, each
|
|
25
|
+
project is expected to define and follow its own experiment state code mapping. Typically, the experiment state
|
|
26
|
+
code is used to denote major experiment stages, such as 'baseline', 'task', 'cooldown', etc. Note, the same
|
|
27
|
+
experiment state code can be used by multiple sequential ExperimentState instances to change the VR system states
|
|
28
|
+
while maintaining the same experiment state."""
|
|
29
|
+
vr_state_code: int
|
|
30
|
+
"""One of the supported VR system state-codes. Currently, the Mesoscope-VR system supports two state codes. State
|
|
31
|
+
code '1' denotes 'REST' state and code '2' denotes 'RUN' state. Note, multiple consecutive ExperimentState
|
|
32
|
+
instances with different experiment state codes can reuse the same VR state code."""
|
|
33
|
+
state_duration_s: float
|
|
34
|
+
"""The time, in seconds, to maintain the current combination of the experiment and VR states."""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass()
|
|
38
|
+
class ExperimentConfiguration(YamlConfig):
|
|
39
|
+
"""Stores the configuration of a single experiment runtime.
|
|
40
|
+
|
|
41
|
+
Primarily, this includes the sequence of experiment and Virtual Reality (Mesoscope-VR) states that defines the flow
|
|
42
|
+
of the experiment runtime. During runtime, the main runtime control function traverses the sequence of states
|
|
43
|
+
stored in this class instance start-to-end in the exact order specified by the user. Together with custom Unity
|
|
44
|
+
projects that define the task logic (how the system responds to animal interactions with the VR system) this class
|
|
45
|
+
allows flexibly implementing a wide range of experiments.
|
|
46
|
+
|
|
47
|
+
Each project should define one or more experiment configurations and save them as .yaml files inside the project
|
|
48
|
+
'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
|
|
49
|
+
the experiment configuration when 'sl-run-experiment' CLI command exposed by the sl-experiment library is executed.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
cue_map: dict[int, float] = field(default_factory=lambda: {0: 30.0, 1: 30.0, 2: 30.0, 3: 30.0, 4: 30.0})
|
|
53
|
+
"""A dictionary that maps each integer-code associated with a wall cue used in the Virtual Reality experiment
|
|
54
|
+
environment to its length in real-world centimeters. It is used to map each VR cue to the distance the animal needs
|
|
55
|
+
to travel to fully traverse the wall cue region from start to end."""
|
|
56
|
+
experiment_states: dict[str, ExperimentState] = field(
|
|
57
|
+
default_factory=lambda: {
|
|
58
|
+
"baseline": ExperimentState(experiment_state_code=1, vr_state_code=1, state_duration_s=30),
|
|
59
|
+
"experiment": ExperimentState(experiment_state_code=2, vr_state_code=2, state_duration_s=120),
|
|
60
|
+
"cooldown": ExperimentState(experiment_state_code=3, vr_state_code=1, state_duration_s=15),
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
"""A dictionary that uses human-readable state-names as keys and ExperimentState instances as values. Each
|
|
64
|
+
ExperimentState instance represents a phase of the experiment."""
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from pathlib import Path as Path
|
|
2
|
+
from dataclasses import field, dataclass
|
|
3
|
+
|
|
4
|
+
from _typeshed import Incomplete
|
|
5
|
+
from ataraxis_data_structures import YamlConfig
|
|
6
|
+
|
|
7
|
+
@dataclass()
|
|
8
|
+
class ExperimentState:
|
|
9
|
+
"""Encapsulates the information used to set and maintain the desired experiment and Mesoscope-VR system state.
|
|
10
|
+
|
|
11
|
+
Primarily, experiment runtime logic (task logic) is resolved by the Unity game engine. However, the Mesoscope-VR
|
|
12
|
+
system configuration may also need to change throughout the experiment to optimize the runtime by disabling or
|
|
13
|
+
reconfiguring specific hardware modules. For example, some experiment stages may require the running wheel to be
|
|
14
|
+
locked to prevent the animal from running, and other may require the VR screens to be turned off.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
experiment_state_code: int
|
|
18
|
+
vr_state_code: int
|
|
19
|
+
state_duration_s: float
|
|
20
|
+
|
|
21
|
+
@dataclass()
|
|
22
|
+
class ExperimentConfiguration(YamlConfig):
|
|
23
|
+
"""Stores the configuration of a single experiment runtime.
|
|
24
|
+
|
|
25
|
+
Primarily, this includes the sequence of experiment and Virtual Reality (Mesoscope-VR) states that defines the flow
|
|
26
|
+
of the experiment runtime. During runtime, the main runtime control function traverses the sequence of states
|
|
27
|
+
stored in this class instance start-to-end in the exact order specified by the user. Together with custom Unity
|
|
28
|
+
projects that define the task logic (how the system responds to animal interactions with the VR system) this class
|
|
29
|
+
allows flexibly implementing a wide range of experiments.
|
|
30
|
+
|
|
31
|
+
Each project should define one or more experiment configurations and save them as .yaml files inside the project
|
|
32
|
+
'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
|
|
33
|
+
the experiment configuration when 'sl-run-experiment' CLI command exposed by the sl-experiment library is executed.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
cue_map: dict[int, float] = field(default_factory=Incomplete)
|
|
37
|
+
experiment_states: dict[str, ExperimentState] = field(default_factory=Incomplete)
|