dcscope 2.22.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.
Files changed (267) hide show
  1. dcscope/__init__.py +17 -0
  2. dcscope/__main__.py +44 -0
  3. dcscope/_version.py +21 -0
  4. dcscope/extensions.py +250 -0
  5. dcscope/gui/__init__.py +2 -0
  6. dcscope/gui/analysis/__init__.py +10 -0
  7. dcscope/gui/analysis/ana_basins.py +110 -0
  8. dcscope/gui/analysis/ana_basins.ui +143 -0
  9. dcscope/gui/analysis/ana_filter.py +341 -0
  10. dcscope/gui/analysis/ana_filter.ui +364 -0
  11. dcscope/gui/analysis/ana_log.py +122 -0
  12. dcscope/gui/analysis/ana_log.ui +100 -0
  13. dcscope/gui/analysis/ana_meta.py +207 -0
  14. dcscope/gui/analysis/ana_meta.ui +141 -0
  15. dcscope/gui/analysis/ana_plot.py +638 -0
  16. dcscope/gui/analysis/ana_plot.ui +1060 -0
  17. dcscope/gui/analysis/ana_slot.py +504 -0
  18. dcscope/gui/analysis/ana_slot.ui +684 -0
  19. dcscope/gui/analysis/ana_tables.py +227 -0
  20. dcscope/gui/analysis/ana_tables.ui +195 -0
  21. dcscope/gui/analysis/ana_view.py +69 -0
  22. dcscope/gui/analysis/ana_view.ui +269 -0
  23. dcscope/gui/analysis/dlg_slot_reorder.py +55 -0
  24. dcscope/gui/analysis/dlg_slot_reorder.ui +138 -0
  25. dcscope/gui/bulk/__init__.py +2 -0
  26. dcscope/gui/bulk/bulk_emodulus.py +200 -0
  27. dcscope/gui/bulk/bulk_emodulus.ui +245 -0
  28. dcscope/gui/compute/__init__.py +3 -0
  29. dcscope/gui/compute/comp_lme4.py +115 -0
  30. dcscope/gui/compute/comp_lme4.ui +194 -0
  31. dcscope/gui/compute/comp_lme4_dataset.py +51 -0
  32. dcscope/gui/compute/comp_lme4_dataset.ui +92 -0
  33. dcscope/gui/compute/comp_lme4_results.py +120 -0
  34. dcscope/gui/compute/comp_lme4_results.ui +268 -0
  35. dcscope/gui/compute/comp_stats.py +223 -0
  36. dcscope/gui/compute/comp_stats.ui +187 -0
  37. dcscope/gui/dcor/__init__.py +304 -0
  38. dcscope/gui/dcor/dcor.ui +118 -0
  39. dcscope/gui/export/__init__.py +3 -0
  40. dcscope/gui/export/e2data.py +394 -0
  41. dcscope/gui/export/e2data.ui +367 -0
  42. dcscope/gui/export/e2filter.py +76 -0
  43. dcscope/gui/export/e2filter.ui +111 -0
  44. dcscope/gui/export/e2plot.py +94 -0
  45. dcscope/gui/export/e2plot.ui +175 -0
  46. dcscope/gui/main.py +1089 -0
  47. dcscope/gui/main.ui +579 -0
  48. dcscope/gui/matrix/__init__.py +4 -0
  49. dcscope/gui/matrix/block_matrix.py +141 -0
  50. dcscope/gui/matrix/block_matrix.ui +207 -0
  51. dcscope/gui/matrix/data_matrix.py +574 -0
  52. dcscope/gui/matrix/dm_dataset.py +116 -0
  53. dcscope/gui/matrix/dm_dataset.ui +348 -0
  54. dcscope/gui/matrix/dm_element.py +111 -0
  55. dcscope/gui/matrix/dm_element.ui +169 -0
  56. dcscope/gui/matrix/dm_filter.py +115 -0
  57. dcscope/gui/matrix/dm_filter.ui +287 -0
  58. dcscope/gui/matrix/plot_matrix.py +316 -0
  59. dcscope/gui/matrix/pm_element.py +39 -0
  60. dcscope/gui/matrix/pm_plot.py +86 -0
  61. dcscope/gui/matrix/pm_plot.ui +249 -0
  62. dcscope/gui/pipeline_plot.py +797 -0
  63. dcscope/gui/pipeline_plot.ui +66 -0
  64. dcscope/gui/preferences.py +380 -0
  65. dcscope/gui/preferences.ui +554 -0
  66. dcscope/gui/quick_view/__init__.py +1 -0
  67. dcscope/gui/quick_view/qv_main.py +1072 -0
  68. dcscope/gui/quick_view/qv_main.ui +1297 -0
  69. dcscope/gui/quick_view/qv_scatter.py +284 -0
  70. dcscope/gui/quick_view/qv_style.css +10 -0
  71. dcscope/gui/update.py +90 -0
  72. dcscope/gui/widgets/__init__.py +15 -0
  73. dcscope/gui/widgets/bg_thread.py +29 -0
  74. dcscope/gui/widgets/bulk_list.py +79 -0
  75. dcscope/gui/widgets/bulk_list.ui +95 -0
  76. dcscope/gui/widgets/double_spin_box_nan.py +75 -0
  77. dcscope/gui/widgets/feature_combobox.py +140 -0
  78. dcscope/gui/widgets/get_path.py +42 -0
  79. dcscope/gui/widgets/key_value_table_widget.css +12 -0
  80. dcscope/gui/widgets/key_value_table_widget.py +75 -0
  81. dcscope/gui/widgets/mdi_subwindow_wo_close.py +12 -0
  82. dcscope/gui/widgets/qrangeslider.py +262 -0
  83. dcscope/gui/widgets/rangecontrol.py +308 -0
  84. dcscope/gui/widgets/rangecontrol.ui +136 -0
  85. dcscope/gui/widgets/simple_image_view.py +55 -0
  86. dcscope/gui/widgets/simple_plot_widget.py +113 -0
  87. dcscope/gui/widgets/so_colorbaritem.py +29 -0
  88. dcscope/gui/widgets/wait_cursor.py +33 -0
  89. dcscope/idiom.py +26 -0
  90. dcscope/img/__init__.py +2 -0
  91. dcscope/img/icon-theme/breeze/COPYING-ICONS +209 -0
  92. dcscope/img/icon-theme/breeze/COPYING.LIB +510 -0
  93. dcscope/img/icon-theme/breeze/README +5 -0
  94. dcscope/img/icon-theme/breeze/actions/16/application-exit.svg +17 -0
  95. dcscope/img/icon-theme/breeze/actions/16/code-context.svg +13 -0
  96. dcscope/img/icon-theme/breeze/actions/16/dialog-cancel.svg +13 -0
  97. dcscope/img/icon-theme/breeze/actions/16/dialog-close.svg +17 -0
  98. dcscope/img/icon-theme/breeze/actions/16/dialog-messages.svg +13 -0
  99. dcscope/img/icon-theme/breeze/actions/16/dialog-ok-apply.svg +13 -0
  100. dcscope/img/icon-theme/breeze/actions/16/dialog-ok.svg +13 -0
  101. dcscope/img/icon-theme/breeze/actions/16/document-open-folder.svg +13 -0
  102. dcscope/img/icon-theme/breeze/actions/16/document-open.svg +13 -0
  103. dcscope/img/icon-theme/breeze/actions/16/document-save.svg +13 -0
  104. dcscope/img/icon-theme/breeze/actions/16/documentinfo.svg +12 -0
  105. dcscope/img/icon-theme/breeze/actions/16/draw-watercolor.svg +13 -0
  106. dcscope/img/icon-theme/breeze/actions/16/edit-clear-all.svg +13 -0
  107. dcscope/img/icon-theme/breeze/actions/16/edit-clear.svg +13 -0
  108. dcscope/img/icon-theme/breeze/actions/16/edit-paste.svg +13 -0
  109. dcscope/img/icon-theme/breeze/actions/16/globe.svg +16 -0
  110. dcscope/img/icon-theme/breeze/actions/16/gtk-preferences.svg +13 -0
  111. dcscope/img/icon-theme/breeze/actions/16/list-add.svg +13 -0
  112. dcscope/img/icon-theme/breeze/actions/16/messagebox_warning.svg +20 -0
  113. dcscope/img/icon-theme/breeze/actions/16/object-columns.svg +13 -0
  114. dcscope/img/icon-theme/breeze/actions/16/object-order-lower.svg +13 -0
  115. dcscope/img/icon-theme/breeze/actions/16/object-rows.svg +13 -0
  116. dcscope/img/icon-theme/breeze/actions/16/office-chart-line-stacked.svg +13 -0
  117. dcscope/img/icon-theme/breeze/actions/16/office-chart-ring.svg +13 -0
  118. dcscope/img/icon-theme/breeze/actions/16/office-chart-scatter.svg +13 -0
  119. dcscope/img/icon-theme/breeze/actions/16/path-mode-polyline.svg +13 -0
  120. dcscope/img/icon-theme/breeze/actions/16/preferences-activities.svg +13 -0
  121. dcscope/img/icon-theme/breeze/actions/16/remove.svg +10 -0
  122. dcscope/img/icon-theme/breeze/actions/16/search.svg +13 -0
  123. dcscope/img/icon-theme/breeze/actions/16/show-grid.svg +13 -0
  124. dcscope/img/icon-theme/breeze/actions/16/special_paste.svg +13 -0
  125. dcscope/img/icon-theme/breeze/actions/16/tools-wizard.svg +13 -0
  126. dcscope/img/icon-theme/breeze/actions/16/view-calendar-list.svg +13 -0
  127. dcscope/img/icon-theme/breeze/actions/16/view-filter.svg +13 -0
  128. dcscope/img/icon-theme/breeze/actions/16/view-list-tree.svg +13 -0
  129. dcscope/img/icon-theme/breeze/actions/16/view-statistics.svg +13 -0
  130. dcscope/img/icon-theme/breeze/actions/16/visibility.svg +21 -0
  131. dcscope/img/icon-theme/breeze/actions/22/application-exit.svg +13 -0
  132. dcscope/img/icon-theme/breeze/actions/22/code-context.svg +14 -0
  133. dcscope/img/icon-theme/breeze/actions/22/dialog-cancel.svg +14 -0
  134. dcscope/img/icon-theme/breeze/actions/22/dialog-close.svg +10 -0
  135. dcscope/img/icon-theme/breeze/actions/22/dialog-messages.svg +14 -0
  136. dcscope/img/icon-theme/breeze/actions/22/dialog-ok-apply.svg +14 -0
  137. dcscope/img/icon-theme/breeze/actions/22/dialog-ok.svg +14 -0
  138. dcscope/img/icon-theme/breeze/actions/22/document-open-folder.svg +14 -0
  139. dcscope/img/icon-theme/breeze/actions/22/document-open.svg +14 -0
  140. dcscope/img/icon-theme/breeze/actions/22/document-save.svg +14 -0
  141. dcscope/img/icon-theme/breeze/actions/22/documentinfo.svg +14 -0
  142. dcscope/img/icon-theme/breeze/actions/22/draw-watercolor.svg +14 -0
  143. dcscope/img/icon-theme/breeze/actions/22/edit-clear-all.svg +14 -0
  144. dcscope/img/icon-theme/breeze/actions/22/edit-clear.svg +14 -0
  145. dcscope/img/icon-theme/breeze/actions/22/edit-paste.svg +14 -0
  146. dcscope/img/icon-theme/breeze/actions/22/globe.svg +12 -0
  147. dcscope/img/icon-theme/breeze/actions/22/gtk-preferences.svg +13 -0
  148. dcscope/img/icon-theme/breeze/actions/22/list-add.svg +14 -0
  149. dcscope/img/icon-theme/breeze/actions/22/messagebox_warning.svg +17 -0
  150. dcscope/img/icon-theme/breeze/actions/22/object-columns.svg +14 -0
  151. dcscope/img/icon-theme/breeze/actions/22/object-order-lower.svg +17 -0
  152. dcscope/img/icon-theme/breeze/actions/22/object-rows.svg +17 -0
  153. dcscope/img/icon-theme/breeze/actions/22/office-chart-line-stacked.svg +17 -0
  154. dcscope/img/icon-theme/breeze/actions/22/office-chart-ring.svg +17 -0
  155. dcscope/img/icon-theme/breeze/actions/22/office-chart-scatter.svg +17 -0
  156. dcscope/img/icon-theme/breeze/actions/22/path-mode-polyline.svg +17 -0
  157. dcscope/img/icon-theme/breeze/actions/22/preferences-activities.svg +14 -0
  158. dcscope/img/icon-theme/breeze/actions/22/remove.svg +10 -0
  159. dcscope/img/icon-theme/breeze/actions/22/special_paste.svg +14 -0
  160. dcscope/img/icon-theme/breeze/actions/22/tools-wizard.svg +14 -0
  161. dcscope/img/icon-theme/breeze/actions/22/view-calendar-list.svg +14 -0
  162. dcscope/img/icon-theme/breeze/actions/22/view-filter.svg +14 -0
  163. dcscope/img/icon-theme/breeze/actions/22/view-list-tree.svg +14 -0
  164. dcscope/img/icon-theme/breeze/actions/22/view-statistics.svg +14 -0
  165. dcscope/img/icon-theme/breeze/actions/22/visibility.svg +14 -0
  166. dcscope/img/icon-theme/breeze/actions/24/application-exit.svg +12 -0
  167. dcscope/img/icon-theme/breeze/actions/24/code-context.svg +12 -0
  168. dcscope/img/icon-theme/breeze/actions/24/dialog-cancel.svg +12 -0
  169. dcscope/img/icon-theme/breeze/actions/24/dialog-close.svg +10 -0
  170. dcscope/img/icon-theme/breeze/actions/24/dialog-messages.svg +12 -0
  171. dcscope/img/icon-theme/breeze/actions/24/dialog-ok-apply.svg +12 -0
  172. dcscope/img/icon-theme/breeze/actions/24/dialog-ok.svg +14 -0
  173. dcscope/img/icon-theme/breeze/actions/24/document-open-folder.svg +12 -0
  174. dcscope/img/icon-theme/breeze/actions/24/document-open.svg +12 -0
  175. dcscope/img/icon-theme/breeze/actions/24/document-save.svg +12 -0
  176. dcscope/img/icon-theme/breeze/actions/24/documentinfo.svg +14 -0
  177. dcscope/img/icon-theme/breeze/actions/24/draw-watercolor.svg +12 -0
  178. dcscope/img/icon-theme/breeze/actions/24/edit-clear-all.svg +14 -0
  179. dcscope/img/icon-theme/breeze/actions/24/edit-clear.svg +12 -0
  180. dcscope/img/icon-theme/breeze/actions/24/edit-paste.svg +12 -0
  181. dcscope/img/icon-theme/breeze/actions/24/globe.svg +14 -0
  182. dcscope/img/icon-theme/breeze/actions/24/gtk-preferences.svg +13 -0
  183. dcscope/img/icon-theme/breeze/actions/24/list-add.svg +12 -0
  184. dcscope/img/icon-theme/breeze/actions/24/messagebox_warning.svg +13 -0
  185. dcscope/img/icon-theme/breeze/actions/24/object-columns.svg +12 -0
  186. dcscope/img/icon-theme/breeze/actions/24/object-order-lower.svg +15 -0
  187. dcscope/img/icon-theme/breeze/actions/24/object-rows.svg +15 -0
  188. dcscope/img/icon-theme/breeze/actions/24/office-chart-line-stacked.svg +15 -0
  189. dcscope/img/icon-theme/breeze/actions/24/office-chart-ring.svg +15 -0
  190. dcscope/img/icon-theme/breeze/actions/24/office-chart-scatter.svg +15 -0
  191. dcscope/img/icon-theme/breeze/actions/24/path-mode-polyline.svg +15 -0
  192. dcscope/img/icon-theme/breeze/actions/24/preferences-activities.svg +13 -0
  193. dcscope/img/icon-theme/breeze/actions/24/remove.svg +10 -0
  194. dcscope/img/icon-theme/breeze/actions/24/special_paste.svg +12 -0
  195. dcscope/img/icon-theme/breeze/actions/24/tools-wizard.svg +12 -0
  196. dcscope/img/icon-theme/breeze/actions/24/view-calendar-list.svg +12 -0
  197. dcscope/img/icon-theme/breeze/actions/24/view-filter.svg +12 -0
  198. dcscope/img/icon-theme/breeze/actions/24/view-list-tree.svg +12 -0
  199. dcscope/img/icon-theme/breeze/actions/24/view-statistics.svg +12 -0
  200. dcscope/img/icon-theme/breeze/actions/24/visibility.svg +14 -0
  201. dcscope/img/icon-theme/breeze/actions/32/application-exit.svg +8 -0
  202. dcscope/img/icon-theme/breeze/actions/32/dialog-cancel.svg +13 -0
  203. dcscope/img/icon-theme/breeze/actions/32/dialog-messages.svg +13 -0
  204. dcscope/img/icon-theme/breeze/actions/32/dialog-ok-apply.svg +1 -0
  205. dcscope/img/icon-theme/breeze/actions/32/dialog-ok.svg +1 -0
  206. dcscope/img/icon-theme/breeze/actions/32/document-open-folder.svg +13 -0
  207. dcscope/img/icon-theme/breeze/actions/32/document-open.svg +13 -0
  208. dcscope/img/icon-theme/breeze/actions/32/document-save.svg +18 -0
  209. dcscope/img/icon-theme/breeze/actions/32/gtk-preferences.svg +17 -0
  210. dcscope/img/icon-theme/breeze/actions/32/object-order-lower.svg +18 -0
  211. dcscope/img/icon-theme/breeze/actions/32/view-filter.svg +18 -0
  212. dcscope/img/icon-theme/breeze/actions/32/view-list-tree.svg +18 -0
  213. dcscope/img/icon-theme/breeze/places/16/folder-cloud.svg +13 -0
  214. dcscope/img/icon-theme/breeze/places/16/folder.svg +13 -0
  215. dcscope/img/icon-theme/breeze/places/22/folder-cloud.svg +13 -0
  216. dcscope/img/icon-theme/breeze/places/22/folder.svg +13 -0
  217. dcscope/img/icon-theme/breeze/places/24/folder-cloud.svg +12 -0
  218. dcscope/img/icon-theme/breeze/places/24/folder.svg +12 -0
  219. dcscope/img/icon-theme/breeze/places/32/folder-cloud.svg +35 -0
  220. dcscope/img/icon-theme/breeze/places/32/folder.svg +30 -0
  221. dcscope/img/icon-theme/breeze/places/64/folder-cloud.svg +35 -0
  222. dcscope/img/icon-theme/breeze/places/64/folder.svg +30 -0
  223. dcscope/img/icon-theme/breeze/status/16/dialog-error.svg +9 -0
  224. dcscope/img/icon-theme/breeze/status/16/dialog-information.svg +9 -0
  225. dcscope/img/icon-theme/breeze/status/16/dialog-question.svg +7 -0
  226. dcscope/img/icon-theme/breeze/status/16/dialog-warning.svg +9 -0
  227. dcscope/img/icon-theme/breeze/status/22/dialog-error.svg +9 -0
  228. dcscope/img/icon-theme/breeze/status/22/dialog-information.svg +9 -0
  229. dcscope/img/icon-theme/breeze/status/22/dialog-question.svg +7 -0
  230. dcscope/img/icon-theme/breeze/status/22/dialog-warning.svg +9 -0
  231. dcscope/img/icon-theme/breeze/status/24/dialog-error.svg +13 -0
  232. dcscope/img/icon-theme/breeze/status/24/dialog-information.svg +13 -0
  233. dcscope/img/icon-theme/breeze/status/24/dialog-question.svg +9 -0
  234. dcscope/img/icon-theme/breeze/status/24/dialog-warning.svg +1 -0
  235. dcscope/img/icon-theme/breeze/status/64/dialog-error.svg +25 -0
  236. dcscope/img/icon-theme/breeze/status/64/dialog-information.svg +25 -0
  237. dcscope/img/icon-theme/breeze/status/64/dialog-question.svg +25 -0
  238. dcscope/img/icon-theme/breeze/status/64/dialog-warning.svg +25 -0
  239. dcscope/img/icon-theme/collect_icons.py +124 -0
  240. dcscope/img/icon-theme/dcscope/dcor.png +0 -0
  241. dcscope/img/icon-theme/dcscope/edit-copy-anew.svg +13 -0
  242. dcscope/img/icon-theme/dcscope/emodulus.svg +69 -0
  243. dcscope/img/icon-theme/dcscope/filter_ray.svg +54 -0
  244. dcscope/img/icon-theme/dcscope/region_channel.svg +86 -0
  245. dcscope/img/icon-theme/dcscope/region_reservoir.svg +89 -0
  246. dcscope/img/icon-theme/dcscope/rlang.svg +108 -0
  247. dcscope/img/icon-theme/dcscope/statistical_significance.svg +106 -0
  248. dcscope/img/icon-theme/index.theme +81 -0
  249. dcscope/img/icon.png +0 -0
  250. dcscope/img/icon.svg +73 -0
  251. dcscope/img/splash.png +0 -0
  252. dcscope/meta_tool.py +143 -0
  253. dcscope/pipeline/__init__.py +5 -0
  254. dcscope/pipeline/core.py +632 -0
  255. dcscope/pipeline/dataslot.py +270 -0
  256. dcscope/pipeline/filter.py +161 -0
  257. dcscope/pipeline/filter_ray.py +170 -0
  258. dcscope/pipeline/plot.py +187 -0
  259. dcscope/plot_cache.py +79 -0
  260. dcscope/session.py +379 -0
  261. dcscope/util.py +34 -0
  262. dcscope-2.22.1.dist-info/METADATA +95 -0
  263. dcscope-2.22.1.dist-info/RECORD +267 -0
  264. dcscope-2.22.1.dist-info/WHEEL +5 -0
  265. dcscope-2.22.1.dist-info/entry_points.txt +2 -0
  266. dcscope-2.22.1.dist-info/licenses/LICENSE +621 -0
  267. dcscope-2.22.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,227 @@
1
+ import importlib.resources
2
+ import io
3
+
4
+ import numpy as np
5
+ import pyqtgraph as pg
6
+ from PyQt6 import uic, QtCore, QtGui, QtWidgets
7
+
8
+ #: Fallback graph colors
9
+ FALLBACK_COLORS = {
10
+ 'brightness': '#d8d000',
11
+ 'cpu_cs': '#b41010',
12
+ 'cpu_sys': '#8e0505',
13
+ 'disk': '#949494',
14
+ 'flow_rate_sample': '#00049C',
15
+ 'flow_rate_sheath': '#00049C',
16
+ 'focus': '#a03000',
17
+ 'imaging_rate': '#6b02e8',
18
+ 'pressure_sample': '#7c7c7c',
19
+ 'pressure_sheath': '#6c6c6c',
20
+ 'ram_cam': '#db8400',
21
+ 'ram_wrt': '#bf770a',
22
+ 'recording_rate': '#4858e8',
23
+ 'rotation': '#6ecf0d',
24
+ 'shift': '#0e8f69',
25
+ 'temperature_camera': '#8005b8',
26
+ 'temperature_chip': '#b80589',
27
+ 'time': '#000000'
28
+ }
29
+
30
+
31
+ def get_foreground_for_background(color):
32
+ """Given background color, yield black or white"""
33
+ color = QtGui.QColor(color)
34
+ color_mean = np.mean([color.red(), color.blue(), color.green()])
35
+ if color_mean < 255 / 2:
36
+ return "white"
37
+ else:
38
+ return "black"
39
+
40
+
41
+ class TablesPanel(QtWidgets.QWidget):
42
+ """Tables panel widget
43
+
44
+ Visualize tables stored in the .rtdc file
45
+ """
46
+
47
+ def __init__(self, *args, **kwargs):
48
+ super(TablesPanel, self).__init__(*args, **kwargs)
49
+ ref = importlib.resources.files(
50
+ "dcscope.gui.analysis") / "ana_tables.ui"
51
+ with importlib.resources.as_file(ref) as path_ui:
52
+ uic.loadUi(path_ui, self)
53
+ # current DCscope pipeline
54
+ self._pipeline = None
55
+ self._selected_table = None
56
+ self._selected_graphs = []
57
+ self.legend = pg.LegendItem((80, 60),
58
+ offset=(40, 20))
59
+ self.legend.setParentItem(self.graphicsView_lines.graphicsItem())
60
+ self.graphicsView_lines.showGrid(True, True)
61
+ self.tabWidget.setCurrentIndex(0)
62
+
63
+ self.listWidget_dataset.currentRowChanged.connect(
64
+ self.on_select_dataset)
65
+ self.listWidget_table_name.currentRowChanged.connect(
66
+ self.on_select_table)
67
+ self.listWidget_table_graphs.itemSelectionChanged.connect(
68
+ self.on_select_graphs)
69
+ self.update_content()
70
+
71
+ @property
72
+ def pipeline(self):
73
+ return self._pipeline
74
+
75
+ @QtCore.pyqtSlot(int)
76
+ def on_select_dataset(self, ds_idx):
77
+ """Show the tables of the dataset in the right-hand list widget"""
78
+ self.listWidget_table_name.clear()
79
+ self.listWidget_table_graphs.clear()
80
+ if ds_idx >= 0:
81
+ ds = self._pipeline.slots[ds_idx].get_dataset()
82
+ table_names = list(ds.tables.keys())
83
+ self.listWidget_table_name.blockSignals(True)
84
+ for table in table_names:
85
+ self.listWidget_table_name.addItem(table)
86
+ self.listWidget_table_name.blockSignals(False)
87
+
88
+ # Apply previously selected tables
89
+ if self._selected_table in table_names:
90
+ table_idx = table_names.index(self._selected_table)
91
+ self.listWidget_table_name.setCurrentRow(table_idx)
92
+ elif len(table_names):
93
+ self.listWidget_table_name.setCurrentRow(0)
94
+
95
+ @QtCore.pyqtSlot(int)
96
+ def on_select_table(self, table_index):
97
+ """Show the tables of the dataset in the right-hand list widget"""
98
+ ds_idx = self.listWidget_dataset.currentRow()
99
+ if ds_idx >= 0 and table_index >= 0:
100
+ ds = self._pipeline.slots[ds_idx].get_dataset()
101
+ self._selected_table = list(ds.tables.keys())[table_index]
102
+ table = ds.tables[self._selected_table]
103
+ names = table[:].dtype.names
104
+
105
+ if names is not None:
106
+ # We have a rec-array, a list of graphs in the table
107
+ self.listWidget_table_graphs.setEnabled(True)
108
+ self.stackedWidget_plot.setCurrentWidget(self.page_graph)
109
+ # Update list of graphs names
110
+ self.listWidget_table_graphs.blockSignals(True)
111
+ self.listWidget_table_graphs.clear()
112
+ for ii, graph in enumerate(names):
113
+ self.listWidget_table_graphs.addItem(graph)
114
+ color = table.meta.get(f"COLOR_{graph}",
115
+ FALLBACK_COLORS.get(graph,
116
+ "black")
117
+ )
118
+ self.listWidget_table_graphs.item(ii).setBackground(
119
+ QtGui.QColor(color))
120
+ self.listWidget_table_graphs.item(ii).setForeground(
121
+ QtGui.QColor(get_foreground_for_background(color)))
122
+
123
+ # Apply previously selected graphs
124
+ for graph in names:
125
+ if graph in list(self._selected_graphs):
126
+ graph_index = names.index(graph)
127
+ item = self.listWidget_table_graphs.item(graph_index)
128
+ if item:
129
+ item.setSelected(True)
130
+ self.listWidget_table_graphs.blockSignals(False)
131
+ self.on_select_graphs()
132
+ else:
133
+ self.listWidget_table_graphs.setEnabled(False)
134
+ self.listWidget_table_graphs.clear()
135
+ self.stackedWidget_plot.setCurrentWidget(self.page_image)
136
+ self.graphicsView_image.setImage(table[:])
137
+ else:
138
+ self.listWidget_table_graphs.setEnabled(False)
139
+ self.listWidget_table_name.clear()
140
+ self.listWidget_table_graphs.clear()
141
+
142
+ @QtCore.pyqtSlot()
143
+ def on_select_graphs(self):
144
+ """Show the graphs of one table of a dataset"""
145
+ ds_idx = self.listWidget_dataset.currentRow()
146
+ table_index = self.listWidget_table_name.currentRow()
147
+ if ds_idx >= 0 and table_index >= 0:
148
+ items = self.listWidget_table_graphs.selectedIndexes()
149
+ new_selection = [it.data() for it in items]
150
+ if new_selection:
151
+ self._selected_graphs = new_selection
152
+ ds = self._pipeline.slots[ds_idx].get_dataset()
153
+ table = ds.tables[list(ds.tables.keys())[table_index]]
154
+ table_data = table[:]
155
+ names = table_data.dtype.names
156
+ if table.has_graphs():
157
+ # assemble the graph list
158
+ graph_list = []
159
+ if "time" in names:
160
+ x_vals = {"name": "time",
161
+ "data": table_data["time"].flatten()}
162
+ else:
163
+ x_vals = {"name": "index",
164
+ "data": np.arange(len(table_data))}
165
+
166
+ for graph in new_selection:
167
+ graph_list.append({
168
+ "name": graph,
169
+ "data": table_data[graph].flatten(),
170
+ "color": table.meta.get(f"COLOR_{graph}",
171
+ FALLBACK_COLORS.get(graph,
172
+ "black")
173
+ )
174
+ })
175
+ if new_selection:
176
+ # show the graph
177
+ self.show_graph(x_vals, graph_list)
178
+ self.show_raw_data(graph_list)
179
+ self.graphicsView_lines.autoRange()
180
+ else:
181
+ self.graphicsView_lines.clear()
182
+ else:
183
+ self.listWidget_table_graphs.clear()
184
+
185
+ def set_pipeline(self, pipeline):
186
+ self._pipeline = pipeline
187
+
188
+ def show_graph(self, x_vals, graph_list):
189
+ self.graphicsView_lines.clear()
190
+ self.legend.clear()
191
+ for item in graph_list:
192
+ pl = self.graphicsView_lines.plot(
193
+ pen={"color": item["color"],
194
+ "width": 2},
195
+ x=x_vals["data"],
196
+ y=item["data"],
197
+ name=item["name"],
198
+ )
199
+
200
+ self.legend.addItem(pl, item["name"])
201
+ self.graphicsView_lines.plotItem.setLabels(bottom=x_vals["name"])
202
+
203
+ def show_raw_data(self, graph_list):
204
+ text = "\t".join(it["name"] for it in graph_list)
205
+ # save the array into a temporary string
206
+ s = io.StringIO()
207
+ data = np.array([it["data"] for it in graph_list]).transpose()
208
+ np.savetxt(s, data, delimiter="\t", fmt="%.5g", header=text)
209
+ self.plainTextEdit_raw.setPlainText(s.getvalue())
210
+
211
+ def update_content(self, slot_index=None, **kwargs):
212
+ if self._pipeline and self._pipeline.slots:
213
+ self.setEnabled(True)
214
+ self.setUpdatesEnabled(False)
215
+ self.listWidget_dataset.clear()
216
+ self.listWidget_table_name.clear()
217
+ for slot in self._pipeline.slots:
218
+ self.listWidget_dataset.addItem(slot.name)
219
+ self.setUpdatesEnabled(True)
220
+ if slot_index is None or slot_index < 0:
221
+ slot_index = max(0, self.listWidget_dataset.currentRow())
222
+ slot_index = min(slot_index, self._pipeline.num_slots - 1)
223
+ self.listWidget_dataset.setCurrentRow(slot_index)
224
+ else:
225
+ self.setEnabled(False)
226
+ self.listWidget_dataset.clear()
227
+ self.listWidget_table_name.clear()
@@ -0,0 +1,195 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ui version="4.0">
3
+ <class>Form</class>
4
+ <widget class="QWidget" name="Form">
5
+ <property name="geometry">
6
+ <rect>
7
+ <x>0</x>
8
+ <y>0</y>
9
+ <width>701</width>
10
+ <height>538</height>
11
+ </rect>
12
+ </property>
13
+ <property name="windowTitle">
14
+ <string>Form</string>
15
+ </property>
16
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
17
+ <item>
18
+ <layout class="QHBoxLayout" name="horizontalLayout">
19
+ <item>
20
+ <layout class="QVBoxLayout" name="verticalLayout_2">
21
+ <item>
22
+ <widget class="QLabel" name="label">
23
+ <property name="text">
24
+ <string>Dataset</string>
25
+ </property>
26
+ </widget>
27
+ </item>
28
+ <item>
29
+ <widget class="QListWidget" name="listWidget_dataset">
30
+ <property name="minimumSize">
31
+ <size>
32
+ <width>200</width>
33
+ <height>0</height>
34
+ </size>
35
+ </property>
36
+ <property name="showDropIndicator" stdset="0">
37
+ <bool>false</bool>
38
+ </property>
39
+ <property name="alternatingRowColors">
40
+ <bool>true</bool>
41
+ </property>
42
+ <property name="selectionBehavior">
43
+ <enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
44
+ </property>
45
+ </widget>
46
+ </item>
47
+ </layout>
48
+ </item>
49
+ <item>
50
+ <layout class="QVBoxLayout" name="verticalLayout_3">
51
+ <item>
52
+ <widget class="QLabel" name="label_2">
53
+ <property name="text">
54
+ <string>Table Name</string>
55
+ </property>
56
+ </widget>
57
+ </item>
58
+ <item>
59
+ <widget class="QListWidget" name="listWidget_table_name">
60
+ <property name="showDropIndicator" stdset="0">
61
+ <bool>false</bool>
62
+ </property>
63
+ <property name="alternatingRowColors">
64
+ <bool>true</bool>
65
+ </property>
66
+ <property name="selectionBehavior">
67
+ <enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
68
+ </property>
69
+ </widget>
70
+ </item>
71
+ </layout>
72
+ </item>
73
+ <item>
74
+ <layout class="QVBoxLayout" name="verticalLayout_4">
75
+ <item>
76
+ <widget class="QLabel" name="label_3">
77
+ <property name="text">
78
+ <string>Table Graphs</string>
79
+ </property>
80
+ </widget>
81
+ </item>
82
+ <item>
83
+ <widget class="QListWidget" name="listWidget_table_graphs">
84
+ <property name="showDropIndicator" stdset="0">
85
+ <bool>false</bool>
86
+ </property>
87
+ <property name="alternatingRowColors">
88
+ <bool>true</bool>
89
+ </property>
90
+ <property name="selectionMode">
91
+ <enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
92
+ </property>
93
+ <property name="selectionBehavior">
94
+ <enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
95
+ </property>
96
+ </widget>
97
+ </item>
98
+ </layout>
99
+ </item>
100
+ </layout>
101
+ </item>
102
+ <item>
103
+ <widget class="Line" name="line">
104
+ <property name="orientation">
105
+ <enum>Qt::Orientation::Horizontal</enum>
106
+ </property>
107
+ </widget>
108
+ </item>
109
+ <item>
110
+ <widget class="QTabWidget" name="tabWidget">
111
+ <property name="currentIndex">
112
+ <number>0</number>
113
+ </property>
114
+ <widget class="QWidget" name="tab_plot">
115
+ <attribute name="title">
116
+ <string>Graph</string>
117
+ </attribute>
118
+ <layout class="QVBoxLayout" name="verticalLayout_6">
119
+ <item>
120
+ <widget class="QStackedWidget" name="stackedWidget_plot">
121
+ <widget class="QWidget" name="page_graph">
122
+ <layout class="QVBoxLayout" name="verticalLayout_7">
123
+ <property name="leftMargin">
124
+ <number>0</number>
125
+ </property>
126
+ <property name="topMargin">
127
+ <number>0</number>
128
+ </property>
129
+ <property name="rightMargin">
130
+ <number>0</number>
131
+ </property>
132
+ <property name="bottomMargin">
133
+ <number>0</number>
134
+ </property>
135
+ <item>
136
+ <widget class="SimplePlotWidget" name="graphicsView_lines"/>
137
+ </item>
138
+ </layout>
139
+ </widget>
140
+ <widget class="QWidget" name="page_image">
141
+ <layout class="QVBoxLayout" name="verticalLayout_8">
142
+ <property name="leftMargin">
143
+ <number>0</number>
144
+ </property>
145
+ <property name="topMargin">
146
+ <number>0</number>
147
+ </property>
148
+ <property name="rightMargin">
149
+ <number>0</number>
150
+ </property>
151
+ <property name="bottomMargin">
152
+ <number>0</number>
153
+ </property>
154
+ <item>
155
+ <widget class="SimpleImageView" name="graphicsView_image"/>
156
+ </item>
157
+ </layout>
158
+ </widget>
159
+ </widget>
160
+ </item>
161
+ </layout>
162
+ </widget>
163
+ <widget class="QWidget" name="tab_raw">
164
+ <attribute name="title">
165
+ <string>Raw</string>
166
+ </attribute>
167
+ <layout class="QVBoxLayout" name="verticalLayout_5">
168
+ <item>
169
+ <widget class="QPlainTextEdit" name="plainTextEdit_raw">
170
+ <property name="lineWrapMode">
171
+ <enum>QPlainTextEdit::LineWrapMode::NoWrap</enum>
172
+ </property>
173
+ </widget>
174
+ </item>
175
+ </layout>
176
+ </widget>
177
+ </widget>
178
+ </item>
179
+ </layout>
180
+ </widget>
181
+ <customwidgets>
182
+ <customwidget>
183
+ <class>SimplePlotWidget</class>
184
+ <extends>QGraphicsView</extends>
185
+ <header>dcscope.gui.widgets</header>
186
+ </customwidget>
187
+ <customwidget>
188
+ <class>SimpleImageView</class>
189
+ <extends>QGraphicsView</extends>
190
+ <header>dcscope.gui.widgets</header>
191
+ </customwidget>
192
+ </customwidgets>
193
+ <resources/>
194
+ <connections/>
195
+ </ui>
@@ -0,0 +1,69 @@
1
+ import importlib.resources
2
+
3
+ from PyQt6 import uic, QtCore, QtWidgets
4
+
5
+
6
+ class AnalysisView(QtWidgets.QWidget):
7
+ filter_changed = QtCore.pyqtSignal(dict)
8
+ plot_changed = QtCore.pyqtSignal(dict)
9
+ slot_changed = QtCore.pyqtSignal(dict)
10
+ pipeline_changed = QtCore.pyqtSignal(dict)
11
+
12
+ def __init__(self, *args, **kwargs):
13
+ super(AnalysisView, self).__init__(*args, **kwargs)
14
+ ref = importlib.resources.files(
15
+ "dcscope.gui.analysis") / "ana_view.ui"
16
+ with importlib.resources.as_file(ref) as path_ui:
17
+ uic.loadUi(path_ui, self)
18
+
19
+ self._quickview_slot_index = 0
20
+ self._quickview_filt_index = 0
21
+
22
+ self.page_widgets = [
23
+ self.widget_basins,
24
+ self.widget_meta,
25
+ self.widget_filter,
26
+ self.widget_log,
27
+ self.widget_meta,
28
+ self.widget_plot,
29
+ self.widget_slot,
30
+ self.widget_tables
31
+ ]
32
+
33
+ self.setWindowTitle("Analysis View")
34
+ self.setMinimumSize(self.sizeHint())
35
+ # Signals
36
+ self.widget_filter.filter_changed.connect(self.filter_changed)
37
+ self.widget_filter.pipeline_changed.connect(self.pipeline_changed)
38
+ self.widget_plot.plot_changed.connect(self.plot_changed)
39
+ self.widget_plot.pipeline_changed.connect(self.pipeline_changed)
40
+ self.widget_slot.slot_changed.connect(self.slot_changed)
41
+ self.widget_slot.pipeline_changed.connect(self.pipeline_changed)
42
+ self.tabWidget.setCurrentIndex(0)
43
+ self.tabWidget.currentChanged.connect(self.update_content)
44
+
45
+ @QtCore.pyqtSlot(int, int)
46
+ def on_quickview(self, slot_index, filt_index):
47
+ """Signal from the block matrix"""
48
+ self._quickview_filt_index = filt_index
49
+ self._quickview_slot_index = slot_index
50
+ self.update_content()
51
+
52
+ def set_pipeline(self, pipeline):
53
+ self._quickview_filt_index = min(self._quickview_filt_index,
54
+ len(pipeline.filters) - 1)
55
+ self._quickview_slot_index = min(self._quickview_slot_index,
56
+ len(pipeline.slots) - 1)
57
+ for widget in self.page_widgets:
58
+ widget.set_pipeline(pipeline)
59
+ self.update_content()
60
+
61
+ @QtCore.pyqtSlot()
62
+ def update_content(self):
63
+ cur_page = self.tabWidget.currentWidget()
64
+ for widget in self.page_widgets:
65
+ if widget.parent() is cur_page:
66
+ widget.update_content(
67
+ slot_index=self._quickview_slot_index,
68
+ filt_index=self._quickview_filt_index)
69
+ break