cellects 0.1.2__py3-none-any.whl → 0.2.6__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.
Files changed (38) hide show
  1. cellects/__main__.py +65 -25
  2. cellects/config/all_vars_dict.py +18 -17
  3. cellects/core/cellects_threads.py +1034 -396
  4. cellects/core/motion_analysis.py +1664 -2010
  5. cellects/core/one_image_analysis.py +1082 -1061
  6. cellects/core/program_organizer.py +1687 -1316
  7. cellects/core/script_based_run.py +80 -76
  8. cellects/gui/advanced_parameters.py +390 -330
  9. cellects/gui/cellects.py +102 -91
  10. cellects/gui/custom_widgets.py +16 -33
  11. cellects/gui/first_window.py +226 -104
  12. cellects/gui/if_several_folders_window.py +117 -68
  13. cellects/gui/image_analysis_window.py +866 -454
  14. cellects/gui/required_output.py +104 -57
  15. cellects/gui/ui_strings.py +840 -0
  16. cellects/gui/video_analysis_window.py +333 -155
  17. cellects/image_analysis/cell_leaving_detection.py +64 -4
  18. cellects/image_analysis/image_segmentation.py +451 -22
  19. cellects/image_analysis/morphological_operations.py +2166 -1635
  20. cellects/image_analysis/network_functions.py +616 -253
  21. cellects/image_analysis/one_image_analysis_threads.py +94 -153
  22. cellects/image_analysis/oscillations_functions.py +131 -0
  23. cellects/image_analysis/progressively_add_distant_shapes.py +2 -3
  24. cellects/image_analysis/shape_descriptors.py +517 -466
  25. cellects/utils/formulas.py +169 -6
  26. cellects/utils/load_display_save.py +362 -109
  27. cellects/utils/utilitarian.py +86 -9
  28. cellects-0.2.6.dist-info/LICENSE +675 -0
  29. cellects-0.2.6.dist-info/METADATA +829 -0
  30. cellects-0.2.6.dist-info/RECORD +44 -0
  31. cellects/core/one_video_per_blob.py +0 -540
  32. cellects/image_analysis/cluster_flux_study.py +0 -102
  33. cellects-0.1.2.dist-info/LICENSE.odt +0 -0
  34. cellects-0.1.2.dist-info/METADATA +0 -132
  35. cellects-0.1.2.dist-info/RECORD +0 -44
  36. {cellects-0.1.2.dist-info → cellects-0.2.6.dist-info}/WHEEL +0 -0
  37. {cellects-0.1.2.dist-info → cellects-0.2.6.dist-info}/entry_points.txt +0 -0
  38. {cellects-0.1.2.dist-info → cellects-0.2.6.dist-info}/top_level.txt +0 -0
@@ -141,6 +141,65 @@ def translate_dict(old_dict: dict) -> Dict:
141
141
  return numba_dict
142
142
 
143
143
 
144
+ def split_dict(c_space_dict: dict) -> Tuple[Dict, Dict, list]:
145
+ """
146
+
147
+ Split a dictionary into two dictionaries based on specific criteria and return their keys.
148
+
149
+ Split the input dictionary `c_space_dict` into two dictionaries: one for items not
150
+ ending with '2' and another where the key is truncated by removing its last
151
+ character if it does end with '2'. Additionally, return the keys that have been
152
+ processed.
153
+
154
+ Parameters
155
+ ----------
156
+ c_space_dict : dict
157
+ The dictionary to be split. Expected keys are strings and values can be any type.
158
+
159
+ Returns
160
+ -------
161
+ first_dict : dict
162
+ Dictionary containing items from `c_space_dict` whose keys do not end with '2'.
163
+ second_dict : dict
164
+ Dictionary containing items from `c_space_dict` whose keys end with '2',
165
+ where the key is truncated by removing its last character.
166
+ c_spaces : list
167
+ List of keys from `c_space_dict` that have been processed.
168
+
169
+ Raises
170
+ ------
171
+ None
172
+
173
+ Notes
174
+ -----
175
+ No critical information to share.
176
+
177
+ Examples
178
+ --------
179
+ >>> c_space_dict = {'key1': 10, 'key2': 20, 'logical': 30}
180
+ >>> first_dict, second_dict, c_spaces = split_dict(c_space_dict)
181
+ >>> print(first_dict)
182
+ {'key1': 10}
183
+ >>> print(second_dict)
184
+ {'key': 20}
185
+ >>> print(c_spaces)
186
+ ['key1', 'key']
187
+
188
+ """
189
+ first_dict = Dict()
190
+ second_dict = Dict()
191
+ c_spaces = []
192
+ for k, v in c_space_dict.items():
193
+ if k == 'PCA' or k != 'logical' and np.absolute(v).sum() > 0:
194
+ if k[-1] != '2':
195
+ first_dict[k] = v
196
+ c_spaces.append(k)
197
+ else:
198
+ second_dict[k[:-1]] = v
199
+ c_spaces.append(k[:-1])
200
+ return first_dict, second_dict, c_spaces
201
+
202
+
144
203
  def reduce_path_len(pathway: str, to_start: int, from_end: int) -> str:
145
204
  """
146
205
  Reduce the length of a given pathway string by truncating it from both ends.
@@ -435,7 +494,6 @@ def smallest_memory_array(array_object, array_type='uint') -> NDArray:
435
494
  if isinstance(array_object, np.ndarray):
436
495
  value_max = array_object.max()
437
496
  else:
438
-
439
497
  if len(array_object[0]) > 0:
440
498
  value_max = np.max((array_object[0].max(), array_object[1].max()))
441
499
  else:
@@ -474,17 +532,36 @@ def remove_coordinates(arr1: NDArray, arr2: NDArray) -> NDArray:
474
532
 
475
533
  Examples
476
534
  --------
477
- >>> arr1 = np.arange(200).reshape(100, 2)
478
- >>> arr2 = np.array([[196, 197], [198, 199]])
535
+ >>> arr1 = np.array([[1, 2], [3, 4]])
536
+ >>> arr2 = np.array([[3, 4]])
479
537
  >>> remove_coordinates(arr1, arr2)
480
- array([[0, 0],
538
+ array([[1, 2],
481
539
  [3, 4]])
482
- """
483
- if arr1.shape[1] != 2 or arr2.shape[1] != 2:
484
- raise ValueError("Both arrays must have shape (n, 2)")
485
- mask = ~np.isin(arr1, arr2).all(axis=1)
486
- return arr1[mask]
487
540
 
541
+ >>> arr1 = np.array([[1, 2], [3, 4]])
542
+ >>> arr2 = np.array([[3, 2], [1, 4]])
543
+ >>> remove_coordinates(arr1, arr2)
544
+ array([[1, 2],
545
+ [3, 4]])
488
546
 
547
+ >>> arr1 = np.array([[1, 2], [3, 4]])
548
+ >>> arr2 = np.array([[3, 2], [1, 2]])
549
+ >>> remove_coordinates(arr1, arr2)
550
+ array([[3, 4]])
489
551
 
552
+ >>> arr1 = np.arange(200).reshape(100, 2)
553
+ >>> arr2 = np.array([[196, 197], [198, 199]])
554
+ >>> new_arr1 = remove_coordinates(arr1, arr2)
555
+ >>> new_arr1.shape
556
+ (98, 2)
557
+ """
558
+ if arr2.shape[0] == 0:
559
+ return arr1
560
+ else:
561
+ if arr1.shape[1] != 2 or arr2.shape[1] != 2:
562
+ raise ValueError("Both arrays must have shape (n, 2)")
563
+ c_to_keep = ~np.all(arr1 == arr2[0], axis=1)
564
+ for row in arr2[1:]:
565
+ c_to_keep *= ~np.all(arr1 == row, axis=1)
566
+ return arr1[c_to_keep]
490
567