sl-shared-assets 5.0.1__py3-none-any.whl → 5.1.1__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.

@@ -1,9 +1,7 @@
1
- """This module contains classes jointly responsible for maintaining the Sun lab project data hierarchy across all
2
- machines used to acquire, process, and store the data. Every valid experiment or training session conducted in the
3
- lab generates a specific directory structure. This structure is defined via the ProjectConfiguration and SessionData
4
- classes, which are also stored as .yaml files inside each session's raw_data and processed_data directories. Jointly,
5
- these classes contain all necessary information to restore the data hierarchy on any machine. All other Sun lab
6
- libraries use these classes to work with all lab-generated data."""
1
+ """This module provides classes jointly responsible for maintaining the Sun lab project data hierarchy across all
2
+ machines used to acquire, process, and store the data. Primarily, classes from this module are used to manage the
3
+ access to the data acquired as part of a single data acquisition session in a thread-safe and location-agnostic
4
+ fashion."""
7
5
 
8
6
  import copy
9
7
  from enum import StrEnum
@@ -17,33 +15,32 @@ from ataraxis_data_structures import YamlConfig
17
15
  from ataraxis_time.time_helpers import get_timestamp
18
16
 
19
17
  from .configuration_data import AcquisitionSystems, get_system_configuration_data
18
+ from ..tools.transfer_tools import delete_directory
20
19
 
21
20
 
22
21
  class SessionTypes(StrEnum):
23
- """Defines the set of data acquisition session types supported by various data acquisition systems used in the
24
- Sun lab.
22
+ """Stores the data acquisition session types supported by all data acquisition systems used in the Sun lab.
25
23
 
26
- A data acquisition session broadly encompasses a recording session carried out to either: acquire experiment data,
27
- train the animal for the upcoming experiments, or to assess the quality of surgical or other pre-experiment
28
- intervention.
24
+ A data acquisition session is typically carried out to acquire experiment data, train the animal for the upcoming
25
+ experiment sessions, or to assess the quality of surgical or other pre-experiment interventions. After acquisition,
26
+ the session is treated as a uniform package whose components can be accessed via the SessionData class.
29
27
 
30
28
  Notes:
31
- This enumeration does not differentiate between different acquisition systems. Different acquisition systems
32
- support different session types and may not be suited for acquiring some of the session types listed in this
33
- enumeration.
29
+ Different acquisition systems support different session types and may not be suited for acquiring some of the
30
+ session types listed in this enumeration.
34
31
  """
35
32
 
36
33
  LICK_TRAINING = "lick training"
37
- """Mesoscope-VR session designed to teach animals to use the water delivery port while being head-fixed."""
34
+ """A Mesoscope-VR session designed to teach animals to use the water delivery port while being head-fixed."""
38
35
  RUN_TRAINING = "run training"
39
- """Mesoscope-VR session designed to teach animals how to run on the treadmill while being head-fixed."""
36
+ """A Mesoscope-VR session designed to teach animals to run on the treadmill while being head-fixed."""
40
37
  MESOSCOPE_EXPERIMENT = "mesoscope experiment"
41
- """Mesoscope-VR experiment session. The session uses Unity game engine to run experiments in virtual reality task
42
- environments and collects brain activity data using Mesoscope."""
38
+ """A Mesoscope-VR experiment session. The session uses Unity game engine to run virtual reality tasks and collects
39
+ brain activity data using 2-Photon Random Access Mesoscope (2P-RAM)."""
43
40
  WINDOW_CHECKING = "window checking"
44
- """A special Mesoscope-VR session designed to evaluate the suitability of the given animal to be included into the
45
- experiment dataset. Specifically, the session involves using the Mesoscope to check the quality of the cell
46
- activity data."""
41
+ """A Mesoscope-VR session designed to evaluate the quality of the cranial window implantation procedure and the
42
+ suitability of the animal for being imaged with the Mesoscope. The session uses the Mesoscope to assess the quality
43
+ of the cell activity data."""
47
44
 
48
45
 
49
46
  @dataclass()
@@ -247,18 +244,18 @@ class ProcessedData:
247
244
  class TrackingData:
248
245
  """Stores the paths to the directories and files that make up the 'tracking_data' session-specific directory.
249
246
 
250
- The 'tracking_data' directory was added in version 5.0.0 to store the ProcessingTracker instance data and .lock
251
- files for pipelines and tasks used to work with session data after acquisition.
247
+ This directory was added in version 5.0.0 to store the ProcessingTracker files and .lock files for pipelines and
248
+ tasks used to work with session's data after acquisition.
252
249
  """
253
250
 
254
251
  tracking_data_path: Path = Path()
255
252
  """Stores the path to the root tracking_data directory of the session. This directory stores the .yaml
256
253
  ProcessingTracker files and the .lock FileLock files that jointly ensure that session's data is accessed in a
257
- process- and thread-safe way while being processed by multiple different processes and pipelines."""
254
+ thread-safe way while being processed by multiple different processes and pipelines."""
258
255
  session_lock_path: Path = Path()
259
- """Stores the path to the session_lock.yaml file for the session. This file is used to ensure that only a single
260
- manager process has exclusive access to the session's data on the remote compute server. This ensures that multiple
261
- data processing pipelines can safely run for the same session without compromising session data integrity. This
256
+ """Stores the path to the session's session_lock.yaml file. This file is used to ensure that only a single
257
+ manager process has exclusive access to the session's data on the remote compute server. This allows multiple
258
+ data processing pipelines to safely run for the same session without compromising session data integrity. This
262
259
  file is intended to be used through the SessionLock class."""
263
260
 
264
261
  def resolve_paths(self, root_directory_path: Path) -> None:
@@ -289,17 +286,20 @@ class TrackingData:
289
286
  class SessionData(YamlConfig):
290
287
  """Stores and manages the data layout of a single Sun lab data acquisition session.
291
288
 
292
- The primary purpose of this class is to maintain the session data structure across all supported destinations and to
293
- provide a unified data access interface shared by all Sun lab libraries. The class can be used to either generate a
294
- new session or load the layout of an already existing session. When the class is used to create a new session, it
295
- generates the new session's name using the current UTC timestamp, accurate to microseconds. This ensures that each
296
- session 'name' is unique and preserves the overall session order.
289
+ The primary purpose of this class is to maintain the session data structure across all supported destinations
290
+ and to provide a unified data access interface shared by all Sun lab libraries. It is specifically designed for
291
+ working with the data from a single session, performed by a single animal under the specific project. The class is
292
+ used to manage both raw and processed data: it follows the data through acquisition, preprocessing, and processing
293
+ stages of the Sun lab data workflow. This class serves as an entry point for all interactions with the managed
294
+ session's data.
297
295
 
298
296
  Notes:
299
- This class is specifically designed for working with the data from a single session, performed by a single
300
- animal under the specific experiment. The class is used to manage both raw and processed data. It follows the
301
- data through acquisition, preprocessing, and processing stages of the Sun lab data workflow. This class serves
302
- as an entry point for all interactions with the managed session's data.
297
+ The class is not designed to be instantiated directly. Instead, use the create() method to generate a new
298
+ session or load() method to access the data of an already existing session.
299
+
300
+ When the class is used to create a new session, it generates the new session's name using the current UTC
301
+ timestamp, accurate to microseconds. This ensures that each session 'name' is unique and preserves the overall
302
+ session order.
303
303
  """
304
304
 
305
305
  project_name: str
@@ -370,10 +370,10 @@ class SessionData(YamlConfig):
370
370
  project_name: str,
371
371
  animal_id: str,
372
372
  session_type: SessionTypes | str,
373
+ python_version: str,
374
+ sl_experiment_version: str,
373
375
  experiment_name: str | None = None,
374
376
  session_name: str | None = None,
375
- python_version: str = "3.11.13",
376
- sl_experiment_version: str = "2.0.0",
377
377
  ) -> "SessionData":
378
378
  """Creates a new SessionData object and generates the new session's data structure on the local PC.
379
379
 
@@ -394,6 +394,10 @@ class SessionData(YamlConfig):
394
394
  animal_id: The ID code of the animal participating in the session.
395
395
  session_type: The type of the session. Has to be one of the supported session types exposed by the
396
396
  SessionTypes enumeration.
397
+ python_version: The string that specifies the Python version used to collect session data. Has to be
398
+ specified using the major.minor.patch version format.
399
+ sl_experiment_version: The string that specifies the version of the sl-experiment library used to collect
400
+ session data. Has to be specified using the major.minor.patch version format.
397
401
  experiment_name: The name of the experiment executed during the session. This optional argument is only
398
402
  used for experiment sessions. Note! The name passed to this argument has to match the name of the
399
403
  experiment configuration .yaml file.
@@ -401,10 +405,6 @@ class SessionData(YamlConfig):
401
405
  sessions. When provided, the method uses this name instead of generating a new timestamp-based name.
402
406
  This is only used during the 'ascension' runtime to convert old data structures to the modern
403
407
  lab standards.
404
- python_version: The string that specifies the Python version used to collect session data. Has to be
405
- specified using the major.minor.patch version format.
406
- sl_experiment_version: The string that specifies the version of the sl-experiment library used to collect
407
- session data. Has to be specified using the major.minor.patch version format.
408
408
 
409
409
  Returns:
410
410
  An initialized SessionData instance that stores the layout of the newly created session's data.
@@ -597,26 +597,53 @@ class SessionData(YamlConfig):
597
597
  )
598
598
  )
599
599
 
600
- # SOURCE DATA
601
- instance.source_data.resolve_paths(
602
- root_directory_path=processed_data_root.joinpath(
603
- instance.project_name, instance.animal_id, instance.session_name, "source_data"
600
+ # If the processed data root is different from the raw data root, resolves the path to the 'source' and
601
+ # 'archive' data directories. Otherwise, uses the same paths as 'raw' and 'processed' data directories.
602
+ if processed_data_root != local_root:
603
+ # SOURCE DATA
604
+ instance.source_data.resolve_paths(
605
+ root_directory_path=processed_data_root.joinpath(
606
+ instance.project_name, instance.animal_id, instance.session_name, "source_data"
607
+ )
604
608
  )
605
- )
606
- # Note, since source data is populated as part of the 'preparation' runtime, does not make the directories.
609
+ # Note, since source data is populated as part of the 'preparation' runtime, does not make the directories.
607
610
 
608
- # ARCHIVED DATA
609
- instance.archived_data.resolve_paths(
610
- root_directory_path=local_root.joinpath(
611
- instance.project_name, instance.animal_id, instance.session_name, "archived_data"
611
+ # ARCHIVED DATA
612
+ instance.archived_data.resolve_paths(
613
+ root_directory_path=local_root.joinpath(
614
+ instance.project_name, instance.animal_id, instance.session_name, "archived_data"
615
+ )
612
616
  )
613
- )
617
+
618
+ # If the session has been processed with the processed data root previously matching the raw data root,
619
+ # ensures that there is no 'processed_data' directory on the raw data root. In other words, ensures that
620
+ # the session data always has only a single copy of the 'processed_data' directory.
621
+ old_processed_data_path = local_root.joinpath(
622
+ instance.project_name, instance.animal_id, instance.session_name, "processed_data"
623
+ )
624
+ delete_directory(old_processed_data_path)
625
+
626
+ else:
627
+ # SOURCE DATA
628
+ instance.source_data.resolve_paths(
629
+ root_directory_path=processed_data_root.joinpath(
630
+ instance.project_name, instance.animal_id, instance.session_name, "raw_data"
631
+ )
632
+ )
633
+
634
+ # ARCHIVED DATA
635
+ instance.archived_data.resolve_paths(
636
+ root_directory_path=local_root.joinpath(
637
+ instance.project_name, instance.animal_id, instance.session_name, "processed_data"
638
+ )
639
+ )
640
+
614
641
  # Similar to source_data, archived data is populated as part of the 'archiving' pipeline, so directories for
615
642
  # this data are not resolved.
616
643
 
617
644
  # If there is no archived processed data, ensures that processed data hierarchy exists.
618
645
  if not instance.archived_data.processed_data_path.exists():
619
- instance.processed_data.make_directories() # Ensures processed data directories exist
646
+ instance.processed_data.make_directories()
620
647
 
621
648
  # TRACKING DATA
622
649
  instance.tracking_data.resolve_paths(
@@ -671,11 +698,13 @@ class SessionData(YamlConfig):
671
698
  class SessionLock(YamlConfig):
672
699
  """Provides thread-safe session locking to ensure exclusive access during data processing.
673
700
 
674
- This class manages a lock file that tracks which manager process currently has exclusive access to a session's data.
675
- It prevents race conditions when multiple manager processes attempt to modify session data simultaneously.
701
+ This class manages a lock file that tracks which manager process currently has exclusive access to a data
702
+ acquisition session's data. It prevents race conditions when multiple manager processes attempt to modify session
703
+ data simultaneously. Primarily, this class is used on remote compute server(s).
676
704
 
677
- The lock is identified by a manager process ID, allowing distributed processing across multiple jobs while
678
- maintaining data integrity.
705
+ Notes:
706
+ The lock owner is identified by a manager process ID, allowing distributed processing across
707
+ multiple jobs while maintaining data integrity.
679
708
  """
680
709
 
681
710
  file_path: Path
@@ -712,7 +741,7 @@ class SessionLock(YamlConfig):
712
741
  original.to_yaml(file_path=self.file_path)
713
742
 
714
743
  def acquire(self, manager_id: int) -> None:
715
- """Acquires the session lock for exclusive access.
744
+ """Acquires the session access lock.
716
745
 
717
746
  Args:
718
747
  manager_id: The unique identifier of the manager process requesting the lock.
@@ -729,10 +758,11 @@ class SessionLock(YamlConfig):
729
758
  # Checks if the session is already locked by another process
730
759
  if self._manager_id != -1 and self._manager_id != manager_id:
731
760
  message = (
732
- f"Cannot acquire the session lock for manager process {manager_id}. The {self.file_path.name} "
733
- f"session lock file indicates The lock is currently held by the manager process "
734
- f"{self._manager_id}. Call the command that produced this error with the '--reset_lock' flag "
735
- f"to override this safety feature or wait for the natural lock release."
761
+ f"Unable to acquire the {self.file_path.parents[1].name} session's lock for the manager with "
762
+ f"id {manager_id}. The lock file indicates that the lock is already held by the process with id "
763
+ f"{self._manager_id}, preventing other processes from interfacing with the session lock. Call the "
764
+ f"command that produced this error with the '--reset-tracker' flag to override this safety "
765
+ f"feature or wait for the lock to be released."
736
766
  )
737
767
  console.error(message=message, error=RuntimeError)
738
768
  raise RuntimeError(message)
@@ -743,7 +773,7 @@ class SessionLock(YamlConfig):
743
773
  self._save_state()
744
774
 
745
775
  def release(self, manager_id: int) -> None:
746
- """Releases the session lock.
776
+ """Releases the session access lock.
747
777
 
748
778
  Args:
749
779
  manager_id: The unique identifier of the manager process releasing the lock.
@@ -759,9 +789,9 @@ class SessionLock(YamlConfig):
759
789
 
760
790
  if self._manager_id != manager_id:
761
791
  message = (
762
- f"Unable to release the session lock from the manager with id {manager_id}. The "
763
- f"{self.file_path.name} session lock file indicates that the lock is held by the process with "
764
- f"id {self._manager_id}, preventing other processes from interfacing with the session lock."
792
+ f"Unable to release the {self.file_path.parents[1].name} session's lock from the manager with "
793
+ f"id {manager_id}. The lock file indicates that the lock is held by the process with id "
794
+ f"{self._manager_id}, preventing other processes from interfacing with the session lock."
765
795
  )
766
796
  console.error(message=message, error=RuntimeError)
767
797
  raise RuntimeError(message) # Fallback to appease mypy, should not be reachable
@@ -771,10 +801,11 @@ class SessionLock(YamlConfig):
771
801
  self._save_state()
772
802
 
773
803
  def force_release(self) -> None:
774
- """Forcibly releases the lock regardless of ownership.
804
+ """Forcibly releases the session access lock regardless of ownership.
775
805
 
776
- This method should only be used for emergency recovery of deadlocked sessions. It can be called by any process
777
- to unlock the session whose lock is managed by this instance.
806
+ This method should only be used for emergency recovery from improper processing shutdowns. It can be called by
807
+ any process to unlock any session, but it does not attempt to terminate the processes that the lock's owner
808
+ might have deployed to work with the session's data.
778
809
 
779
810
  Raises:
780
811
  TimeoutError: If the .lock file cannot be acquired for a long period of time due to being held by another
@@ -782,32 +813,31 @@ class SessionLock(YamlConfig):
782
813
  """
783
814
  lock = FileLock(self._lock_path)
784
815
  with lock.acquire(timeout=10.0):
816
+ # Hard reset regardless of the current tracker state
785
817
  self._manager_id = -1
786
818
  self._save_state()
787
819
 
788
- @property
789
- def is_locked(self) -> bool:
790
- """Returns True if the session is currently locked by any process, False otherwise.
820
+ def check_owner(self, manager_id: int) -> None:
821
+ """Ensures that the managed session is locked for processing by the specified manager process.
791
822
 
792
- Raises:
793
- TimeoutError: If the .lock file cannot be acquired for a long period of time due to being held by another
794
- process.
795
- """
796
- lock = FileLock(self._lock_path)
797
- with lock.acquire(timeout=10.0):
798
- self._load_state()
799
- return self._manager_id != -1
823
+ This method is used by worker functions to ensure it is safe to interact with the session's data. It is designed
824
+ to abort the runtime with an error if the session's lock file is owned by a different manager process.
800
825
 
801
- @property
802
- def owner(self) -> int | None:
803
- """Returns the unique identifier of the manager process that holds the lock if the session is locked or None if
804
- the session is unlocked.
826
+ Args:
827
+ manager_id: The unique identifier of the manager process attempting to access the session's data.
805
828
 
806
829
  Raises:
807
830
  TimeoutError: If the .lock file cannot be acquired for a long period of time due to being held by another
808
831
  process.
832
+ ValueError: If the lock file is held by a different manager process.
809
833
  """
810
834
  lock = FileLock(self._lock_path)
811
835
  with lock.acquire(timeout=10.0):
812
836
  self._load_state()
813
- return self._manager_id if self._manager_id != -1 else None
837
+ if self._manager_id != manager_id:
838
+ message = (
839
+ f"Unable to access the {self.file_path.parents[1].name} session's data from manager process "
840
+ f"{manager_id}, as the session is currently locked by another manager process with ID "
841
+ f"{self._manager_id}."
842
+ )
843
+ console.error(message=message, error=ValueError)
@@ -1,5 +1,6 @@
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 (animal) surgery data is always kept together with training and experiment data."""
1
+ """This module provides dataclasses used to store animal surgery data extracted from the Sun lab surgery log. Typically,
2
+ this is done as part of every data acquisition session to ensure that runtime and surgical intervention data is always
3
+ kept together and available for analysis."""
3
4
 
4
5
  from dataclasses import dataclass
5
6
 
@@ -8,13 +9,13 @@ from ataraxis_data_structures import YamlConfig
8
9
 
9
10
  @dataclass()
10
11
  class SubjectData:
11
- """Stores the ID information of the surgical intervention's subject (animal)."""
12
+ """Stores information about the subject of the surgical intervention (animal)."""
12
13
 
13
14
  id: int
14
15
  """Stores the unique ID (name) of the subject. Assumes all animals are given a numeric ID, rather than a string
15
16
  name."""
16
17
  ear_punch: str
17
- """Stores the ear tag location of the subject."""
18
+ """Stores the location and the number of ear-tags used to distinguish teh animal from its cage-mates."""
18
19
  sex: str
19
20
  """Stores the gender of the subject."""
20
21
  genotype: str
@@ -22,26 +23,26 @@ class SubjectData:
22
23
  date_of_birth_us: int
23
24
  """Stores the date of birth of the subject as the number of microseconds elapsed since UTC epoch onset."""
24
25
  weight_g: float
25
- """Stores the weight of the subject pre-surgery, in grams."""
26
+ """Stores the pre-surgery weight of the subject, in grams."""
26
27
  cage: int
27
- """Stores the number of the cage used to house the subject after surgery."""
28
+ """Stores the unique identifier (number) for the cage used to house the subject after surgery."""
28
29
  location_housed: str
29
- """Stores the location used to house the subject after the surgery."""
30
+ """Stores the location (room) used to house the subject."""
30
31
  status: str
31
32
  """Stores the current status of the subject (alive / deceased)."""
32
33
 
33
34
 
34
35
  @dataclass()
35
36
  class ProcedureData:
36
- """Stores the general information about the surgical intervention."""
37
+ """Stores general information about the surgical intervention."""
37
38
 
38
39
  surgery_start_us: int
39
- """Stores the date and time when the surgery has started as microseconds elapsed since UTC epoch onset."""
40
+ """Stores the surgery's start date and time as microseconds elapsed since UTC epoch onset."""
40
41
  surgery_end_us: int
41
- """Stores the date and time when the surgery has ended as microseconds elapsed since UTC epoch onset."""
42
+ """Stores the surgery's stop date and time as microseconds elapsed since UTC epoch onset."""
42
43
  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."""
44
+ """Stores the name or ID of the surgeon. If the intervention was carried out by multiple surgeons, the data
45
+ for all participants is stored as part of the same string."""
45
46
  protocol: str
46
47
  """Stores the experiment protocol number (ID) used during the surgery."""
47
48
  surgery_notes: str
@@ -50,60 +51,60 @@ class ProcedureData:
50
51
  """Stores surgeon's notes taken during the post-surgery recovery period."""
51
52
  surgery_quality: int = 0
52
53
  """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
+ indicates usable result that does not meet the publication threshold, 2 indicates publication-grade
54
55
  result, 3 indicates high-tier publication grade result."""
55
56
 
56
57
 
57
58
  @dataclass
58
59
  class ImplantData:
59
- """Stores the information about a single implantation procedure performed during the surgical intervention.
60
+ """Stores information about a single implantation procedure performed during the surgical intervention.
60
61
 
61
- Multiple ImplantData instances are used at the same time if the surgery involved multiple implants.
62
+ Multiple ImplantData instances can be used at the same time if the surgery involves multiple implants.
62
63
  """
63
64
 
64
65
  implant: str
65
- """The descriptive name of the implant."""
66
+ """Stores the descriptive name of the implant."""
66
67
  implant_target: str
67
- """The name of the brain region or cranium section targeted by the implant."""
68
+ """Stores the name of the brain region or cranium section targeted by the implant."""
68
69
  implant_code: str
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."""
70
+ """Stores the manufacturer code or internal reference code for the implant. This code is used to identify the
71
+ implant in additional datasheets and lab ordering documents."""
71
72
  implant_ap_coordinate_mm: float
72
- """Stores implant's antero-posterior stereotactic coordinate, in millimeters, relative to bregma."""
73
+ """Stores the implant's antero-posterior stereotactic coordinate, in millimeters, relative to bregma."""
73
74
  implant_ml_coordinate_mm: float
74
- """Stores implant's medial-lateral stereotactic coordinate, in millimeters, relative to bregma."""
75
+ """Stores the implant's medial-lateral stereotactic coordinate, in millimeters, relative to bregma."""
75
76
  implant_dv_coordinate_mm: float
76
- """Stores implant's dorsal-ventral stereotactic coordinate, in millimeters, relative to bregma."""
77
+ """Stores the implant's dorsal-ventral stereotactic coordinate, in millimeters, relative to bregma."""
77
78
 
78
79
 
79
80
  @dataclass
80
81
  class InjectionData:
81
- """Stores the information about a single injection performed during surgical intervention.
82
+ """Stores information about a single injection performed during the surgical intervention.
82
83
 
83
- Multiple InjectionData instances are used at the same time if the surgery involved multiple injections.
84
+ Multiple InjectionData instances can be used at the same time if the surgery involves multiple injections.
84
85
  """
85
86
 
86
87
  injection: str
87
- """The descriptive name of the injection."""
88
+ """Stores the descriptive name of the injection."""
88
89
  injection_target: str
89
- """The name of the brain region targeted by the injection."""
90
+ """Stores the name of the brain region targeted by the injection."""
90
91
  injection_volume_nl: float
91
- """The volume of substance, in nanoliters, delivered during the injection."""
92
+ """Stores the volume of substance, in nanoliters, delivered during the injection."""
92
93
  injection_code: str
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."""
94
+ """Stores the manufacturer code or internal reference code for the injected substance. This code is used to
95
+ identify the substance in additional datasheets and lab ordering documents."""
95
96
  injection_ap_coordinate_mm: float
96
- """Stores injection's antero-posterior stereotactic coordinate, in millimeters, relative to bregma."""
97
+ """Stores the injection's antero-posterior stereotactic coordinate, in millimeters, relative to bregma."""
97
98
  injection_ml_coordinate_mm: float
98
- """Stores injection's medial-lateral stereotactic coordinate, in millimeters, relative to bregma."""
99
+ """Stores the injection's medial-lateral stereotactic coordinate, in millimeters, relative to bregma."""
99
100
  injection_dv_coordinate_mm: float
100
- """Stores injection's dorsal-ventral stereotactic coordinate, in millimeters, relative to bregma."""
101
+ """Stores the injection's dorsal-ventral stereotactic coordinate, in millimeters, relative to bregma."""
101
102
 
102
103
 
103
104
  @dataclass
104
105
  class DrugData:
105
- """Stores the information about all drugs administered to the subject before, during, and immediately after the
106
- surgical intervention.
106
+ """Stores the information about all medical substances (drugs) administered to the subject before, during, and
107
+ immediately after the surgical intervention.
107
108
  """
108
109
 
109
110
  lactated_ringers_solution_volume_ml: float
@@ -130,23 +131,22 @@ class DrugData:
130
131
 
131
132
  @dataclass
132
133
  class SurgeryData(YamlConfig):
133
- """Stores the data about a single animal surgical intervention.
134
+ """Stores the data about the surgical intervention performed on an animal before data acquisition session(s).
134
135
 
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.
136
+ Primarily, this class is used to ensure that each data acquisition session contains a copy of the surgical
137
+ intervention data as a .yaml file. In turn, this improves the experimenter's experience during data analysis by
138
+ allowing quickly referencing the surgical intervention data.
139
139
  """
140
140
 
141
141
  subject: SubjectData
142
- """Stores the ID information about the subject (mouse)."""
142
+ """Stores information about the subject (mouse)."""
143
143
  procedure: ProcedureData
144
- """Stores general data about the surgical intervention."""
144
+ """Stores general information about the surgical intervention."""
145
145
  drugs: DrugData
146
- """Stores the data about the substances subcutaneously injected into the subject before, during and immediately
146
+ """Stores information about the medical substances administered to the subject before, during, and immediately
147
147
  after the surgical intervention."""
148
148
  implants: list[ImplantData]
149
- """Stores the data for all cranial and transcranial implants introduced to the subject during the surgical
149
+ """Stores information about cranial and transcranial implants introduced to the subject as part of the surgical
150
150
  intervention."""
151
151
  injections: list[InjectionData]
152
- """Stores the data about all substances infused into the brain of the subject during the surgical intervention."""
152
+ """Stores information about substances infused into the brain of the subject as part the surgical intervention."""
@@ -1,6 +1,5 @@
1
1
  """This package provides the classes and methods used by all Sun lab libraries to work with the data stored on remote
2
- compute servers, such as the BioHPC server. It provides tools for submitting and monitoring jobs, running complex
3
- processing pipelines and interactively working with the data via a Jupyter lab server."""
2
+ compute servers."""
4
3
 
5
4
  from .job import Job, JupyterJob
6
5
  from .server import Server, ServerCredentials, generate_server_credentials