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
@@ -4,6 +4,8 @@ from dataclasses import field, dataclass
4
4
  from _typeshed import Incomplete
5
5
  from ataraxis_data_structures import YamlConfig
6
6
 
7
+ from .configuration_data import ExperimentConfiguration as ExperimentConfiguration
8
+
7
9
  def replace_root_path(path: Path) -> None:
8
10
  """Replaces the path to the local root directory used to store all Sun lab projects with the provided path.
9
11
 
@@ -252,7 +254,8 @@ class ProcessedData:
252
254
  mesoscope_data_path: Path = ...
253
255
  behavior_data_path: Path = ...
254
256
  job_logs_path: Path = ...
255
- processing_tracker_path: Path = ...
257
+ project_configuration_path: Path = ...
258
+ session_data_path: Path = ...
256
259
  def resolve_paths(self, root_directory_path: Path) -> None:
257
260
  """Resolves all paths managed by the class instance based on the input root directory path.
258
261
 
@@ -497,6 +500,10 @@ class SessionData(YamlConfig):
497
500
  Notes:
498
501
  To create a new session, use the create() method instead.
499
502
 
503
+ Although session_data.yaml is stored both inside raw_data and processed_data subfolders, this method
504
+ always searches only inside the raw_data folder. Storing session data in both folders is only used to ensure
505
+ human experimenters can always trace all data in the lab back to the proper project, animal, and session.
506
+
500
507
  Args:
501
508
  session_path: The path to the root directory of an existing session, e.g.: vrpc_root/project/animal/session.
502
509
  on_server: Determines whether the method is used to initialize an existing session on the BioHPC server or
@@ -511,289 +518,10 @@ class SessionData(YamlConfig):
511
518
  FileNotFoundError: If the 'session_data.yaml' file is not found under the session_path/raw_data/ subfolder.
512
519
  """
513
520
  def _save(self) -> None:
514
- """Saves the instance data to the 'raw_data' directory of the managed session as a 'session_data.yaml' file.
521
+ """Saves the instance data to the 'raw_data' directory and the 'processed_data' directory of the managed session
522
+ as a 'session_data.yaml' file.
515
523
 
516
524
  This is used to save the data stored in the instance to disk, so that it can be reused during preprocessing or
517
525
  data processing. The method is intended to only be used by the SessionData instance itself during its
518
526
  create() method runtime.
519
527
  """
520
-
521
- @dataclass()
522
- class ExperimentState:
523
- """Encapsulates the information used to set and maintain the desired experiment and Mesoscope-VR system state.
524
-
525
- Primarily, experiment runtime logic (task logic) is resolved by the Unity game engine. However, the Mesoscope-VR
526
- system configuration may also need to change throughout the experiment to optimize the runtime by disabling or
527
- reconfiguring specific hardware modules. For example, some experiment stages may require the running wheel to be
528
- locked to prevent the animal from running, and other may require the VR screens to be turned off.
529
- """
530
-
531
- experiment_state_code: int
532
- vr_state_code: int
533
- state_duration_s: float
534
-
535
- @dataclass()
536
- class ExperimentConfiguration(YamlConfig):
537
- """Stores the configuration of a single experiment runtime.
538
-
539
- Primarily, this includes the sequence of experiment and Virtual Reality (Mesoscope-VR) states that defines the flow
540
- of the experiment runtime. During runtime, the main runtime control function traverses the sequence of states
541
- stored in this class instance start-to-end in the exact order specified by the user. Together with custom Unity
542
- projects that define the task logic (how the system responds to animal interactions with the VR system) this class
543
- allows flexibly implementing a wide range of experiments.
544
-
545
- Each project should define one or more experiment configurations and save them as .yaml files inside the project
546
- 'configuration' folder. The name for each configuration file is defined by the user and is used to identify and load
547
- the experiment configuration when 'sl-run-experiment' CLI command exposed by the sl-experiment library is executed.
548
- """
549
-
550
- cue_map: dict[int, float] = field(default_factory=Incomplete)
551
- experiment_states: dict[str, ExperimentState] = field(default_factory=Incomplete)
552
-
553
- @dataclass()
554
- class HardwareConfiguration(YamlConfig):
555
- """This class is used to save the runtime hardware configuration parameters as a .yaml file.
556
-
557
- This information is used to read and decode the data saved to the .npz log files during runtime as part of data
558
- processing.
559
-
560
- Notes:
561
- All fields in this dataclass initialize to None. During log processing, any log associated with a hardware
562
- module that provides the data stored in a field will be processed, unless that field is None. Therefore, setting
563
- any field in this dataclass to None also functions as a flag for whether to parse the log associated with the
564
- module that provides this field's information.
565
-
566
- This class is automatically configured by MesoscopeExperiment and BehaviorTraining classes from sl-experiment
567
- library to facilitate log parsing.
568
- """
569
-
570
- cue_map: dict[int, float] | None = ...
571
- cm_per_pulse: float | None = ...
572
- maximum_break_strength: float | None = ...
573
- minimum_break_strength: float | None = ...
574
- lick_threshold: int | None = ...
575
- valve_scale_coefficient: float | None = ...
576
- valve_nonlinearity_exponent: float | None = ...
577
- torque_per_adc_unit: float | None = ...
578
- screens_initially_on: bool | None = ...
579
- recorded_mesoscope_ttl: bool | None = ...
580
-
581
- @dataclass()
582
- class LickTrainingDescriptor(YamlConfig):
583
- """This class is used to save the description information specific to lick training sessions as a .yaml file.
584
-
585
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
586
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
587
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
588
-
589
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
590
- trained animal.
591
- """
592
-
593
- experimenter: str
594
- mouse_weight_g: float
595
- dispensed_water_volume_ml: float
596
- minimum_reward_delay: int
597
- maximum_reward_delay_s: int
598
- maximum_water_volume_ml: float
599
- maximum_training_time_m: int
600
- experimenter_notes: str = ...
601
- experimenter_given_water_volume_ml: float = ...
602
-
603
- @dataclass()
604
- class RunTrainingDescriptor(YamlConfig):
605
- """This class is used to save the description information specific to run training sessions as a .yaml file.
606
-
607
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
608
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
609
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
610
-
611
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
612
- trained animal.
613
- """
614
-
615
- experimenter: str
616
- mouse_weight_g: float
617
- dispensed_water_volume_ml: float
618
- final_run_speed_threshold_cm_s: float
619
- final_run_duration_threshold_s: float
620
- initial_run_speed_threshold_cm_s: float
621
- initial_run_duration_threshold_s: float
622
- increase_threshold_ml: float
623
- run_speed_increase_step_cm_s: float
624
- run_duration_increase_step_s: float
625
- maximum_water_volume_ml: float
626
- maximum_training_time_m: int
627
- experimenter_notes: str = ...
628
- experimenter_given_water_volume_ml: float = ...
629
-
630
- @dataclass()
631
- class MesoscopeExperimentDescriptor(YamlConfig):
632
- """This class is used to save the description information specific to experiment sessions as a .yaml file.
633
-
634
- The information stored in this class instance is filled in two steps. The main runtime function fills most fields
635
- of the class, before it is saved as a .yaml file. After runtime, the experimenter manually fills leftover fields,
636
- such as 'experimenter_notes,' before the class instance is transferred to the long-term storage destination.
637
-
638
- The fully filled instance data is also used during preprocessing to write the water restriction log entry for the
639
- animal participating in the experiment runtime.
640
- """
641
-
642
- experimenter: str
643
- mouse_weight_g: float
644
- dispensed_water_volume_ml: float
645
- experimenter_notes: str = ...
646
- experimenter_given_water_volume_ml: float = ...
647
-
648
- @dataclass()
649
- class ZaberPositions(YamlConfig):
650
- """This class is used to save Zaber motor positions as a .yaml file to reuse them between sessions.
651
-
652
- The class is specifically designed to store, save, and load the positions of the LickPort and HeadBar motors
653
- (axes). It is used to both store Zaber motor positions for each session for future analysis and to restore the same
654
- Zaber motor positions across consecutive runtimes for the same project and animal combination.
655
-
656
- Notes:
657
- All positions are saved using native motor units. All class fields initialize to default placeholders that are
658
- likely NOT safe to apply to the VR system. Do not apply the positions loaded from the file unless you are
659
- certain they are safe to use.
660
-
661
- Exercise caution when working with Zaber motors. The motors are powerful enough to damage the surrounding
662
- equipment and manipulated objects. Do not modify the data stored inside the .yaml file unless you know what you
663
- are doing.
664
- """
665
-
666
- headbar_z: int = ...
667
- headbar_pitch: int = ...
668
- headbar_roll: int = ...
669
- lickport_z: int = ...
670
- lickport_x: int = ...
671
- lickport_y: int = ...
672
-
673
- @dataclass()
674
- class MesoscopePositions(YamlConfig):
675
- """This class is used to save the real and virtual Mesoscope objective positions as a .yaml file to reuse it
676
- between experiment sessions.
677
-
678
- Primarily, the class is used to help the experimenter to position the Mesoscope at the same position across
679
- multiple imaging sessions. It stores both the physical (real) position of the objective along the motorized
680
- X, Y, Z, and Roll axes and the virtual (ScanImage software) tip, tilt, and fastZ focus axes.
681
-
682
- Notes:
683
- Since the API to read and write these positions automatically is currently not available, this class relies on
684
- the experimenter manually entering all positions and setting the mesoscope to these positions when necessary.
685
- """
686
-
687
- mesoscope_x_position: float = ...
688
- mesoscope_y_position: float = ...
689
- mesoscope_roll_position: float = ...
690
- mesoscope_z_position: float = ...
691
- mesoscope_fast_z_position: float = ...
692
- mesoscope_tip_position: float = ...
693
- mesoscope_tilt_position: float = ...
694
-
695
- @dataclass()
696
- class SubjectData:
697
- """Stores the ID information of the surgical intervention's subject (animal)."""
698
-
699
- id: int
700
- ear_punch: str
701
- sex: str
702
- genotype: str
703
- date_of_birth_us: int
704
- weight_g: float
705
- cage: int
706
- location_housed: str
707
- status: str
708
-
709
- @dataclass()
710
- class ProcedureData:
711
- """Stores the general information about the surgical intervention."""
712
-
713
- surgery_start_us: int
714
- surgery_end_us: int
715
- surgeon: str
716
- protocol: str
717
- surgery_notes: str
718
- post_op_notes: str
719
- surgery_quality: int = ...
720
-
721
- @dataclass
722
- class ImplantData:
723
- """Stores the information about a single implantation performed during the surgical intervention.
724
-
725
- Multiple ImplantData instances are used at the same time if the surgery involved multiple implants.
726
- """
727
-
728
- implant: str
729
- implant_target: str
730
- implant_code: int
731
- implant_ap_coordinate_mm: float
732
- implant_ml_coordinate_mm: float
733
- implant_dv_coordinate_mm: float
734
-
735
- @dataclass
736
- class InjectionData:
737
- """Stores the information about a single injection performed during surgical intervention.
738
-
739
- Multiple InjectionData instances are used at the same time if the surgery involved multiple injections.
740
- """
741
-
742
- injection: str
743
- injection_target: str
744
- injection_volume_nl: float
745
- injection_code: int
746
- injection_ap_coordinate_mm: float
747
- injection_ml_coordinate_mm: float
748
- injection_dv_coordinate_mm: float
749
-
750
- @dataclass
751
- class DrugData:
752
- """Stores the information about all drugs administered to the subject before, during, and immediately after the
753
- surgical intervention.
754
- """
755
-
756
- lactated_ringers_solution_volume_ml: float
757
- lactated_ringers_solution_code: int
758
- ketoprofen_volume_ml: float
759
- ketoprofen_code: int
760
- buprenorphine_volume_ml: float
761
- buprenorphine_code: int
762
- dexamethasone_volume_ml: float
763
- dexamethasone_code: int
764
-
765
- @dataclass
766
- class SurgeryData(YamlConfig):
767
- """Stores the data about a single mouse surgical intervention.
768
-
769
- This class aggregates other dataclass instances that store specific data about the surgical procedure. Primarily, it
770
- is used to save the data as a .yaml file to every session's raw_data directory of each animal used in every lab
771
- project. This way, the surgery data is always stored alongside the behavior and brain activity data collected
772
- during the session.
773
- """
774
-
775
- subject: SubjectData
776
- procedure: ProcedureData
777
- drugs: DrugData
778
- implants: list[ImplantData]
779
- injections: list[InjectionData]
780
-
781
- @dataclass()
782
- class ProcessingTracker(YamlConfig):
783
- """Tracks the data processing status for a single session.
784
-
785
- This class is used during BioHPC-server data processing runtimes to track which processing steps are enabled and
786
- have been successfully applied to a given session. This is used to optimize data processing and avoid unnecessary
787
- processing step repetitions where possible.
788
-
789
- Notes:
790
- This class uses a similar mechanism for determining whether a particular option is enabled as the
791
- HardwareConfiguration class. Specifically, if any field of the class is set to None (null), the processing
792
- associated with that field is disabled. Otherwise, if the field is False, that session has not been processed
793
- and, if True, the session has been processed.
794
- """
795
-
796
- checksum: bool | None = ...
797
- log_extractions: bool | None = ...
798
- suite2p: bool | None = ...
799
- deeplabcut: bool | None = ...
@@ -0,0 +1,152 @@
1
+ """This module provides classes to store animal surgery data. This is used to store the data extracted from the Sun lab
2
+ surgery log, so that subject surgery data is always kept together with training and experiment data."""
3
+
4
+ from dataclasses import dataclass
5
+
6
+ from ataraxis_data_structures import YamlConfig
7
+
8
+
9
+ @dataclass()
10
+ class SubjectData:
11
+ """Stores the ID information of the surgical intervention's subject (animal)."""
12
+
13
+ id: int
14
+ """Stores the unique ID (name) of the subject. Assumes all animals are given a numeric ID, rather than a string
15
+ name."""
16
+ ear_punch: str
17
+ """Stores the ear tag location of the subject."""
18
+ sex: str
19
+ """Stores the gender of the subject."""
20
+ genotype: str
21
+ """Stores the genotype of the subject."""
22
+ date_of_birth_us: int
23
+ """Stores the date of birth of the subject as the number of microseconds elapsed since UTC epoch onset."""
24
+ weight_g: float
25
+ """Stores the weight of the subject pre-surgery, in grams."""
26
+ cage: int
27
+ """Stores the number of the cage used to house the subject after surgery."""
28
+ location_housed: str
29
+ """Stores the location used to house the subject after the surgery."""
30
+ status: str
31
+ """Stores the current status of the subject (alive / deceased)."""
32
+
33
+
34
+ @dataclass()
35
+ class ProcedureData:
36
+ """Stores the general information about the surgical intervention."""
37
+
38
+ surgery_start_us: int
39
+ """Stores the date and time when the surgery has started as microseconds elapsed since UTC epoch onset."""
40
+ surgery_end_us: int
41
+ """Stores the date and time when the surgery has ended as microseconds elapsed since UTC epoch onset."""
42
+ surgeon: str
43
+ """Stores the name or ID of the surgeon. If the intervention was carried out by multiple surgeons, all participating
44
+ surgeon names and IDs are stored as part of the same string."""
45
+ protocol: str
46
+ """Stores the experiment protocol number (ID) used during the surgery."""
47
+ surgery_notes: str
48
+ """Stores surgeon's notes taken during the surgery."""
49
+ post_op_notes: str
50
+ """Stores surgeon's notes taken during the post-surgery recovery period."""
51
+ surgery_quality: int = 0
52
+ """Stores the quality of the surgical intervention as a numeric level. 0 indicates unusable (bad) result, 1
53
+ indicates usable result that is not good enough to be included in a publication, 2 indicates publication-grade
54
+ result."""
55
+
56
+
57
+ @dataclass
58
+ class ImplantData:
59
+ """Stores the information about a single implantation performed during the surgical intervention.
60
+
61
+ Multiple ImplantData instances are used at the same time if the surgery involved multiple implants.
62
+ """
63
+
64
+ implant: str
65
+ """The descriptive name of the implant."""
66
+ implant_target: str
67
+ """The name of the brain region or cranium section targeted by the implant."""
68
+ implant_code: int
69
+ """The manufacturer code or internal reference code for the implant. This code is used to identify the implant in
70
+ additional datasheets and lab ordering documents."""
71
+ implant_ap_coordinate_mm: float
72
+ """Stores implant's antero-posterior stereotactic coordinate, in millimeters, relative to bregma."""
73
+ implant_ml_coordinate_mm: float
74
+ """Stores implant's medial-lateral stereotactic coordinate, in millimeters, relative to bregma."""
75
+ implant_dv_coordinate_mm: float
76
+ """Stores implant's dorsal-ventral stereotactic coordinate, in millimeters, relative to bregma."""
77
+
78
+
79
+ @dataclass
80
+ class InjectionData:
81
+ """Stores the information about a single injection performed during surgical intervention.
82
+
83
+ Multiple InjectionData instances are used at the same time if the surgery involved multiple injections.
84
+ """
85
+
86
+ injection: str
87
+ """The descriptive name of the injection."""
88
+ injection_target: str
89
+ """The name of the brain region targeted by the injection."""
90
+ injection_volume_nl: float
91
+ """The volume of substance, in nanoliters, delivered during the injection."""
92
+ injection_code: int
93
+ """The manufacturer code or internal reference code for the injected substance. This code is used to identify the
94
+ substance in additional datasheets and lab ordering documents."""
95
+ injection_ap_coordinate_mm: float
96
+ """Stores injection's antero-posterior stereotactic coordinate, in millimeters, relative to bregma."""
97
+ injection_ml_coordinate_mm: float
98
+ """Stores injection's medial-lateral stereotactic coordinate, in millimeters, relative to bregma."""
99
+ injection_dv_coordinate_mm: float
100
+ """Stores injection's dorsal-ventral stereotactic coordinate, in millimeters, relative to bregma."""
101
+
102
+
103
+ @dataclass
104
+ class DrugData:
105
+ """Stores the information about all drugs administered to the subject before, during, and immediately after the
106
+ surgical intervention.
107
+ """
108
+
109
+ lactated_ringers_solution_volume_ml: float
110
+ """Stores the volume of Lactated Ringer's Solution (LRS) administered during surgery, in ml."""
111
+ lactated_ringers_solution_code: int
112
+ """Stores the manufacturer code or internal reference code for Lactated Ringer's Solution (LRS). This code is used
113
+ to identify the LRS batch in additional datasheets and lab ordering documents."""
114
+ ketoprofen_volume_ml: float
115
+ """Stores the volume of ketoprofen diluted with saline administered during surgery, in ml."""
116
+ ketoprofen_code: int
117
+ """Stores the manufacturer code or internal reference code for ketoprofen. This code is used to identify the
118
+ ketoprofen batch in additional datasheets and lab ordering documents."""
119
+ buprenorphine_volume_ml: float
120
+ """Stores the volume of buprenorphine diluted with saline administered during surgery, in ml."""
121
+ buprenorphine_code: int
122
+ """Stores the manufacturer code or internal reference code for buprenorphine. This code is used to identify the
123
+ buprenorphine batch in additional datasheets and lab ordering documents."""
124
+ dexamethasone_volume_ml: float
125
+ """Stores the volume of dexamethasone diluted with saline administered during surgery, in ml."""
126
+ dexamethasone_code: int
127
+ """Stores the manufacturer code or internal reference code for dexamethasone. This code is used to identify the
128
+ dexamethasone batch in additional datasheets and lab ordering documents."""
129
+
130
+
131
+ @dataclass
132
+ class SurgeryData(YamlConfig):
133
+ """Stores the data about a single mouse surgical intervention.
134
+
135
+ This class aggregates other dataclass instances that store specific data about the surgical procedure. Primarily, it
136
+ is used to save the data as a .yaml file to every session's raw_data directory of each animal used in every lab
137
+ project. This way, the surgery data is always stored alongside the behavior and brain activity data collected
138
+ during the session.
139
+ """
140
+
141
+ subject: SubjectData
142
+ """Stores the ID information about the subject (mouse)."""
143
+ procedure: ProcedureData
144
+ """Stores general data about the surgical intervention."""
145
+ drugs: DrugData
146
+ """Stores the data about the substances subcutaneously injected into the subject before, during and immediately
147
+ after the surgical intervention."""
148
+ implants: list[ImplantData]
149
+ """Stores the data for all cranial and transcranial implants introduced to the subject during the surgical
150
+ intervention."""
151
+ injections: list[InjectionData]
152
+ """Stores the data about all substances infused into the brain of the subject during the surgical intervention."""
@@ -0,0 +1,89 @@
1
+ from dataclasses import dataclass
2
+
3
+ from ataraxis_data_structures import YamlConfig
4
+
5
+ @dataclass()
6
+ class SubjectData:
7
+ """Stores the ID information of the surgical intervention's subject (animal)."""
8
+
9
+ id: int
10
+ ear_punch: str
11
+ sex: str
12
+ genotype: str
13
+ date_of_birth_us: int
14
+ weight_g: float
15
+ cage: int
16
+ location_housed: str
17
+ status: str
18
+
19
+ @dataclass()
20
+ class ProcedureData:
21
+ """Stores the general information about the surgical intervention."""
22
+
23
+ surgery_start_us: int
24
+ surgery_end_us: int
25
+ surgeon: str
26
+ protocol: str
27
+ surgery_notes: str
28
+ post_op_notes: str
29
+ surgery_quality: int = ...
30
+
31
+ @dataclass
32
+ class ImplantData:
33
+ """Stores the information about a single implantation performed during the surgical intervention.
34
+
35
+ Multiple ImplantData instances are used at the same time if the surgery involved multiple implants.
36
+ """
37
+
38
+ implant: str
39
+ implant_target: str
40
+ implant_code: int
41
+ implant_ap_coordinate_mm: float
42
+ implant_ml_coordinate_mm: float
43
+ implant_dv_coordinate_mm: float
44
+
45
+ @dataclass
46
+ class InjectionData:
47
+ """Stores the information about a single injection performed during surgical intervention.
48
+
49
+ Multiple InjectionData instances are used at the same time if the surgery involved multiple injections.
50
+ """
51
+
52
+ injection: str
53
+ injection_target: str
54
+ injection_volume_nl: float
55
+ injection_code: int
56
+ injection_ap_coordinate_mm: float
57
+ injection_ml_coordinate_mm: float
58
+ injection_dv_coordinate_mm: float
59
+
60
+ @dataclass
61
+ class DrugData:
62
+ """Stores the information about all drugs administered to the subject before, during, and immediately after the
63
+ surgical intervention.
64
+ """
65
+
66
+ lactated_ringers_solution_volume_ml: float
67
+ lactated_ringers_solution_code: int
68
+ ketoprofen_volume_ml: float
69
+ ketoprofen_code: int
70
+ buprenorphine_volume_ml: float
71
+ buprenorphine_code: int
72
+ dexamethasone_volume_ml: float
73
+ dexamethasone_code: int
74
+
75
+ @dataclass
76
+ class SurgeryData(YamlConfig):
77
+ """Stores the data about a single mouse surgical intervention.
78
+
79
+ This class aggregates other dataclass instances that store specific data about the surgical procedure. Primarily, it
80
+ is used to save the data as a .yaml file to every session's raw_data directory of each animal used in every lab
81
+ project. This way, the surgery data is always stored alongside the behavior and brain activity data collected
82
+ during the session.
83
+ """
84
+
85
+ subject: SubjectData
86
+ procedure: ProcedureData
87
+ drugs: DrugData
88
+ implants: list[ImplantData]
89
+ injections: list[InjectionData]
@@ -0,0 +1,8 @@
1
+ """This package provides the classes and methods used by all Sun lab libraries to submit remote jobs to the BioHPC
2
+ and other compute servers. This package is also used across all Sun lab members private code to interface with the
3
+ shared server."""
4
+
5
+ from .job import Job
6
+ from .server import Server, ServerCredentials, generate_server_credentials
7
+
8
+ __all__ = ["Server", "ServerCredentials", "generate_server_credentials", "Job"]
@@ -0,0 +1,8 @@
1
+ from .job import Job as Job
2
+ from .server import (
3
+ Server as Server,
4
+ ServerCredentials as ServerCredentials,
5
+ generate_server_credentials as generate_server_credentials,
6
+ )
7
+
8
+ __all__ = ["Server", "ServerCredentials", "generate_server_credentials", "Job"]