celldetective 1.3.7.post1__tar.gz → 1.3.8__tar.gz

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 (121) hide show
  1. {celldetective-1.3.7.post1 → celldetective-1.3.8}/PKG-INFO +11 -2
  2. celldetective-1.3.8/celldetective/_version.py +1 -0
  3. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/btrack_options.py +8 -8
  4. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/classifier_widget.py +8 -0
  5. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/configure_new_exp.py +1 -1
  6. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/json_readers.py +2 -4
  7. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/plot_signals_ui.py +38 -29
  8. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/process_block.py +1 -0
  9. celldetective-1.3.8/celldetective/gui/processes/downloader.py +108 -0
  10. celldetective-1.3.8/celldetective/gui/processes/measure_cells.py +346 -0
  11. celldetective-1.3.8/celldetective/gui/processes/segment_cells.py +354 -0
  12. celldetective-1.3.8/celldetective/gui/processes/track_cells.py +298 -0
  13. celldetective-1.3.8/celldetective/gui/processes/train_segmentation_model.py +270 -0
  14. celldetective-1.3.8/celldetective/gui/processes/train_signal_model.py +108 -0
  15. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/seg_model_loader.py +71 -25
  16. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/signal_annotator2.py +10 -7
  17. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/signal_annotator_options.py +1 -1
  18. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/tableUI.py +252 -20
  19. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/viewers.py +1 -1
  20. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/io.py +53 -20
  21. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/measure.py +12 -144
  22. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/relative_measurements.py +40 -43
  23. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/segmentation.py +48 -1
  24. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/signals.py +84 -305
  25. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/tracking.py +23 -24
  26. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/utils.py +1 -1
  27. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/PKG-INFO +11 -2
  28. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/SOURCES.txt +6 -0
  29. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/requires.txt +1 -0
  30. {celldetective-1.3.7.post1 → celldetective-1.3.8}/setup.py +1 -1
  31. celldetective-1.3.7.post1/celldetective/_version.py +0 -1
  32. {celldetective-1.3.7.post1 → celldetective-1.3.8}/LICENSE +0 -0
  33. {celldetective-1.3.7.post1 → celldetective-1.3.8}/README.md +0 -0
  34. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/__init__.py +0 -0
  35. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/__main__.py +0 -0
  36. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/datasets/segmentation_annotations/blank +0 -0
  37. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/datasets/signal_annotations/blank +0 -0
  38. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/events.py +0 -0
  39. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/extra_properties.py +0 -0
  40. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/filters.py +0 -0
  41. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/InitWindow.py +0 -0
  42. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/__init__.py +0 -0
  43. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/about.py +0 -0
  44. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/analyze_block.py +0 -0
  45. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/control_panel.py +0 -0
  46. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/generic_signal_plot.py +0 -0
  47. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/gui_utils.py +0 -0
  48. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/DL-segmentation-strategy.json +0 -0
  49. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/Threshold-vs-DL.json +0 -0
  50. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/cell-populations.json +0 -0
  51. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/exp-structure.json +0 -0
  52. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/feature-btrack.json +0 -0
  53. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/neighborhood.json +0 -0
  54. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/prefilter-for-segmentation.json +0 -0
  55. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/preprocessing.json +0 -0
  56. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/propagate-classification.json +0 -0
  57. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/track-postprocessing.json +0 -0
  58. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/help/tracking.json +0 -0
  59. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/layouts.py +0 -0
  60. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/measurement_options.py +0 -0
  61. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/neighborhood_options.py +0 -0
  62. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/plot_measurements.py +0 -0
  63. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/retrain_segmentation_model_options.py +0 -0
  64. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/retrain_signal_model_options.py +0 -0
  65. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/signal_annotator.py +0 -0
  66. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/styles.py +0 -0
  67. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/survival_ui.py +0 -0
  68. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/thresholds_gui.py +0 -0
  69. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/gui/workers.py +0 -0
  70. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/logo-large.png +0 -0
  71. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/logo.png +0 -0
  72. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/signals_icon.png +0 -0
  73. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/splash-test.png +0 -0
  74. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/splash.png +0 -0
  75. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/splash0.png +0 -0
  76. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/survival2.png +0 -0
  77. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/vignette_signals2.png +0 -0
  78. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/icons/vignette_signals2.svg +0 -0
  79. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/links/zenodo.json +0 -0
  80. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/pair_signal_detection/blank +0 -0
  81. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_effectors/blank +0 -0
  82. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_effectors/ricm_bf_all_last/config_input.json +0 -0
  83. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_effectors/ricm_bf_all_last/ricm_bf_all_last +0 -0
  84. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_effectors/ricm_bf_all_last/training_instructions.json +0 -0
  85. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_effectors/test-transfer/config_input.json +0 -0
  86. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_effectors/test-transfer/test-transfer +0 -0
  87. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_generic/blank +0 -0
  88. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/segmentation_targets/blank +0 -0
  89. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/signal_detection/blank +0 -0
  90. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/tracking_configs/biased_motion.json +0 -0
  91. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/tracking_configs/mcf7.json +0 -0
  92. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/tracking_configs/no_z_motion.json +0 -0
  93. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/tracking_configs/ricm.json +0 -0
  94. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/models/tracking_configs/ricm2.json +0 -0
  95. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/neighborhood.py +0 -0
  96. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/preprocessing.py +0 -0
  97. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/analyze_signals.py +0 -0
  98. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/measure_cells.py +0 -0
  99. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/measure_relative.py +0 -0
  100. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/segment_cells.py +0 -0
  101. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/segment_cells_thresholds.py +0 -0
  102. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/track_cells.py +0 -0
  103. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/train_segmentation_model.py +0 -0
  104. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective/scripts/train_signal_model.py +0 -0
  105. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/dependency_links.txt +0 -0
  106. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/entry_points.txt +0 -0
  107. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/not-zip-safe +0 -0
  108. {celldetective-1.3.7.post1 → celldetective-1.3.8}/celldetective.egg-info/top_level.txt +0 -0
  109. {celldetective-1.3.7.post1 → celldetective-1.3.8}/setup.cfg +0 -0
  110. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/__init__.py +0 -0
  111. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_events.py +0 -0
  112. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_filters.py +0 -0
  113. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_io.py +0 -0
  114. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_measure.py +0 -0
  115. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_neighborhood.py +0 -0
  116. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_preprocessing.py +0 -0
  117. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_qt.py +0 -0
  118. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_segmentation.py +0 -0
  119. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_signals.py +0 -0
  120. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_tracking.py +0 -0
  121. {celldetective-1.3.7.post1 → celldetective-1.3.8}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: celldetective
3
- Version: 1.3.7.post1
3
+ Version: 1.3.8
4
4
  Summary: description
5
5
  Home-page: http://github.com/remyeltorro/celldetective
6
6
  Author: Rémy Torro
@@ -30,6 +30,7 @@ Requires-Dist: setuptools
30
30
  Requires-Dist: scipy
31
31
  Requires-Dist: seaborn
32
32
  Requires-Dist: opencv-python-headless==4.7.0.72
33
+ Requires-Dist: PyQt5
33
34
  Requires-Dist: liblapack
34
35
  Requires-Dist: gputools
35
36
  Requires-Dist: lmfit
@@ -43,6 +44,14 @@ Requires-Dist: h5py
43
44
  Requires-Dist: cliffs_delta
44
45
  Requires-Dist: requests
45
46
  Requires-Dist: trackpy
47
+ Dynamic: author
48
+ Dynamic: author-email
49
+ Dynamic: description
50
+ Dynamic: description-content-type
51
+ Dynamic: home-page
52
+ Dynamic: license
53
+ Dynamic: requires-dist
54
+ Dynamic: summary
46
55
 
47
56
  # Celldetective
48
57
 
@@ -0,0 +1 @@
1
+ __version__ = "1.3.8"
@@ -379,15 +379,15 @@ class ConfigTracking(QMainWindow, Styles):
379
379
  clean_traj_sublayout.addWidget(self.extrapolate_post_checkbox)
380
380
  clean_traj_sublayout.addWidget(self.extrapolate_pre_checkbox)
381
381
 
382
- self.interpolate_na_features_checkbox = QCheckBox('Interpolate features of missed detections')
383
- self.interpolate_na_features_checkbox.setIcon(icon(MDI6.format_color_fill,color="k"))
382
+ # self.interpolate_na_features_checkbox = QCheckBox('Interpolate features of missed detections')
383
+ # self.interpolate_na_features_checkbox.setIcon(icon(MDI6.format_color_fill,color="k"))
384
384
 
385
- clean_traj_sublayout.addWidget(self.interpolate_na_features_checkbox)
385
+ # clean_traj_sublayout.addWidget(self.interpolate_na_features_checkbox)
386
386
  clean_traj_sublayout.addStretch()
387
387
 
388
388
  self.post_proc_options_to_disable = [self.post_proc_lbl, self.min_tracklength_slider, self.remove_not_in_first_checkbox,
389
389
  self.remove_not_in_last_checkbox, self.interpolate_gaps_checkbox, self.extrapolate_post_checkbox,
390
- self.extrapolate_pre_checkbox, self.interpolate_na_features_checkbox]
390
+ self.extrapolate_pre_checkbox] #, self.interpolate_na_features_checkbox
391
391
 
392
392
  layout.addLayout(clean_traj_sublayout)
393
393
 
@@ -898,7 +898,7 @@ class ConfigTracking(QMainWindow, Styles):
898
898
  "interpolate_position_gaps": self.interpolate_gaps_checkbox.isChecked(),
899
899
  "extrapolate_tracks_pre": self.extrapolate_pre_checkbox.isChecked(),
900
900
  "extrapolate_tracks_post": self.extrapolate_post_checkbox.isChecked(),
901
- 'interpolate_na': self.interpolate_na_features_checkbox.isChecked()
901
+ 'interpolate_na': False, #self.interpolate_na_features_checkbox.isChecked()
902
902
  }
903
903
  else:
904
904
 
@@ -1044,7 +1044,7 @@ class ConfigTracking(QMainWindow, Styles):
1044
1044
  self.uncheck_post_proc()
1045
1045
  self.ContentsPostProc.hide()
1046
1046
  for element in [self.remove_not_in_last_checkbox, self.remove_not_in_first_checkbox, self.interpolate_gaps_checkbox,
1047
- self.extrapolate_post_checkbox, self.extrapolate_pre_checkbox, self.interpolate_na_features_checkbox]:
1047
+ self.extrapolate_post_checkbox, self.extrapolate_pre_checkbox]: #self.interpolate_na_features_checkbox
1048
1048
  element.setChecked(False)
1049
1049
  self.min_tracklength_slider.setValue(0)
1050
1050
 
@@ -1063,8 +1063,8 @@ class ConfigTracking(QMainWindow, Styles):
1063
1063
  self.extrapolate_pre_checkbox.setChecked(post_processing_options["extrapolate_tracks_pre"])
1064
1064
  if "extrapolate_tracks_post" in post_processing_options:
1065
1065
  self.extrapolate_post_checkbox.setChecked(post_processing_options["extrapolate_tracks_post"])
1066
- if "interpolate_na" in post_processing_options:
1067
- self.interpolate_na_features_checkbox.setChecked(post_processing_options["interpolate_na"])
1066
+ # if "interpolate_na" in post_processing_options:
1067
+ # self.interpolate_na_features_checkbox.setChecked(post_processing_options["interpolate_na"])
1068
1068
 
1069
1069
  def locate_image(self):
1070
1070
 
@@ -212,6 +212,8 @@ class ClassifierWidget(QWidget, Styles):
212
212
  self.frame_slider.valueChanged.connect(self.set_frame)
213
213
  self.alpha_slider.valueChanged.connect(self.set_transparency)
214
214
 
215
+ self.setAttribute(Qt.WA_DeleteOnClose)
216
+
215
217
  def activate_prereq_cb(self):
216
218
  if self.prereq_event_check.isChecked():
217
219
  self.prereq_event_cb.setEnabled(True)
@@ -276,6 +278,12 @@ class ClassifierWidget(QWidget, Styles):
276
278
  self.propscanvas.canvas.draw_idle()
277
279
  self.propscanvas.canvas.setMinimumHeight(self.screen_height//5)
278
280
 
281
+ def closeEvent(self, event):
282
+ self.ax_props.cla()
283
+ self.fig_props.clf()
284
+ plt.close(self.fig_props)
285
+ super().closeEvent(event)
286
+
279
287
  def update_props_scatter(self, feature_changed=True):
280
288
 
281
289
  try:
@@ -429,7 +429,7 @@ class ConfigNewExperiment(QMainWindow, Styles):
429
429
  Write all user input parameters to a configuration file associated to an experiment.
430
430
  """
431
431
 
432
- config = ConfigParser()
432
+ config = ConfigParser(interpolation=None)
433
433
 
434
434
  # add a new section and some values
435
435
  config.add_section('MovieSettings')
@@ -49,7 +49,7 @@ class ConfigEditor(QWidget, Styles):
49
49
  file_name = self.config_path
50
50
  #self.file_edit.setText(file_name)
51
51
 
52
- config = configparser.ConfigParser()
52
+ config = configparser.ConfigParser(interpolation=None)
53
53
  config.read(file_name)
54
54
 
55
55
  # Create a layout for each section of the config file
@@ -93,12 +93,10 @@ class ConfigEditor(QWidget, Styles):
93
93
  # Save the configuration to the file
94
94
  file_name = self.config_path
95
95
 
96
- config = configparser.ConfigParser()
96
+ config = configparser.ConfigParser(interpolation=None)
97
97
 
98
98
  # Update the values in the config object
99
99
 
100
-
101
-
102
100
  for key, (section, edit_box) in self.sections.items():
103
101
  if not config.has_section(section):
104
102
  config.add_section(section)
@@ -117,7 +117,10 @@ class ConfigSignalPlot(QWidget, Styles):
117
117
  all_cms = list(colormaps)
118
118
  for cm in all_cms:
119
119
  if hasattr(matplotlib.cm, str(cm).lower()):
120
- self.cbs[-1].addColormap(cm.lower())
120
+ try:
121
+ self.cbs[-1].addColormap(cm.lower())
122
+ except:
123
+ pass
121
124
 
122
125
  self.cbs[0].setCurrentIndex(1)
123
126
  self.cbs[0].setCurrentIndex(0)
@@ -138,13 +141,14 @@ class ConfigSignalPlot(QWidget, Styles):
138
141
  self.abs_time_checkbox.stateChanged.connect(self.switch_ref_time_mode)
139
142
 
140
143
  select_layout = QHBoxLayout()
144
+ select_layout.setContentsMargins(20,3,20,3)
141
145
  select_layout.addWidget(QLabel('select cells\nwith query: '), 33)
142
146
  self.query_le = QLineEdit()
143
147
  select_layout.addWidget(self.query_le, 66)
144
148
  main_layout.addLayout(select_layout)
145
149
 
146
150
  time_calib_layout = QHBoxLayout()
147
- time_calib_layout.setContentsMargins(20,20,20,20)
151
+ time_calib_layout.setContentsMargins(20,3,20,3)
148
152
  time_calib_layout.addWidget(QLabel('time calibration\n(frame to min)'), 33)
149
153
  self.time_calibration_le = QLineEdit(str(self.FrameToMin).replace('.',','))
150
154
  self.time_calibration_le.setValidator(self.float_validator)
@@ -152,6 +156,14 @@ class ConfigSignalPlot(QWidget, Styles):
152
156
  #time_calib_layout.addWidget(QLabel(' min'))
153
157
  main_layout.addLayout(time_calib_layout)
154
158
 
159
+ pool_layout = QHBoxLayout()
160
+ pool_layout.setContentsMargins(20,3,20,3)
161
+ self.pool_option_cb = QComboBox()
162
+ self.pool_option_cb.addItems(['mean','median'])
163
+ pool_layout.addWidget(QLabel('pool\nprojection:'), 33)
164
+ pool_layout.addWidget(self.pool_option_cb, 66)
165
+ main_layout.addLayout(pool_layout)
166
+
155
167
  self.submit_btn = QPushButton('Submit')
156
168
  self.submit_btn.setStyleSheet(self.button_style_sheet)
157
169
  self.submit_btn.clicked.connect(self.process_signal)
@@ -271,9 +283,10 @@ class ConfigSignalPlot(QWidget, Styles):
271
283
  self.feature_selected = self.feature_cb.currentText()
272
284
  self.feature_choice_widget.close()
273
285
  self.compute_signal_functions()
274
- self.interpret_pos_location()
275
- self.plot_window = GenericSignalPlotWidget(parent_window=self, df=self.df, df_pos_info = self.df_pos_info, df_well_info = self.df_well_info, feature_selected=self.feature_selected, title='plot signals')
276
- self.plot_window.show()
286
+ if self.open_widget:
287
+ self.interpret_pos_location()
288
+ self.plot_window = GenericSignalPlotWidget(parent_window=self, df=self.df, df_pos_info = self.df_pos_info, df_well_info = self.df_well_info, feature_selected=self.feature_selected, title='plot signals')
289
+ self.plot_window.show()
277
290
 
278
291
  def process_signal(self):
279
292
 
@@ -335,7 +348,19 @@ class ConfigSignalPlot(QWidget, Styles):
335
348
 
336
349
  def compute_signal_functions(self):
337
350
 
338
- # REPLACE EVRYTHING WITH MEAN_SIGNAL FUNCTION
351
+ # Check to move at the beginning
352
+ self.open_widget = True
353
+ if len(self.time_columns)==0:
354
+ msgBox = QMessageBox()
355
+ msgBox.setIcon(QMessageBox.Warning)
356
+ msgBox.setText("No synchronizing time is available...")
357
+ msgBox.setWindowTitle("Warning")
358
+ msgBox.setStandardButtons(QMessageBox.Ok)
359
+ returnValue = msgBox.exec()
360
+ if returnValue == QMessageBox.Ok:
361
+ pass
362
+ self.open_widget = False
363
+ return None
339
364
 
340
365
  # Per position signal
341
366
  max_time = int(self.df.FRAME.max()) + 1
@@ -346,9 +371,9 @@ class ConfigSignalPlot(QWidget, Styles):
346
371
 
347
372
  for block,movie_group in self.df.groupby(['well','position']):
348
373
 
349
- well_signal_mean, well_std_mean, timeline_all, matrix_all = mean_signal(movie_group, self.feature_selected, class_col, time_col=time_col, class_value=None, return_matrix=True, forced_max_duration=max_time)
350
- well_signal_event, well_std_event, timeline_event, matrix_event = mean_signal(movie_group, self.feature_selected, class_col, time_col=time_col, class_value=[0], return_matrix=True, forced_max_duration=max_time)
351
- well_signal_no_event, well_std_no_event, timeline_no_event, matrix_no_event = mean_signal(movie_group, self.feature_selected, class_col, time_col=time_col, class_value=[1], return_matrix=True, forced_max_duration=max_time)
374
+ well_signal_mean, well_std_mean, timeline_all, matrix_all = mean_signal(movie_group, self.feature_selected, class_col, time_col=time_col, class_value=None, return_matrix=True, forced_max_duration=max_time, projection=self.pool_option_cb.currentText())
375
+ well_signal_event, well_std_event, timeline_event, matrix_event = mean_signal(movie_group, self.feature_selected, class_col, time_col=time_col, class_value=[0], return_matrix=True, forced_max_duration=max_time, projection=self.pool_option_cb.currentText())
376
+ well_signal_no_event, well_std_no_event, timeline_no_event, matrix_no_event = mean_signal(movie_group, self.feature_selected, class_col, time_col=time_col, class_value=[1], return_matrix=True, forced_max_duration=max_time, projection=self.pool_option_cb.currentText())
352
377
  self.mean_plots_timeline = timeline_all
353
378
 
354
379
  self.df_pos_info.loc[self.df_pos_info['pos_path'] == block[1], 'signal'] = [
@@ -361,9 +386,9 @@ class ConfigSignalPlot(QWidget, Styles):
361
386
  # Per well
362
387
  for well,well_group in self.df.groupby('well'):
363
388
 
364
- well_signal_mean, well_std_mean, timeline_all, matrix_all = mean_signal(well_group, self.feature_selected, class_col, time_col=time_col, class_value=None, return_matrix=True, forced_max_duration=max_time)
365
- well_signal_event, well_std_event, timeline_event, matrix_event = mean_signal(well_group, self.feature_selected, class_col, time_col=time_col, class_value=[0], return_matrix=True, forced_max_duration=max_time)
366
- well_signal_no_event, well_std_no_event, timeline_no_event, matrix_no_event = mean_signal(well_group, self.feature_selected, class_col, time_col=time_col, class_value=[1], return_matrix=True, forced_max_duration=max_time)
389
+ well_signal_mean, well_std_mean, timeline_all, matrix_all = mean_signal(well_group, self.feature_selected, class_col, time_col=time_col, class_value=None, return_matrix=True, forced_max_duration=max_time, projection=self.pool_option_cb.currentText())
390
+ well_signal_event, well_std_event, timeline_event, matrix_event = mean_signal(well_group, self.feature_selected, class_col, time_col=time_col, class_value=[0], return_matrix=True, forced_max_duration=max_time, projection=self.pool_option_cb.currentText())
391
+ well_signal_no_event, well_std_no_event, timeline_no_event, matrix_no_event = mean_signal(well_group, self.feature_selected, class_col, time_col=time_col, class_value=[1], return_matrix=True, forced_max_duration=max_time, projection=self.pool_option_cb.currentText())
367
392
 
368
393
  self.df_well_info.loc[self.df_well_info['well_path']==well,'signal'] = [{'mean_all': well_signal_mean, 'std_all': well_std_mean,'matrix_all': matrix_all,'mean_event': well_signal_event, 'std_event': well_std_event,
369
394
  'matrix_event': matrix_event,'mean_no_event': well_signal_no_event, 'std_no_event': well_std_no_event, 'matrix_no_event': matrix_no_event, 'timeline': self.mean_plots_timeline}]
@@ -418,23 +443,7 @@ class ConfigSignalPlot(QWidget, Styles):
418
443
  cid+=1
419
444
  except:
420
445
  pass
421
- return matrix
422
-
423
- def col_mean(self, matrix):
424
-
425
- mean_line = np.zeros(matrix.shape[1])
426
- mean_line[:] = np.nan
427
- std_line = np.copy(mean_line)
428
-
429
- for k in range(matrix.shape[1]):
430
- values = matrix[:,k]
431
- #values = values[values!=0]
432
- if len(values[values==values])>2:
433
- mean_line[k] = np.nanmean(values)
434
- std_line[k] = np.nanstd(values)
435
-
436
- return mean_line, std_line
437
-
446
+ return matrix
438
447
 
439
448
  def switch_ref_time_mode(self):
440
449
  if self.abs_time_checkbox.isChecked():
@@ -1362,6 +1362,7 @@ class NeighPanel(QFrame, Styles):
1362
1362
  self.pair_signal_models_list.addItems(signal_models)
1363
1363
 
1364
1364
  def open_signal_annotator_configuration_ui(self):
1365
+ self.mode = 'pairs'
1365
1366
  self.ConfigSignalAnnotator = ConfigSignalAnnotator(self)
1366
1367
  self.ConfigSignalAnnotator.show()
1367
1368
 
@@ -0,0 +1,108 @@
1
+ import os
2
+ import ssl
3
+ from tqdm import tqdm
4
+ from multiprocessing import Process
5
+ from glob import glob
6
+ import shutil
7
+ from urllib.request import urlopen
8
+ import zipfile
9
+ import tempfile
10
+ import time
11
+ from pathlib import Path
12
+ import json
13
+
14
+ class DownloadProcess(Process):
15
+
16
+ def __init__(self, queue=None, process_args=None, *args, **kwargs):
17
+
18
+ super().__init__(*args, **kwargs)
19
+
20
+ if process_args is not None:
21
+ for key, value in process_args.items():
22
+ setattr(self, key, value)
23
+
24
+ self.queue = queue
25
+ self.progress = True
26
+
27
+ file_path = Path(os.path.dirname(os.path.realpath(__file__)))
28
+ zenodo_json = os.sep.join([str(file_path.parents[2]),"celldetective", "links", "zenodo.json"])
29
+ print(f"{zenodo_json=}")
30
+
31
+ with open(zenodo_json,"r") as f:
32
+ zenodo_json = json.load(f)
33
+ all_files = list(zenodo_json['files']['entries'].keys())
34
+ all_files_short = [f.replace(".zip","") for f in all_files]
35
+ zenodo_url = zenodo_json['links']['files'].replace('api/','')
36
+ full_links = ["/".join([zenodo_url, f]) for f in all_files]
37
+ index = all_files_short.index(self.file)
38
+
39
+ self.zip_url = full_links[index]
40
+ self.path_to_zip_file = os.sep.join([self.output_dir, 'temp.zip'])
41
+
42
+ self.sum_done = 0
43
+ self.t0 = time.time()
44
+
45
+ def download_url_to_file(self, url, dst):
46
+
47
+ file_size = None
48
+ ssl._create_default_https_context = ssl._create_unverified_context
49
+ u = urlopen(url)
50
+ meta = u.info()
51
+ if hasattr(meta, 'getheaders'):
52
+ content_length = meta.getheaders("Content-Length")
53
+ else:
54
+ content_length = meta.get_all("Content-Length")
55
+ if content_length is not None and len(content_length) > 0:
56
+ file_size = int(content_length[0])
57
+ # We deliberately save it in a temp file and move it after
58
+ dst = os.path.expanduser(dst)
59
+ dst_dir = os.path.dirname(dst)
60
+ f = tempfile.NamedTemporaryFile(delete=False, dir=dst_dir)
61
+
62
+ try:
63
+ with tqdm(total=file_size, disable=not self.progress,
64
+ unit='B', unit_scale=True, unit_divisor=1024) as pbar:
65
+ while True:
66
+ buffer = u.read(8192) #8192
67
+ if len(buffer) == 0:
68
+ break
69
+ f.write(buffer)
70
+ pbar.update(len(buffer))
71
+ self.sum_done+=len(buffer) / file_size * 100
72
+ mean_exec_per_step = (time.time() - self.t0) / (self.sum_done*file_size / 100 + 1)
73
+ pred_time = (file_size - (self.sum_done*file_size / 100 + 1)) * mean_exec_per_step
74
+ self.queue.put([self.sum_done, pred_time])
75
+ f.close()
76
+ shutil.move(f.name, dst)
77
+ finally:
78
+ f.close()
79
+ if os.path.exists(f.name):
80
+ os.remove(f.name)
81
+
82
+ def run(self):
83
+
84
+ self.download_url_to_file(fr"{self.zip_url}",self.path_to_zip_file)
85
+ with zipfile.ZipFile(self.path_to_zip_file, 'r') as zip_ref:
86
+ zip_ref.extractall(self.output_dir)
87
+
88
+ file_to_rename = glob(os.sep.join([self.output_dir,self.file,"*[!.json][!.png][!.h5][!.csv][!.npy][!.tif][!.ini]"]))
89
+ if len(file_to_rename)>0 and not file_to_rename[0].endswith(os.sep) and not self.file.startswith('demo'):
90
+ os.rename(file_to_rename[0], os.sep.join([self.output_dir,self.file,self.file]))
91
+
92
+ os.remove(self.path_to_zip_file)
93
+ self.queue.put([100,0])
94
+ time.sleep(0.5)
95
+
96
+ # Send end signal
97
+ self.queue.put("finished")
98
+ self.queue.close()
99
+
100
+ def end_process(self):
101
+
102
+ self.terminate()
103
+ self.queue.put("finished")
104
+
105
+ def abort_process(self):
106
+
107
+ self.terminate()
108
+ self.queue.put("error")