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
@@ -0,0 +1,193 @@
1
+ """This module stores the classes used to configure the multi-day (across-session) sl-suite2p pipeline. This pipeline
2
+ extends the original suite2p code to support tracking the same objects (cells) across multiple days. Both single-day
3
+ (original) and multi-day (extended) pipelines are available as part of the Sun lab maintained sl-suite2p package."""
4
+
5
+ from typing import Any
6
+ from dataclasses import field, asdict, dataclass
7
+
8
+ from ataraxis_data_structures import YamlConfig
9
+
10
+
11
+ @dataclass()
12
+ class IO:
13
+ """Stores parameters that control data input and output during various stages of the pipeline."""
14
+
15
+ sessions: list[str] = field(default_factory=list)
16
+ """Specifies the list of sessions to register across days, as absolute paths to their /suite2p directories
17
+ e.g: root/project/animal/session/processed_data/suite2p. The suite2p directory is created as part of the
18
+ 'single-day' suite2p runtime, assuming the default value of the 'save_folder' SingleDayS2PConfiguration class
19
+ attribute was not modified. Note, each suite2p directory has to contain the 'combined' plane folder, which is
20
+ created if the 'combined' SingleDayS2PConfiguration class attribute is 'True'."""
21
+
22
+ mesoscan: bool = True
23
+ """Indicates whether the processed session /suite2p folders contain registered Mesoscope frames."""
24
+
25
+
26
+ @dataclass()
27
+ class CellDetection:
28
+ """Stores parameters for selecting single-day-registered cells (ROIs) to be tracked across multiple sessions (days).
29
+
30
+ To maximize the tracking pipeline reliability, it is beneficial to pre-filter the cells whose identity (as cells)
31
+ is not certain or that may be hard to track across sessions.
32
+ """
33
+
34
+ probability_threshold: float = 0.85
35
+ """The minimum required probability score assigned to the cell (ROI) by the suite2p classifier. Cells with a lower
36
+ classifier score are excluded from processing."""
37
+
38
+ maximum_size: int = 1000
39
+ """The maximum allowed cell (ROI) size, in pixels. Cells with a larger pixel size are excluded from processing."""
40
+
41
+ mesoscope_stripe_borders: list[int] = field(default_factory=list)
42
+ """Stores the x-coordinates of mesoscope combined image stripe (ROI) borders. For mesoscope images, 'stripes' are
43
+ the individual imaging ROIs acquired in the 'multiple-ROI' mode. If this field is not overwritten by the user, the
44
+ pipeline will read the border data from the combined plane 'ops.npy' file generated by single-day suite2p pipeline.
45
+ """
46
+
47
+ stripe_margin: int = 30
48
+ """The minimum required distance, in pixels, between the center-point (the median x-coordinate) of the cell (ROI)
49
+ and the mesoscope stripe border. Cells that are too close to stripe borders are excluded from processing to avoid
50
+ ambiguities associated with tracking cells that span multiple stripes."""
51
+
52
+
53
+ @dataclass()
54
+ class Registration:
55
+ """Stores parameters for aligning (registering) the sessions from multiple days to the same visual space.
56
+
57
+ Registration is used to create a 'shared' visual space, allowing to track the same cells (ROIs) across otherwise
58
+ variable visual space of each session.
59
+ """
60
+
61
+ image_type: str = "enhanced"
62
+ """The type of single-day suite2p-generated image to use for across-day registration. Supported options are
63
+ 'enhanced', 'mean' and 'max'. This 'template' image is used to calculate the necessary deformation (transformations)
64
+ to register (align) all sessions to the same visual space."""
65
+
66
+ grid_sampling_factor: float = 1
67
+ """Determines to what extent the grid sampling scales with the deformed image scale. Has to be between 0 and 1. By
68
+ making this value lower than 1, the grid is relatively fine at the the higher scales, allowing for more
69
+ deformations. This is used when resizing session images as part of the registration process."""
70
+
71
+ scale_sampling: int = 30
72
+ """The number of iterations for each level (i.e. between each factor two in scale) to perform when computing the
73
+ deformations. Values between 20 and 30 are reasonable in most situations, but higher values yield better results in
74
+ general. The speed of the algorithm scales linearly with this value."""
75
+
76
+ speed_factor: float = 3
77
+ """The relative force of the deformation transform applied when registering the sessions to the same visual space.
78
+ This is the most important parameter to tune."""
79
+
80
+
81
+ @dataclass()
82
+ class Clustering:
83
+ """Stores parameters for clustering cell (ROI) masks across multiple registered sessions.
84
+
85
+ Clustering is used to track cells across sessions. If a group of ROIs across sessions is clustered together, it
86
+ is likely that they represent the same cell (ROI) across all sessions. This process involves first creating a
87
+ 'template' mask that tracks a cell using the registered (deformed) visual space and then using this template to
88
+ track the cell in the original (non-deformed) visual space of each session.
89
+ """
90
+
91
+ criterion: str = "distance"
92
+ """Specifies the criterion for clustering (grouping) cell (ROI) masks from different sessions. Currently, the only
93
+ valid option is 'distance'."""
94
+
95
+ threshold: float = 0.75
96
+ """Specifies the threshold for the clustering algorithm. Cell masks will be clustered (grouped) together if their
97
+ clustering criterion is below this threshold value."""
98
+
99
+ mask_prevalence: int = 50
100
+ """Specifies the minimum percentage of all registered sessions that must include the clustered cell mask. Cell masks
101
+ present in fewer percent of sessions than this value are excluded from processing. This parameter is used to isolate
102
+ the cells that are present (active) across sessions."""
103
+
104
+ pixel_prevalence: int = 50
105
+ """Specifies the minimum percentage of all registered sessions in which a pixel from a given cell mask must be
106
+ present for it to be used to construct the template mask. Pixels present in fewer percent of sessions than this
107
+ value are not used to define the 'template' mask coordinates. Template masks are used to extract the cell
108
+ fluorescence from the 'original' visual space of every session. This parameter is used to isolate the part of the
109
+ cell that is stable across sessions."""
110
+
111
+ step_sizes: list[int] = field(default_factory=lambda: [200, 200])
112
+ """Specifies the block size for the clustering process, in pixels. Clustering is applied in blocks of this size,
113
+ sampled across the processed plane image, to reduce the memory (RAM) overhead."""
114
+
115
+ bin_size: int = 50
116
+ """Specifies the size of bins used to discover cell masks within blocks during clustering. To avoid edge cases, the
117
+ algorithm clusters the cell masks within the region defined by the center-point of each cell +- bin_size."""
118
+
119
+ maximum_distance: int = 20
120
+ """Specifies the maximum distance, in pixels, that can separate masks across multiple sessions. The clustering
121
+ algorithm will consider cell masks located at most within this distance from each-other across days as the same
122
+ cells during tacking."""
123
+
124
+ minimum_size: int = 25
125
+ """The minimum size of the non-overlapping (with other cells) cell (ROI) region, in pixels, that has to be covered
126
+ by the template mask, for the cell to be assigned to that template. This is used to determine which template(s) the
127
+ cell belongs to (if any), for the purpose of tracking it across sessions."""
128
+
129
+
130
+ @dataclass()
131
+ class Demix:
132
+ """Stores settings used to deconvolve fluorescence signals from cells tracked across multiple days.
133
+
134
+ This step applies the suite2p spike deconvolution algorithm to the cell masks isolated during clustering to extract
135
+ the fluorescence of the cells tracked across multiple sessions (days). Generally, it should use the same parameters
136
+ as were used by the single-day suite2p pipeline.
137
+ """
138
+
139
+ baseline: str = "maximin"
140
+ """Specifies the method to compute the baseline of each trace. This baseline is then subtracted from each cell.
141
+ ‘maximin’ computes a moving baseline by filtering the data with a Gaussian of width 'sig_baseline' * 'fs', and then
142
+ minimum filtering with a window of 'win_baseline' * 'fs', and then maximum filtering with the same window.
143
+ ‘constant’ computes a constant baseline by filtering with a Gaussian of width 'sig_baseline' * 'fs' and then taking
144
+ the minimum value of this filtered trace. ‘constant_percentile’ computes a constant baseline by taking the
145
+ 'prctile_baseline' percentile of the trace."""
146
+
147
+ win_baseline: float = 60.0
148
+ """The time window, in seconds, over which to compute the baseline filter."""
149
+
150
+ sig_baseline: float = 10.0
151
+ """The standard deviation, in seconds, of the Gaussian filter applied to smooth the baseline signal."""
152
+
153
+ l2_reg: float = 0.1
154
+ """The L2 regularization strength applied during spike deconvolution."""
155
+
156
+ neucoeff: float = 0.7
157
+ """The neuropil coefficient applied for signal correction before deconvolution."""
158
+
159
+
160
+ @dataclass()
161
+ class MultiDayS2PConfiguration(YamlConfig):
162
+ """Aggregates all parameters for the multi-day suite2p pipeline used to track cells across multiple days
163
+ (sessions) and extract their activity.
164
+
165
+ These settings are used to configure the multiday suite2p extraction pipeline, which is based on the reference
166
+ implementation here: https://github.com/sprustonlab/multiday-suite2p-public. This class behaves similar to the
167
+ SingleDayS2PConfiguration class. It can be saved and loaded from a .YAML file and translated to dictionary format,
168
+ expected by the multi-day sl-suite2p pipeline.
169
+ """
170
+
171
+ cell_detection: CellDetection = field(default_factory=CellDetection)
172
+ """Stores parameters for selecting single-day-registered cells (ROIs) to be tracked across multiple sessions
173
+ (days)."""
174
+ registration: Registration = field(default_factory=Registration)
175
+ """Stores parameters for aligning (registering) the sessions from multiple days to the same visual space."""
176
+ clustering: Clustering = field(default_factory=Clustering)
177
+ """Stores parameters for clustering (tracking) cell (ROI) masks across multiple registered sessions."""
178
+ demix: Demix = field(default_factory=Demix)
179
+ """Stores settings used to deconvolve fluorescence signals from cells tracked across multiple days."""
180
+ io: IO = field(default_factory=IO)
181
+ """Stores parameters that control data input and output during various stages of the pipeline."""
182
+
183
+ def to_ops(self) -> dict[str, Any]:
184
+ """Converts the class instance to a dictionary and returns it to caller.
185
+
186
+ This dictionary can be passed to sl-suite2p multi-day functions as the 'ops' argument.
187
+
188
+ Notes:
189
+ Unlike the single-day configuration class, the dictionary generated by this method uses section names as
190
+ top level keys and parameter names as second-level keys. This mimics the original multiday-pipeline
191
+ configuration scheme.
192
+ """
193
+ return asdict(self)
@@ -0,0 +1,99 @@
1
+ from typing import Any
2
+ from dataclasses import field, dataclass
3
+
4
+ from _typeshed import Incomplete
5
+ from ataraxis_data_structures import YamlConfig
6
+
7
+ @dataclass()
8
+ class IO:
9
+ """Stores parameters that control data input and output during various stages of the pipeline."""
10
+
11
+ sessions: list[str] = field(default_factory=list)
12
+ mesoscan: bool = ...
13
+
14
+ @dataclass()
15
+ class CellDetection:
16
+ """Stores parameters for selecting single-day-registered cells (ROIs) to be tracked across multiple sessions (days).
17
+
18
+ To maximize the tracking pipeline reliability, it is beneficial to pre-filter the cells whose identity (as cells)
19
+ is not certain or that may be hard to track across sessions.
20
+ """
21
+
22
+ probability_threshold: float = ...
23
+ maximum_size: int = ...
24
+ mesoscope_stripe_borders: list[int] = field(default_factory=list)
25
+ stripe_margin: int = ...
26
+
27
+ @dataclass()
28
+ class Registration:
29
+ """Stores parameters for aligning (registering) the sessions from multiple days to the same visual space.
30
+
31
+ Registration is used to create a 'shared' visual space, allowing to track the same cells (ROIs) across otherwise
32
+ variable visual space of each session.
33
+ """
34
+
35
+ image_type: str = ...
36
+ grid_sampling_factor: float = ...
37
+ scale_sampling: int = ...
38
+ speed_factor: float = ...
39
+
40
+ @dataclass()
41
+ class Clustering:
42
+ """Stores parameters for clustering cell (ROI) masks across multiple registered sessions.
43
+
44
+ Clustering is used to track cells across sessions. If a group of ROIs across sessions is clustered together, it
45
+ is likely that they represent the same cell (ROI) across all sessions. This process involves first creating a
46
+ 'template' mask that tracks a cell using the registered (deformed) visual space and then using this template to
47
+ track the cell in the original (non-deformed) visual space of each session.
48
+ """
49
+
50
+ criterion: str = ...
51
+ threshold: float = ...
52
+ mask_prevalence: int = ...
53
+ pixel_prevalence: int = ...
54
+ step_sizes: list[int] = field(default_factory=Incomplete)
55
+ bin_size: int = ...
56
+ maximum_distance: int = ...
57
+ minimum_size: int = ...
58
+
59
+ @dataclass()
60
+ class Demix:
61
+ """Stores settings used to deconvolve fluorescence signals from cells tracked across multiple days.
62
+
63
+ This step applies the suite2p spike deconvolution algorithm to the cell masks isolated during clustering to extract
64
+ the fluorescence of the cells tracked across multiple sessions (days). Generally, it should use the same parameters
65
+ as were used by the single-day suite2p pipeline.
66
+ """
67
+
68
+ baseline: str = ...
69
+ win_baseline: float = ...
70
+ sig_baseline: float = ...
71
+ l2_reg: float = ...
72
+ neucoeff: float = ...
73
+
74
+ @dataclass()
75
+ class MultiDayS2PConfiguration(YamlConfig):
76
+ """Aggregates all parameters for the multi-day suite2p pipeline used to track cells across multiple days
77
+ (sessions) and extract their activity.
78
+
79
+ These settings are used to configure the multiday suite2p extraction pipeline, which is based on the reference
80
+ implementation here: https://github.com/sprustonlab/multiday-suite2p-public. This class behaves similar to the
81
+ SingleDayS2PConfiguration class. It can be saved and loaded from a .YAML file and translated to dictionary format,
82
+ expected by the multi-day sl-suite2p pipeline.
83
+ """
84
+
85
+ cell_detection: CellDetection = field(default_factory=CellDetection)
86
+ registration: Registration = field(default_factory=Registration)
87
+ clustering: Clustering = field(default_factory=Clustering)
88
+ demix: Demix = field(default_factory=Demix)
89
+ io: IO = field(default_factory=IO)
90
+ def to_ops(self) -> dict[str, Any]:
91
+ """Converts the class instance to a dictionary and returns it to caller.
92
+
93
+ This dictionary can be passed to sl-suite2p multi-day functions as the 'ops' argument.
94
+
95
+ Notes:
96
+ Unlike the single-day configuration class, the dictionary generated by this method uses section names as
97
+ top level keys and parameter names as second-level keys. This mimics the original multiday-pipeline
98
+ configuration scheme.
99
+ """
@@ -1,6 +1,7 @@
1
- """This module provides the classes used to store suite2p runtime configuration parameters in .YAML files. This is used
2
- by the sl-forgery library to configure mesoscope data processing via the suite2p library, both during single-day and
3
- multiday registration processing."""
1
+ """This module stores the classes used to configure the single-day (within-session) sl-suite2p pipeline. This is the
2
+ 'original' suite2p pipeline used to process brain activity data collected as part of a single continuous recording. It
3
+ is used as the first step of the multi-day brain activity processing pipeline used in the lab. Both single-day
4
+ (original) and multi-day (extended) pipelines are available as part of the Sun lab maintained sl-suite2p package."""
4
5
 
5
6
  from typing import Any
6
7
  from dataclasses import field, asdict, dataclass
@@ -10,7 +11,7 @@ from ataraxis_data_structures import YamlConfig
10
11
 
11
12
  @dataclass
12
13
  class Main:
13
- """Stores global settings used to broadly define the suite2p processing configuration."""
14
+ """Stores global parameters that broadly define the suite2p single-day processing configuration."""
14
15
 
15
16
  nplanes: int = 3
16
17
  """The number of imaging planes in each TIFF file sequence. For Mesoscope frames, this is the number of individual
@@ -24,16 +25,17 @@ class Main:
24
25
 
25
26
  tau: float = 0.4
26
27
  """The timescale of the sensor, in seconds, used for computing the deconvolution kernel. The kernel is fixed to
27
- have this decay and is not fit to the data. Note, the default value was optimized for GCamp6f animals used in
28
- Weinan's OSM Manuscript."""
28
+ have this decay and is not fit to the data. Note, the default value is optimized for GCamp6f animals recorded with
29
+ the Mesoscope."""
29
30
 
30
31
  force_sktiff: bool = True
31
- """Determines whether to force the use of scikit-image for reading TIFF files. This HAS to be true for our tiff
32
- files, as they are compressed in a way that cannot be read with ScanImage tiff reader."""
32
+ """Determines whether to force the use of scikit-image for reading TIFF files. Generally, it is recommended to have
33
+ this enabled as it forces suite2p to use tifffile library, which has better safety and compatibility than
34
+ ScanImage tiff reader for certain types of tiff files."""
33
35
 
34
36
  fs: float = 10.0014
35
- """The sampling rate per plane in Hertz. This is automatically overwritten using ops.json file generated by our
36
- preprocessing pipeline to match the specific acquisition frequency of the processed dataset."""
37
+ """The sampling rate per plane in Hertz. For instance, if you have a 10 plane recording acquired at 30Hz, then the
38
+ sampling rate per plane is 3Hz, so set this to 3."""
37
39
 
38
40
  do_bidiphase: bool = False
39
41
  """Determines whether to perform computation of bidirectional phase offset for misaligned line scanning
@@ -53,8 +55,8 @@ class Main:
53
55
  to process all available frames."""
54
56
 
55
57
  multiplane_parallel: bool = True
56
- """Determines whether to parallelize plane processing for multiplane data. Assuming that this configuration class is
57
- used together with Sun lab optimized suite2p, it is always recommended to have this set to True for most runtimes.
58
+ """Determines whether to parallelize plane processing for multiplane data. Note, while enabling this option improves
59
+ processing speeds, it also increases the memory (RAM) overhead resulting from processing all planes in-parallel.
58
60
  """
59
61
 
60
62
  ignore_flyback: list[int] = field(default_factory=list)
@@ -63,7 +65,7 @@ class Main:
63
65
 
64
66
  @dataclass
65
67
  class FileIO:
66
- """Stores I/O settings used to specify input data file locations, formats, and output storage options."""
68
+ """Stores general I/O parameters that specify input data location, format, and working and output directories."""
67
69
 
68
70
  fast_disk: list[str] = field(default_factory=list)
69
71
  """Specifies the locations where to store the temporary binary files created during processing. If no directories
@@ -107,7 +109,9 @@ class FileIO:
107
109
 
108
110
  save_folder: list[str] = field(default_factory=list)
109
111
  """Lists folder names under which the results should be stored. If this is not provided, the pipeline defaults to
110
- using 'suite2p' as the root folder, created under the path specified by save_path0."""
112
+ using 'suite2p' as the root folder, created under the path specified by save_path0. Note, if the data produced by
113
+ the 'single-day' pipeline is also processed using sl-suite2p 'multi-day' pipeline, do not modify this field. The
114
+ multi-day pipeline expects the save_folder to be 'suite2p' (default)."""
111
115
 
112
116
  look_one_level_down: bool = False
113
117
  """Determines whether to search for TIFF files in the subfolders when searching for Tiff files. If this is True,
@@ -123,7 +127,7 @@ class FileIO:
123
127
 
124
128
  @dataclass
125
129
  class Output:
126
- """Stores I/O settings used to define the output format and organization of the processing results."""
130
+ """Stores I/O settings that specify the output format and organization of the data processing results."""
127
131
 
128
132
  preclassify: float = 0.5
129
133
  """The probability threshold for pre-classification of cells to use before signal extraction. If this is set to
@@ -149,7 +153,7 @@ class Output:
149
153
 
150
154
  @dataclass
151
155
  class Registration:
152
- """Stores rigid registration settings used for correcting motion artifacts between frames."""
156
+ """Stores parameters for rigid registration, which is used to correct motion artifacts between frames."""
153
157
 
154
158
  do_registration: bool = True
155
159
  """Determines whether to run the motion registration."""
@@ -214,7 +218,8 @@ class Registration:
214
218
 
215
219
  @dataclass
216
220
  class OnePRegistration:
217
- """Stores additional pre-registration processing settings used to improve the registration of 1-photon datasets."""
221
+ """Stores parameters for additional pre-registration processing used to improve the registration of 1-photon
222
+ datasets."""
218
223
 
219
224
  one_p_reg: bool = False
220
225
  """Determines whether to perform high-pass spatial filtering and tapering to improve one-photon image
@@ -233,7 +238,8 @@ class OnePRegistration:
233
238
 
234
239
  @dataclass
235
240
  class NonRigid:
236
- """Stores non-rigid registration settings used to improve motion registration in complex datasets."""
241
+ """Stores parameters for non-rigid registration, which is used to improve motion registration in complex
242
+ datasets."""
237
243
 
238
244
  nonrigid: bool = True
239
245
  """Determines whether to perform non-rigid registration to correct for local motion and deformation. This is used
@@ -253,7 +259,7 @@ class NonRigid:
253
259
 
254
260
  @dataclass
255
261
  class ROIDetection:
256
- """Stores ROI detection and extraction settings used to identify cells and their activity signals."""
262
+ """Stores parameters for cell ROI detection and extraction."""
257
263
 
258
264
  roidetect: bool = True
259
265
  """Determines whether to perform ROI detection and subsequent signal extraction."""
@@ -292,7 +298,8 @@ class ROIDetection:
292
298
  """The maximum number of iterations allowed for cell extraction."""
293
299
 
294
300
  nbinned: int = 5000
295
- """The maximum number of binned frames to use for ROI detection to speed up processing."""
301
+ """The maximum number of binned frames to use for ROI detection. Settings this value to a higher number leads to
302
+ more ROIs being detected, but reduces processing speed and increases RAM overhead."""
296
303
 
297
304
  denoise: bool = False
298
305
  """Determines whether to denoise the binned movie before cell detection in sparse mode to enhance performance.
@@ -301,7 +308,7 @@ class ROIDetection:
301
308
 
302
309
  @dataclass
303
310
  class CellposeDetection:
304
- """Stores Cellpose algorithm settings used for cell detection."""
311
+ """Stores parameters for the Cellpose algorithm, which can optionally be used to improve cell ROI extraction."""
305
312
 
306
313
  anatomical_only: int = 0
307
314
  """Specifies the Cellpose mode for cell detection:
@@ -332,7 +339,7 @@ class CellposeDetection:
332
339
 
333
340
  @dataclass
334
341
  class SignalExtraction:
335
- """Stores settings used to extract fluorescence signals from ROIs and surrounding neuropil regions."""
342
+ """Stores parameters for extracting fluorescence signals from ROIs and surrounding neuropil regions."""
336
343
 
337
344
  neuropil_extract: bool = True
338
345
  """Determines whether to extract neuropil signals."""
@@ -353,10 +360,10 @@ class SignalExtraction:
353
360
 
354
361
  @dataclass
355
362
  class SpikeDeconvolution:
356
- """Stores settings used to deconvolve calcium signals to infer spike trains."""
363
+ """Stores parameters for deconvolve fluorescence signals to infer spike trains."""
357
364
 
358
365
  spikedetect: bool = True
359
- """Determines whether to perform spike deconvolution to convert calcium signals into estimated spike trains."""
366
+ """Determines whether to perform spike deconvolution."""
360
367
 
361
368
  neucoeff: float = 0.7
362
369
  """The neuropil coefficient applied for signal correction before deconvolution."""
@@ -382,7 +389,7 @@ class SpikeDeconvolution:
382
389
 
383
390
  @dataclass
384
391
  class Classification:
385
- """Stores settings used to classify detected ROIs as real cells or artifacts."""
392
+ """Stores parameters for classifying detected ROIs as real cells or artifacts."""
386
393
 
387
394
  soma_crop: bool = True
388
395
  """Determines whether to crop dendritic regions from detected ROIs to focus on the cell body for classification
@@ -397,20 +404,22 @@ class Classification:
397
404
 
398
405
  @dataclass
399
406
  class Channel2:
400
- """Stores settings for processing the second channel in multichannel datasets."""
407
+ """Stores parameters for processing the second channel in multichannel datasets."""
401
408
 
402
409
  chan2_thres: float = 0.65
403
410
  """The threshold for considering an ROI registered in one channel as detected in the second channel."""
404
411
 
405
412
 
406
413
  @dataclass
407
- class Suite2PConfiguration(YamlConfig):
408
- """Stores the user-addressable suite2p configuration parameters, organized into subsections.
414
+ class SingleDayS2PConfiguration(YamlConfig):
415
+ """Stores the user-addressable suite2p configuration parameters for the single-day (original) pipeline, organized
416
+ into subsections.
409
417
 
410
- This class is used during processing to instruct suite2p on how to process the data. Specifically, it provides a
411
- user-friendly way of specifying all user-addressable parameters through a .YAML file. The sl-forgery library then
412
- loads the data from .yaml file and uses it to configure the single-day suite2p pipeline and the multiday suite2p
413
- pipeline.
418
+ This class is used during single-day processing to instruct suite2p on how to process the data. This class is based
419
+ on the 'default_ops' from the original suite2p package. As part of the suite2p refactoring performed in sl-suite2p
420
+ package, the 'default_ops' has been replaced with this class instance. Compared to 'original' ops, it allows saving
421
+ configuration parameters as a .YAML file, which offers a better way of viewing and editing the parameters and
422
+ running suite2p pipeline on remote compute servers.
414
423
 
415
424
  Notes:
416
425
  The .YAML file uses section names that match the suite2p documentation sections. This way, users can always
@@ -419,17 +428,31 @@ class Suite2PConfiguration(YamlConfig):
419
428
 
420
429
  # Define the instances of each nested settings class as fields
421
430
  main: Main = field(default_factory=Main)
431
+ """Stores global parameters that broadly define the suite2p single-day processing configuration."""
422
432
  file_io: FileIO = field(default_factory=FileIO)
433
+ """Stores general I/O parameters that specify input data location, format, and working and output directories."""
423
434
  output: Output = field(default_factory=Output)
435
+ """Stores I/O settings that specify the output format and organization of the data processing results."""
424
436
  registration: Registration = field(default_factory=Registration)
437
+ """Stores parameters for rigid registration, which is used to correct motion artifacts between frames."""
425
438
  one_p_registration: OnePRegistration = field(default_factory=OnePRegistration)
439
+ """Stores parameters for additional pre-registration processing used to improve the registration of 1-photon
440
+ datasets."""
426
441
  non_rigid: NonRigid = field(default_factory=NonRigid)
442
+ """Stores parameters for non-rigid registration, which is used to improve motion registration in complex
443
+ datasets."""
427
444
  roi_detection: ROIDetection = field(default_factory=ROIDetection)
445
+ """Stores parameters for cell ROI detection and extraction."""
428
446
  cellpose_detection: CellposeDetection = field(default_factory=CellposeDetection)
447
+ """Stores parameters for the Cellpose algorithm, which can optionally be used to improve cell ROI extraction."""
429
448
  signal_extraction: SignalExtraction = field(default_factory=SignalExtraction)
449
+ """Stores parameters for extracting fluorescence signals from ROIs and surrounding neuropil regions."""
430
450
  spike_deconvolution: SpikeDeconvolution = field(default_factory=SpikeDeconvolution)
451
+ """Stores parameters for deconvolve fluorescence signals to infer spike trains."""
431
452
  classification: Classification = field(default_factory=Classification)
453
+ """Stores parameters for classifying detected ROIs as real cells or artifacts."""
432
454
  channel2: Channel2 = field(default_factory=Channel2)
455
+ """Stores parameters for processing the second channel in multichannel datasets."""
433
456
 
434
457
  def to_ops(self) -> dict[str, Any]:
435
458
  """Converts the class instance to a dictionary and returns it to caller.
@@ -6,7 +6,7 @@ from ataraxis_data_structures import YamlConfig
6
6
 
7
7
  @dataclass
8
8
  class Main:
9
- """Stores global settings used to broadly define the suite2p processing configuration."""
9
+ """Stores global parameters that broadly define the suite2p single-day processing configuration."""
10
10
 
11
11
  nplanes: int = ...
12
12
  nchannels: int = ...
@@ -23,7 +23,7 @@ class Main:
23
23
 
24
24
  @dataclass
25
25
  class FileIO:
26
- """Stores I/O settings used to specify input data file locations, formats, and output storage options."""
26
+ """Stores general I/O parameters that specify input data location, format, and working and output directories."""
27
27
 
28
28
  fast_disk: list[str] = field(default_factory=list)
29
29
  delete_bin: bool = ...
@@ -43,7 +43,7 @@ class FileIO:
43
43
 
44
44
  @dataclass
45
45
  class Output:
46
- """Stores I/O settings used to define the output format and organization of the processing results."""
46
+ """Stores I/O settings that specify the output format and organization of the data processing results."""
47
47
 
48
48
  preclassify: float = ...
49
49
  save_nwb: bool = ...
@@ -54,7 +54,7 @@ class Output:
54
54
 
55
55
  @dataclass
56
56
  class Registration:
57
- """Stores rigid registration settings used for correcting motion artifacts between frames."""
57
+ """Stores parameters for rigid registration, which is used to correct motion artifacts between frames."""
58
58
 
59
59
  do_registration: bool = ...
60
60
  align_by_chan: int = ...
@@ -75,7 +75,8 @@ class Registration:
75
75
 
76
76
  @dataclass
77
77
  class OnePRegistration:
78
- """Stores additional pre-registration processing settings used to improve the registration of 1-photon datasets."""
78
+ """Stores parameters for additional pre-registration processing used to improve the registration of 1-photon
79
+ datasets."""
79
80
 
80
81
  one_p_reg: bool = ...
81
82
  spatial_hp_reg: int = ...
@@ -84,7 +85,8 @@ class OnePRegistration:
84
85
 
85
86
  @dataclass
86
87
  class NonRigid:
87
- """Stores non-rigid registration settings used to improve motion registration in complex datasets."""
88
+ """Stores parameters for non-rigid registration, which is used to improve motion registration in complex
89
+ datasets."""
88
90
 
89
91
  nonrigid: bool = ...
90
92
  block_size: list[int] = field(default_factory=Incomplete)
@@ -93,7 +95,7 @@ class NonRigid:
93
95
 
94
96
  @dataclass
95
97
  class ROIDetection:
96
- """Stores ROI detection and extraction settings used to identify cells and their activity signals."""
98
+ """Stores parameters for cell ROI detection and extraction."""
97
99
 
98
100
  roidetect: bool = ...
99
101
  sparse_mode: bool = ...
@@ -110,7 +112,7 @@ class ROIDetection:
110
112
 
111
113
  @dataclass
112
114
  class CellposeDetection:
113
- """Stores Cellpose algorithm settings used for cell detection."""
115
+ """Stores parameters for the Cellpose algorithm, which can optionally be used to improve cell ROI extraction."""
114
116
 
115
117
  anatomical_only: int = ...
116
118
  diameter: int = ...
@@ -121,7 +123,7 @@ class CellposeDetection:
121
123
 
122
124
  @dataclass
123
125
  class SignalExtraction:
124
- """Stores settings used to extract fluorescence signals from ROIs and surrounding neuropil regions."""
126
+ """Stores parameters for extracting fluorescence signals from ROIs and surrounding neuropil regions."""
125
127
 
126
128
  neuropil_extract: bool = ...
127
129
  allow_overlap: bool = ...
@@ -131,7 +133,7 @@ class SignalExtraction:
131
133
 
132
134
  @dataclass
133
135
  class SpikeDeconvolution:
134
- """Stores settings used to deconvolve calcium signals to infer spike trains."""
136
+ """Stores parameters for deconvolve fluorescence signals to infer spike trains."""
135
137
 
136
138
  spikedetect: bool = ...
137
139
  neucoeff: float = ...
@@ -142,7 +144,7 @@ class SpikeDeconvolution:
142
144
 
143
145
  @dataclass
144
146
  class Classification:
145
- """Stores settings used to classify detected ROIs as real cells or artifacts."""
147
+ """Stores parameters for classifying detected ROIs as real cells or artifacts."""
146
148
 
147
149
  soma_crop: bool = ...
148
150
  use_builtin_classifier: bool = ...
@@ -150,18 +152,20 @@ class Classification:
150
152
 
151
153
  @dataclass
152
154
  class Channel2:
153
- """Stores settings for processing the second channel in multichannel datasets."""
155
+ """Stores parameters for processing the second channel in multichannel datasets."""
154
156
 
155
157
  chan2_thres: float = ...
156
158
 
157
159
  @dataclass
158
- class Suite2PConfiguration(YamlConfig):
159
- """Stores the user-addressable suite2p configuration parameters, organized into subsections.
160
-
161
- This class is used during processing to instruct suite2p on how to process the data. Specifically, it provides a
162
- user-friendly way of specifying all user-addressable parameters through a .YAML file. The sl-forgery library then
163
- loads the data from .yaml file and uses it to configure the single-day suite2p pipeline and the multiday suite2p
164
- pipeline.
160
+ class SingleDayS2PConfiguration(YamlConfig):
161
+ """Stores the user-addressable suite2p configuration parameters for the single-day (original) pipeline, organized
162
+ into subsections.
163
+
164
+ This class is used during single-day processing to instruct suite2p on how to process the data. This class is based
165
+ on the 'default_ops' from the original suite2p package. As part of the suite2p refactoring performed in sl-suite2p
166
+ package, the 'default_ops' has been replaced with this class instance. Compared to 'original' ops, it allows saving
167
+ configuration parameters as a .YAML file, which offers a better way of viewing and editing the parameters and
168
+ running suite2p pipeline on remote compute servers.
165
169
 
166
170
  Notes:
167
171
  The .YAML file uses section names that match the suite2p documentation sections. This way, users can always