sl-shared-assets 1.0.0rc14__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.

Files changed (42) hide show
  1. sl_shared_assets/__init__.py +21 -9
  2. sl_shared_assets/__init__.pyi +26 -6
  3. sl_shared_assets/cli.py +1 -1
  4. sl_shared_assets/cli.pyi +1 -1
  5. sl_shared_assets/data_classes/__init__.py +63 -0
  6. sl_shared_assets/data_classes/__init__.pyi +61 -0
  7. sl_shared_assets/data_classes/configuration_data.py +64 -0
  8. sl_shared_assets/data_classes/configuration_data.pyi +37 -0
  9. sl_shared_assets/data_classes/runtime_data.py +233 -0
  10. sl_shared_assets/data_classes/runtime_data.pyi +145 -0
  11. sl_shared_assets/{data_classes.py → data_classes/session_data.py} +47 -472
  12. sl_shared_assets/{data_classes.pyi → data_classes/session_data.pyi} +10 -282
  13. sl_shared_assets/data_classes/surgery_data.py +152 -0
  14. sl_shared_assets/data_classes/surgery_data.pyi +89 -0
  15. sl_shared_assets/server/__init__.py +8 -0
  16. sl_shared_assets/server/__init__.pyi +8 -0
  17. sl_shared_assets/server/job.py +140 -0
  18. sl_shared_assets/server/job.pyi +94 -0
  19. sl_shared_assets/server/server.py +213 -0
  20. sl_shared_assets/server/server.pyi +95 -0
  21. sl_shared_assets/suite2p/__init__.py +8 -0
  22. sl_shared_assets/suite2p/__init__.pyi +4 -0
  23. sl_shared_assets/suite2p/multi_day.py +193 -0
  24. sl_shared_assets/suite2p/multi_day.pyi +99 -0
  25. sl_shared_assets/{suite2p.py → suite2p/single_day.py} +55 -32
  26. sl_shared_assets/{suite2p.pyi → suite2p/single_day.pyi} +23 -19
  27. sl_shared_assets/tools/__init__.py +8 -0
  28. sl_shared_assets/tools/__init__.pyi +5 -0
  29. sl_shared_assets/{ascension_tools.py → tools/ascension_tools.py} +3 -2
  30. sl_shared_assets/{ascension_tools.pyi → tools/ascension_tools.pyi} +1 -1
  31. {sl_shared_assets-1.0.0rc14.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/METADATA +1 -1
  32. sl_shared_assets-1.0.0rc15.dist-info/RECORD +40 -0
  33. sl_shared_assets/server.py +0 -300
  34. sl_shared_assets/server.pyi +0 -117
  35. sl_shared_assets-1.0.0rc14.dist-info/RECORD +0 -22
  36. /sl_shared_assets/{packaging_tools.py → tools/packaging_tools.py} +0 -0
  37. /sl_shared_assets/{packaging_tools.pyi → tools/packaging_tools.pyi} +0 -0
  38. /sl_shared_assets/{transfer_tools.py → tools/transfer_tools.py} +0 -0
  39. /sl_shared_assets/{transfer_tools.pyi → tools/transfer_tools.pyi} +0 -0
  40. {sl_shared_assets-1.0.0rc14.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/WHEEL +0 -0
  41. {sl_shared_assets-1.0.0rc14.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/entry_points.txt +0 -0
  42. {sl_shared_assets-1.0.0rc14.dist-info → sl_shared_assets-1.0.0rc15.dist-info}/licenses/LICENSE +0 -0
@@ -7,31 +7,35 @@ Authors: Ivan Kondratyev (Inkaros), Kushaan Gupta, Yuantao Deng
7
7
 
8
8
  from ataraxis_base_utilities import console
9
9
 
10
+ from .tools import transfer_directory, calculate_directory_checksum
10
11
  from .server import Server, ServerCredentials
11
- from .suite2p import (
12
- Suite2PConfiguration,
13
- )
12
+ from .suite2p import MultiDayS2PConfiguration, SingleDayS2PConfiguration
14
13
  from .data_classes import (
14
+ RawData,
15
15
  DrugData,
16
16
  ImplantData,
17
17
  SessionData,
18
18
  SubjectData,
19
19
  SurgeryData,
20
20
  InjectionData,
21
+ MesoscopeData,
21
22
  ProcedureData,
23
+ ProcessedData,
24
+ DeepLabCutData,
22
25
  ZaberPositions,
23
26
  ExperimentState,
24
- ProcessingTracker,
27
+ VRPCDestinations,
28
+ ConfigurationData,
25
29
  MesoscopePositions,
30
+ VRPCPersistentData,
26
31
  ProjectConfiguration,
27
32
  HardwareConfiguration,
28
33
  RunTrainingDescriptor,
29
34
  LickTrainingDescriptor,
30
35
  ExperimentConfiguration,
36
+ ScanImagePCPersistentData,
31
37
  MesoscopeExperimentDescriptor,
32
38
  )
33
- from .transfer_tools import transfer_directory
34
- from .packaging_tools import calculate_directory_checksum
35
39
 
36
40
  # Ensures console is enabled when this library is imported
37
41
  if not console.enabled:
@@ -41,12 +45,21 @@ __all__ = [
41
45
  # Server module
42
46
  "Server",
43
47
  "ServerCredentials",
44
- # Suite2p module
45
- "Suite2PConfiguration",
48
+ # Suite2p package
49
+ "SingleDayS2PConfiguration",
50
+ "MultiDayS2PConfiguration",
46
51
  # Data classes module
47
52
  "DrugData",
48
53
  "ImplantData",
49
54
  "SessionData",
55
+ "RawData",
56
+ "ProcessedData",
57
+ "ConfigurationData",
58
+ "DeepLabCutData",
59
+ "VRPCPersistentData",
60
+ "ScanImagePCPersistentData",
61
+ "MesoscopeData",
62
+ "VRPCDestinations",
50
63
  "SubjectData",
51
64
  "SurgeryData",
52
65
  "InjectionData",
@@ -60,7 +73,6 @@ __all__ = [
60
73
  "LickTrainingDescriptor",
61
74
  "ExperimentConfiguration",
62
75
  "MesoscopeExperimentDescriptor",
63
- "ProcessingTracker",
64
76
  # Transfer tools module
65
77
  "transfer_directory",
66
78
  # Packaging tools module
@@ -1,37 +1,58 @@
1
+ from .tools import (
2
+ transfer_directory as transfer_directory,
3
+ calculate_directory_checksum as calculate_directory_checksum,
4
+ )
1
5
  from .server import (
2
6
  Server as Server,
3
7
  ServerCredentials as ServerCredentials,
4
8
  )
5
- from .suite2p import Suite2PConfiguration as Suite2PConfiguration
9
+ from .suite2p import (
10
+ MultiDayS2PConfiguration as MultiDayS2PConfiguration,
11
+ SingleDayS2PConfiguration as SingleDayS2PConfiguration,
12
+ )
6
13
  from .data_classes import (
14
+ RawData as RawData,
7
15
  DrugData as DrugData,
8
16
  ImplantData as ImplantData,
9
17
  SessionData as SessionData,
10
18
  SubjectData as SubjectData,
11
19
  SurgeryData as SurgeryData,
12
20
  InjectionData as InjectionData,
21
+ MesoscopeData as MesoscopeData,
13
22
  ProcedureData as ProcedureData,
23
+ ProcessedData as ProcessedData,
24
+ DeepLabCutData as DeepLabCutData,
14
25
  ZaberPositions as ZaberPositions,
15
26
  ExperimentState as ExperimentState,
16
- ProcessingTracker as ProcessingTracker,
27
+ VRPCDestinations as VRPCDestinations,
28
+ ConfigurationData as ConfigurationData,
17
29
  MesoscopePositions as MesoscopePositions,
30
+ VRPCPersistentData as VRPCPersistentData,
18
31
  ProjectConfiguration as ProjectConfiguration,
19
32
  HardwareConfiguration as HardwareConfiguration,
20
33
  RunTrainingDescriptor as RunTrainingDescriptor,
21
34
  LickTrainingDescriptor as LickTrainingDescriptor,
22
35
  ExperimentConfiguration as ExperimentConfiguration,
36
+ ScanImagePCPersistentData as ScanImagePCPersistentData,
23
37
  MesoscopeExperimentDescriptor as MesoscopeExperimentDescriptor,
24
38
  )
25
- from .transfer_tools import transfer_directory as transfer_directory
26
- from .packaging_tools import calculate_directory_checksum as calculate_directory_checksum
27
39
 
28
40
  __all__ = [
29
41
  "Server",
30
42
  "ServerCredentials",
31
- "Suite2PConfiguration",
43
+ "SingleDayS2PConfiguration",
44
+ "MultiDayS2PConfiguration",
32
45
  "DrugData",
33
46
  "ImplantData",
34
47
  "SessionData",
48
+ "RawData",
49
+ "ProcessedData",
50
+ "ConfigurationData",
51
+ "DeepLabCutData",
52
+ "VRPCPersistentData",
53
+ "ScanImagePCPersistentData",
54
+ "MesoscopeData",
55
+ "VRPCDestinations",
35
56
  "SubjectData",
36
57
  "SurgeryData",
37
58
  "InjectionData",
@@ -45,7 +66,6 @@ __all__ = [
45
66
  "LickTrainingDescriptor",
46
67
  "ExperimentConfiguration",
47
68
  "MesoscopeExperimentDescriptor",
48
- "ProcessingTracker",
49
69
  "transfer_directory",
50
70
  "calculate_directory_checksum",
51
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()
sl_shared_assets/cli.pyi CHANGED
@@ -1,6 +1,6 @@
1
+ from .tools import ascend_tyche_data as ascend_tyche_data
1
2
  from .server import generate_server_credentials as generate_server_credentials
2
3
  from .data_classes import replace_root_path as replace_root_path
3
- from .ascension_tools import ascend_tyche_data as ascend_tyche_data
4
4
 
5
5
  def replace_local_root_directory(path: str) -> None:
6
6
  """Replaces the root directory used to store all lab projects on the local PC with the specified directory.
@@ -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)
@@ -0,0 +1,233 @@
1
+ """This module provides classes used to store the training and experiment data acquired by the sl-experiment library.
2
+ Some classes from this library store raw data later processed by Sun lab data processing pipelines. Others are used to
3
+ restore the Mesoscope-VR system to the same state across training or experiment sessions of the same animal.
4
+ """
5
+
6
+ from dataclasses import dataclass
7
+
8
+ from ataraxis_data_structures import YamlConfig
9
+
10
+
11
+ @dataclass()
12
+ class HardwareConfiguration(YamlConfig):
13
+ """This class is used to save the runtime hardware configuration parameters as a .yaml file.
14
+
15
+ This information is used to read and decode the data saved to the .npz log files during runtime as part of data
16
+ processing.
17
+
18
+ Notes:
19
+ All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
20
+ module that provides the data stored in a field will be processed, unless that field is None. Therefore, setting
21
+ any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
22
+ module that provides this field's information.
23
+
24
+ This class is automatically configured by MesoscopeExperiment and BehaviorTraining classes from sl-experiment
25
+ library to facilitate log parsing.
26
+ """
27
+
28
+ cue_map: dict[int, float] | None = None
29
+ """MesoscopeExperiment instance property. Stores the dictionary that maps the integer id-codes associated with each
30
+ wall cue in the Virtual Reality task environment with distances in real-world centimeters animals should run on the
31
+ wheel to fully traverse the cue region on a linearized track."""
32
+ cm_per_pulse: float | None = None
33
+ """EncoderInterface instance property. Stores the conversion factor used to translate encoder pulses into
34
+ real-world centimeters."""
35
+ maximum_break_strength: float | None = None
36
+ """BreakInterface instance property. Stores the breaking torque, in Newton centimeters, applied by the break to
37
+ the edge of the running wheel when it is engaged at 100% strength."""
38
+ minimum_break_strength: float | None = None
39
+ """BreakInterface instance property. Stores the breaking torque, in Newton centimeters, applied by the break to
40
+ the edge of the running wheel when it is engaged at 0% strength (completely disengaged)."""
41
+ lick_threshold: int | None = None
42
+ """LickInterface instance property. Determines the threshold, in 12-bit Analog to Digital Converter (ADC) units,
43
+ above which an interaction value reported by the lick sensor is considered a lick (compared to noise or non-lick
44
+ touch)."""
45
+ valve_scale_coefficient: float | None = None
46
+ """ValveInterface instance property. To dispense precise water volumes during runtime, ValveInterface uses power
47
+ law equation applied to valve calibration data to determine how long to keep the valve open. This stores the
48
+ scale_coefficient of the power law equation that describes the relationship between valve open time and dispensed
49
+ water volume, derived from calibration data."""
50
+ valve_nonlinearity_exponent: float | None = None
51
+ """ValveInterface instance property. To dispense precise water volumes during runtime, ValveInterface uses power
52
+ law equation applied to valve calibration data to determine how long to keep the valve open. This stores the
53
+ nonlinearity_exponent of the power law equation that describes the relationship between valve open time and
54
+ dispensed water volume, derived from calibration data."""
55
+ torque_per_adc_unit: float | None = None
56
+ """TorqueInterface instance property. Stores the conversion factor used to translate torque values reported by the
57
+ sensor as 12-bit Analog to Digital Converter (ADC) units, into real-world Newton centimeters (N·cm) of torque that
58
+ had to be applied to the edge of the running wheel to produce the observed ADC value."""
59
+ screens_initially_on: bool | None = None
60
+ """ScreenInterface instance property. Stores the initial state of the Virtual Reality screens at the beginning of
61
+ the session runtime."""
62
+ recorded_mesoscope_ttl: bool | None = None
63
+ """TTLInterface instance property. A boolean flag that determines whether the processed session recorded brain
64
+ activity data with the mesoscope."""
65
+
66
+
67
+ @dataclass()
68
+ class LickTrainingDescriptor(YamlConfig):
69
+ """This class is used to save the description information specific to lick training sessions as a .yaml file.
70
+
71
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
72
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
73
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
74
+
75
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
76
+ trained animal.
77
+ """
78
+
79
+ experimenter: str
80
+ """The ID of the experimenter running the session."""
81
+ mouse_weight_g: float
82
+ """The weight of the animal, in grams, at the beginning of the session."""
83
+ dispensed_water_volume_ml: float
84
+ """Stores the total water volume, in milliliters, dispensed during runtime."""
85
+ minimum_reward_delay: int
86
+ """Stores the minimum delay, in seconds, that can separate the delivery of two consecutive water rewards."""
87
+ maximum_reward_delay_s: int
88
+ """Stores the maximum delay, in seconds, that can separate the delivery of two consecutive water rewards."""
89
+ maximum_water_volume_ml: float
90
+ """Stores the maximum volume of water the system is allowed to dispense during training."""
91
+ maximum_training_time_m: int
92
+ """Stores the maximum time, in minutes, the system is allowed to run the training for."""
93
+ experimenter_notes: str = "Replace this with your notes."
94
+ """This field is not set during runtime. It is expected that each experimenter replaces this field with their
95
+ notes made during runtime."""
96
+ experimenter_given_water_volume_ml: float = 0.0
97
+ """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
98
+ """
99
+
100
+
101
+ @dataclass()
102
+ class RunTrainingDescriptor(YamlConfig):
103
+ """This class is used to save the description information specific to run training sessions as a .yaml file.
104
+
105
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
106
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
107
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
108
+
109
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
110
+ trained animal.
111
+ """
112
+
113
+ experimenter: str
114
+ """The ID of the experimenter running the session."""
115
+ mouse_weight_g: float
116
+ """The weight of the animal, in grams, at the beginning of the session."""
117
+ dispensed_water_volume_ml: float
118
+ """Stores the total water volume, in milliliters, dispensed during runtime."""
119
+ final_run_speed_threshold_cm_s: float
120
+ """Stores the final running speed threshold, in centimeters per second, that was active at the end of training."""
121
+ final_run_duration_threshold_s: float
122
+ """Stores the final running duration threshold, in seconds, that was active at the end of training."""
123
+ initial_run_speed_threshold_cm_s: float
124
+ """Stores the initial running speed threshold, in centimeters per second, used during training."""
125
+ initial_run_duration_threshold_s: float
126
+ """Stores the initial running duration threshold, in seconds, used during training."""
127
+ increase_threshold_ml: float
128
+ """Stores the volume of water delivered to the animal, in milliliters, that triggers the increase in the running
129
+ speed and duration thresholds."""
130
+ run_speed_increase_step_cm_s: float
131
+ """Stores the value, in centimeters per second, used by the system to increment the running speed threshold each
132
+ time the animal receives 'increase_threshold' volume of water."""
133
+ run_duration_increase_step_s: float
134
+ """Stores the value, in seconds, used by the system to increment the duration threshold each time the animal
135
+ receives 'increase_threshold' volume of water."""
136
+ maximum_water_volume_ml: float
137
+ """Stores the maximum volume of water the system is allowed to dispense during training."""
138
+ maximum_training_time_m: int
139
+ """Stores the maximum time, in minutes, the system is allowed to run the training for."""
140
+ experimenter_notes: str = "Replace this with your notes."
141
+ """This field is not set during runtime. It is expected that each experimenter will replace this field with their
142
+ notes made during runtime."""
143
+ experimenter_given_water_volume_ml: float = 0.0
144
+ """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
145
+ """
146
+
147
+
148
+ @dataclass()
149
+ class MesoscopeExperimentDescriptor(YamlConfig):
150
+ """This class is used to save the description information specific to experiment sessions as a .yaml file.
151
+
152
+ The information stored in this class instance is filled in two steps. The main runtime function fills most fields
153
+ of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
154
+ such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
155
+
156
+ The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
157
+ animal participating in the experiment runtime.
158
+ """
159
+
160
+ experimenter: str
161
+ """The ID of the experimenter running the session."""
162
+ mouse_weight_g: float
163
+ """The weight of the animal, in grams, at the beginning of the session."""
164
+ dispensed_water_volume_ml: float
165
+ """Stores the total water volume, in milliliters, dispensed during runtime."""
166
+ experimenter_notes: str = "Replace this with your notes."
167
+ """This field is not set during runtime. It is expected that each experimenter will replace this field with their
168
+ notes made during runtime."""
169
+ experimenter_given_water_volume_ml: float = 0.0
170
+ """The additional volume of water, in milliliters, administered by the experimenter to the animal after the session.
171
+ """
172
+
173
+
174
+ @dataclass()
175
+ class ZaberPositions(YamlConfig):
176
+ """This class is used to save Zaber motor positions as a .yaml file to reuse them between sessions.
177
+
178
+ The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
179
+ (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
180
+ Zaber motor positions across consecutive runtimes for the same project and animal combination.
181
+
182
+ Notes:
183
+ All positions are saved using native motor units. All class fields initialize to default placeholders that are
184
+ likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
185
+ certain they are safe to use.
186
+
187
+ Exercise caution when working with Zaber motors. The motors are powerful enough to damage the surrounding
188
+ equipment and manipulated objects. Do not modify the data stored inside the .yaml file unless you know what you
189
+ are doing.
190
+ """
191
+
192
+ headbar_z: int = 0
193
+ """The absolute position, in native motor units, of the HeadBar z-axis motor."""
194
+ headbar_pitch: int = 0
195
+ """The absolute position, in native motor units, of the HeadBar pitch-axis motor."""
196
+ headbar_roll: int = 0
197
+ """The absolute position, in native motor units, of the HeadBar roll-axis motor."""
198
+ lickport_z: int = 0
199
+ """The absolute position, in native motor units, of the LickPort z-axis motor."""
200
+ lickport_x: int = 0
201
+ """The absolute position, in native motor units, of the LickPort x-axis motor."""
202
+ lickport_y: int = 0
203
+ """The absolute position, in native motor units, of the LickPort y-axis motor."""
204
+
205
+
206
+ @dataclass()
207
+ class MesoscopePositions(YamlConfig):
208
+ """This class is used to save the real and virtual Mesoscope objective positions as a .yaml file to reuse it
209
+ between experiment sessions.
210
+
211
+ Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
212
+ multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
213
+ X, Y, Z, and Roll axes and the virtual (ScanImage software) tip, tilt, and fastZ focus axes.
214
+
215
+ Notes:
216
+ Since the API to read and write these positions automatically is currently not available, this class relies on
217
+ the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
218
+ """
219
+
220
+ mesoscope_x_position: float = 0.0
221
+ """The X-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
222
+ mesoscope_y_position: float = 0.0
223
+ """The Y-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
224
+ mesoscope_roll_position: float = 0.0
225
+ """The Roll-axis position, in degrees, of the Mesoscope objective used during session runtime."""
226
+ mesoscope_z_position: float = 0.0
227
+ """The Z-axis position, in centimeters, of the Mesoscope objective used during session runtime."""
228
+ mesoscope_fast_z_position: float = 0.0
229
+ """The Fast-Z-axis position, in micrometers, of the Mesoscope objective used during session runtime."""
230
+ mesoscope_tip_position: float = 0.0
231
+ """The Tilt-axis position, in degrees, of the Mesoscope objective used during session runtime."""
232
+ mesoscope_tilt_position: float = 0.0
233
+ """The Tip-axis position, in degrees, of the Mesoscope objective used during session runtime."""