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.
- dcscope/__init__.py +17 -0
- dcscope/__main__.py +44 -0
- dcscope/_version.py +21 -0
- dcscope/extensions.py +250 -0
- dcscope/gui/__init__.py +2 -0
- dcscope/gui/analysis/__init__.py +10 -0
- dcscope/gui/analysis/ana_basins.py +110 -0
- dcscope/gui/analysis/ana_basins.ui +143 -0
- dcscope/gui/analysis/ana_filter.py +341 -0
- dcscope/gui/analysis/ana_filter.ui +364 -0
- dcscope/gui/analysis/ana_log.py +122 -0
- dcscope/gui/analysis/ana_log.ui +100 -0
- dcscope/gui/analysis/ana_meta.py +207 -0
- dcscope/gui/analysis/ana_meta.ui +141 -0
- dcscope/gui/analysis/ana_plot.py +638 -0
- dcscope/gui/analysis/ana_plot.ui +1060 -0
- dcscope/gui/analysis/ana_slot.py +504 -0
- dcscope/gui/analysis/ana_slot.ui +684 -0
- dcscope/gui/analysis/ana_tables.py +227 -0
- dcscope/gui/analysis/ana_tables.ui +195 -0
- dcscope/gui/analysis/ana_view.py +69 -0
- dcscope/gui/analysis/ana_view.ui +269 -0
- dcscope/gui/analysis/dlg_slot_reorder.py +55 -0
- dcscope/gui/analysis/dlg_slot_reorder.ui +138 -0
- dcscope/gui/bulk/__init__.py +2 -0
- dcscope/gui/bulk/bulk_emodulus.py +200 -0
- dcscope/gui/bulk/bulk_emodulus.ui +245 -0
- dcscope/gui/compute/__init__.py +3 -0
- dcscope/gui/compute/comp_lme4.py +115 -0
- dcscope/gui/compute/comp_lme4.ui +194 -0
- dcscope/gui/compute/comp_lme4_dataset.py +51 -0
- dcscope/gui/compute/comp_lme4_dataset.ui +92 -0
- dcscope/gui/compute/comp_lme4_results.py +120 -0
- dcscope/gui/compute/comp_lme4_results.ui +268 -0
- dcscope/gui/compute/comp_stats.py +223 -0
- dcscope/gui/compute/comp_stats.ui +187 -0
- dcscope/gui/dcor/__init__.py +304 -0
- dcscope/gui/dcor/dcor.ui +118 -0
- dcscope/gui/export/__init__.py +3 -0
- dcscope/gui/export/e2data.py +394 -0
- dcscope/gui/export/e2data.ui +367 -0
- dcscope/gui/export/e2filter.py +76 -0
- dcscope/gui/export/e2filter.ui +111 -0
- dcscope/gui/export/e2plot.py +94 -0
- dcscope/gui/export/e2plot.ui +175 -0
- dcscope/gui/main.py +1089 -0
- dcscope/gui/main.ui +579 -0
- dcscope/gui/matrix/__init__.py +4 -0
- dcscope/gui/matrix/block_matrix.py +141 -0
- dcscope/gui/matrix/block_matrix.ui +207 -0
- dcscope/gui/matrix/data_matrix.py +574 -0
- dcscope/gui/matrix/dm_dataset.py +116 -0
- dcscope/gui/matrix/dm_dataset.ui +348 -0
- dcscope/gui/matrix/dm_element.py +111 -0
- dcscope/gui/matrix/dm_element.ui +169 -0
- dcscope/gui/matrix/dm_filter.py +115 -0
- dcscope/gui/matrix/dm_filter.ui +287 -0
- dcscope/gui/matrix/plot_matrix.py +316 -0
- dcscope/gui/matrix/pm_element.py +39 -0
- dcscope/gui/matrix/pm_plot.py +86 -0
- dcscope/gui/matrix/pm_plot.ui +249 -0
- dcscope/gui/pipeline_plot.py +797 -0
- dcscope/gui/pipeline_plot.ui +66 -0
- dcscope/gui/preferences.py +380 -0
- dcscope/gui/preferences.ui +554 -0
- dcscope/gui/quick_view/__init__.py +1 -0
- dcscope/gui/quick_view/qv_main.py +1072 -0
- dcscope/gui/quick_view/qv_main.ui +1297 -0
- dcscope/gui/quick_view/qv_scatter.py +284 -0
- dcscope/gui/quick_view/qv_style.css +10 -0
- dcscope/gui/update.py +90 -0
- dcscope/gui/widgets/__init__.py +15 -0
- dcscope/gui/widgets/bg_thread.py +29 -0
- dcscope/gui/widgets/bulk_list.py +79 -0
- dcscope/gui/widgets/bulk_list.ui +95 -0
- dcscope/gui/widgets/double_spin_box_nan.py +75 -0
- dcscope/gui/widgets/feature_combobox.py +140 -0
- dcscope/gui/widgets/get_path.py +42 -0
- dcscope/gui/widgets/key_value_table_widget.css +12 -0
- dcscope/gui/widgets/key_value_table_widget.py +75 -0
- dcscope/gui/widgets/mdi_subwindow_wo_close.py +12 -0
- dcscope/gui/widgets/qrangeslider.py +262 -0
- dcscope/gui/widgets/rangecontrol.py +308 -0
- dcscope/gui/widgets/rangecontrol.ui +136 -0
- dcscope/gui/widgets/simple_image_view.py +55 -0
- dcscope/gui/widgets/simple_plot_widget.py +113 -0
- dcscope/gui/widgets/so_colorbaritem.py +29 -0
- dcscope/gui/widgets/wait_cursor.py +33 -0
- dcscope/idiom.py +26 -0
- dcscope/img/__init__.py +2 -0
- dcscope/img/icon-theme/breeze/COPYING-ICONS +209 -0
- dcscope/img/icon-theme/breeze/COPYING.LIB +510 -0
- dcscope/img/icon-theme/breeze/README +5 -0
- dcscope/img/icon-theme/breeze/actions/16/application-exit.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/16/code-context.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/dialog-cancel.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/dialog-close.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/16/dialog-messages.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/dialog-ok-apply.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/dialog-ok.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/document-open-folder.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/document-open.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/document-save.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/documentinfo.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/16/draw-watercolor.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/edit-clear-all.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/edit-clear.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/edit-paste.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/globe.svg +16 -0
- dcscope/img/icon-theme/breeze/actions/16/gtk-preferences.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/list-add.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/messagebox_warning.svg +20 -0
- dcscope/img/icon-theme/breeze/actions/16/object-columns.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/object-order-lower.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/object-rows.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/office-chart-line-stacked.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/office-chart-ring.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/office-chart-scatter.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/path-mode-polyline.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/preferences-activities.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/remove.svg +10 -0
- dcscope/img/icon-theme/breeze/actions/16/search.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/show-grid.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/special_paste.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/tools-wizard.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/view-calendar-list.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/view-filter.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/view-list-tree.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/view-statistics.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/16/visibility.svg +21 -0
- dcscope/img/icon-theme/breeze/actions/22/application-exit.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/22/code-context.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/dialog-cancel.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/dialog-close.svg +10 -0
- dcscope/img/icon-theme/breeze/actions/22/dialog-messages.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/dialog-ok-apply.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/dialog-ok.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/document-open-folder.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/document-open.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/document-save.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/documentinfo.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/draw-watercolor.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/edit-clear-all.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/edit-clear.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/edit-paste.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/globe.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/22/gtk-preferences.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/22/list-add.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/messagebox_warning.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/object-columns.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/object-order-lower.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/object-rows.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/office-chart-line-stacked.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/office-chart-ring.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/office-chart-scatter.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/path-mode-polyline.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/22/preferences-activities.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/remove.svg +10 -0
- dcscope/img/icon-theme/breeze/actions/22/special_paste.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/tools-wizard.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/view-calendar-list.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/view-filter.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/view-list-tree.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/view-statistics.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/22/visibility.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/24/application-exit.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/code-context.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/dialog-cancel.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/dialog-close.svg +10 -0
- dcscope/img/icon-theme/breeze/actions/24/dialog-messages.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/dialog-ok-apply.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/dialog-ok.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/24/document-open-folder.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/document-open.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/document-save.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/documentinfo.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/24/draw-watercolor.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/edit-clear-all.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/24/edit-clear.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/edit-paste.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/globe.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/24/gtk-preferences.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/24/list-add.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/messagebox_warning.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/24/object-columns.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/object-order-lower.svg +15 -0
- dcscope/img/icon-theme/breeze/actions/24/object-rows.svg +15 -0
- dcscope/img/icon-theme/breeze/actions/24/office-chart-line-stacked.svg +15 -0
- dcscope/img/icon-theme/breeze/actions/24/office-chart-ring.svg +15 -0
- dcscope/img/icon-theme/breeze/actions/24/office-chart-scatter.svg +15 -0
- dcscope/img/icon-theme/breeze/actions/24/path-mode-polyline.svg +15 -0
- dcscope/img/icon-theme/breeze/actions/24/preferences-activities.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/24/remove.svg +10 -0
- dcscope/img/icon-theme/breeze/actions/24/special_paste.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/tools-wizard.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/view-calendar-list.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/view-filter.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/view-list-tree.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/view-statistics.svg +12 -0
- dcscope/img/icon-theme/breeze/actions/24/visibility.svg +14 -0
- dcscope/img/icon-theme/breeze/actions/32/application-exit.svg +8 -0
- dcscope/img/icon-theme/breeze/actions/32/dialog-cancel.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/32/dialog-messages.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/32/dialog-ok-apply.svg +1 -0
- dcscope/img/icon-theme/breeze/actions/32/dialog-ok.svg +1 -0
- dcscope/img/icon-theme/breeze/actions/32/document-open-folder.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/32/document-open.svg +13 -0
- dcscope/img/icon-theme/breeze/actions/32/document-save.svg +18 -0
- dcscope/img/icon-theme/breeze/actions/32/gtk-preferences.svg +17 -0
- dcscope/img/icon-theme/breeze/actions/32/object-order-lower.svg +18 -0
- dcscope/img/icon-theme/breeze/actions/32/view-filter.svg +18 -0
- dcscope/img/icon-theme/breeze/actions/32/view-list-tree.svg +18 -0
- dcscope/img/icon-theme/breeze/places/16/folder-cloud.svg +13 -0
- dcscope/img/icon-theme/breeze/places/16/folder.svg +13 -0
- dcscope/img/icon-theme/breeze/places/22/folder-cloud.svg +13 -0
- dcscope/img/icon-theme/breeze/places/22/folder.svg +13 -0
- dcscope/img/icon-theme/breeze/places/24/folder-cloud.svg +12 -0
- dcscope/img/icon-theme/breeze/places/24/folder.svg +12 -0
- dcscope/img/icon-theme/breeze/places/32/folder-cloud.svg +35 -0
- dcscope/img/icon-theme/breeze/places/32/folder.svg +30 -0
- dcscope/img/icon-theme/breeze/places/64/folder-cloud.svg +35 -0
- dcscope/img/icon-theme/breeze/places/64/folder.svg +30 -0
- dcscope/img/icon-theme/breeze/status/16/dialog-error.svg +9 -0
- dcscope/img/icon-theme/breeze/status/16/dialog-information.svg +9 -0
- dcscope/img/icon-theme/breeze/status/16/dialog-question.svg +7 -0
- dcscope/img/icon-theme/breeze/status/16/dialog-warning.svg +9 -0
- dcscope/img/icon-theme/breeze/status/22/dialog-error.svg +9 -0
- dcscope/img/icon-theme/breeze/status/22/dialog-information.svg +9 -0
- dcscope/img/icon-theme/breeze/status/22/dialog-question.svg +7 -0
- dcscope/img/icon-theme/breeze/status/22/dialog-warning.svg +9 -0
- dcscope/img/icon-theme/breeze/status/24/dialog-error.svg +13 -0
- dcscope/img/icon-theme/breeze/status/24/dialog-information.svg +13 -0
- dcscope/img/icon-theme/breeze/status/24/dialog-question.svg +9 -0
- dcscope/img/icon-theme/breeze/status/24/dialog-warning.svg +1 -0
- dcscope/img/icon-theme/breeze/status/64/dialog-error.svg +25 -0
- dcscope/img/icon-theme/breeze/status/64/dialog-information.svg +25 -0
- dcscope/img/icon-theme/breeze/status/64/dialog-question.svg +25 -0
- dcscope/img/icon-theme/breeze/status/64/dialog-warning.svg +25 -0
- dcscope/img/icon-theme/collect_icons.py +124 -0
- dcscope/img/icon-theme/dcscope/dcor.png +0 -0
- dcscope/img/icon-theme/dcscope/edit-copy-anew.svg +13 -0
- dcscope/img/icon-theme/dcscope/emodulus.svg +69 -0
- dcscope/img/icon-theme/dcscope/filter_ray.svg +54 -0
- dcscope/img/icon-theme/dcscope/region_channel.svg +86 -0
- dcscope/img/icon-theme/dcscope/region_reservoir.svg +89 -0
- dcscope/img/icon-theme/dcscope/rlang.svg +108 -0
- dcscope/img/icon-theme/dcscope/statistical_significance.svg +106 -0
- dcscope/img/icon-theme/index.theme +81 -0
- dcscope/img/icon.png +0 -0
- dcscope/img/icon.svg +73 -0
- dcscope/img/splash.png +0 -0
- dcscope/meta_tool.py +143 -0
- dcscope/pipeline/__init__.py +5 -0
- dcscope/pipeline/core.py +632 -0
- dcscope/pipeline/dataslot.py +270 -0
- dcscope/pipeline/filter.py +161 -0
- dcscope/pipeline/filter_ray.py +170 -0
- dcscope/pipeline/plot.py +187 -0
- dcscope/plot_cache.py +79 -0
- dcscope/session.py +379 -0
- dcscope/util.py +34 -0
- dcscope-2.22.1.dist-info/METADATA +95 -0
- dcscope-2.22.1.dist-info/RECORD +267 -0
- dcscope-2.22.1.dist-info/WHEEL +5 -0
- dcscope-2.22.1.dist-info/entry_points.txt +2 -0
- dcscope-2.22.1.dist-info/licenses/LICENSE +621 -0
- dcscope-2.22.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import codecs
|
|
2
|
+
import numbers
|
|
3
|
+
import pathlib
|
|
4
|
+
import importlib.resources
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
import dclab
|
|
8
|
+
from PyQt6 import uic, QtCore, QtWidgets
|
|
9
|
+
|
|
10
|
+
from ..widgets import show_wait_cursor
|
|
11
|
+
from ..widgets.feature_combobox import HIDDEN_FEATURES
|
|
12
|
+
from ..._version import version
|
|
13
|
+
|
|
14
|
+
STAT_METHODS = sorted(dclab.statistics.Statistics.available_methods.keys())
|
|
15
|
+
STAT_METHODS.remove("%-gated") # This does not make sense with Pipeline
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ComputeStatistics(QtWidgets.QDialog):
|
|
19
|
+
def __init__(self, parent, pipeline, *args, **kwargs):
|
|
20
|
+
super(ComputeStatistics, self).__init__(parent=parent, *args, **kwargs)
|
|
21
|
+
ref = importlib.resources.files(
|
|
22
|
+
"dcscope.gui.compute") / "comp_stats.ui"
|
|
23
|
+
with importlib.resources.as_file(ref) as path_ui:
|
|
24
|
+
uic.loadUi(path_ui, self)
|
|
25
|
+
|
|
26
|
+
# for external statistics
|
|
27
|
+
self.path = None
|
|
28
|
+
# set pipeline
|
|
29
|
+
self.pipeline = pipeline
|
|
30
|
+
# Signals
|
|
31
|
+
self.pushButton_path.clicked.connect(self.on_browse)
|
|
32
|
+
self.comboBox.currentIndexChanged.connect(self.on_combobox)
|
|
33
|
+
# Populate statistics methods
|
|
34
|
+
self.bulklist_stats.set_title("Statistical methods")
|
|
35
|
+
self.bulklist_stats.set_items(STAT_METHODS)
|
|
36
|
+
self.bulklist_stats.on_select_all()
|
|
37
|
+
# Populate filter ray comboBox
|
|
38
|
+
self.comboBox_filter_ray.clear()
|
|
39
|
+
self.comboBox_filter_ray.addItem("No filtering", None)
|
|
40
|
+
for ii, slot in enumerate(pipeline.slots):
|
|
41
|
+
if slot.slot_used:
|
|
42
|
+
raytext = "Ray {} ({})".format(ii, slot.name)
|
|
43
|
+
self.comboBox_filter_ray.addItem(raytext, slot.identifier)
|
|
44
|
+
# initialize feature list
|
|
45
|
+
self.bulklist_features.set_title("Features")
|
|
46
|
+
# initialize rest
|
|
47
|
+
if len(self.pipeline.slots) == 0:
|
|
48
|
+
self.comboBox.setCurrentIndex(1)
|
|
49
|
+
else:
|
|
50
|
+
self.comboBox.setCurrentIndex(0)
|
|
51
|
+
self.on_combobox() # computes self.features
|
|
52
|
+
# Only select innate features
|
|
53
|
+
self.on_select_features_innate()
|
|
54
|
+
|
|
55
|
+
def done(self, r):
|
|
56
|
+
if r:
|
|
57
|
+
success = self.export_statistics()
|
|
58
|
+
else:
|
|
59
|
+
success = True
|
|
60
|
+
if success:
|
|
61
|
+
super(ComputeStatistics, self).done(r)
|
|
62
|
+
|
|
63
|
+
@show_wait_cursor
|
|
64
|
+
@QtCore.pyqtSlot()
|
|
65
|
+
def export_statistics(self):
|
|
66
|
+
"""Export statistics to .tsv"""
|
|
67
|
+
# Output path
|
|
68
|
+
opath, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
69
|
+
self, 'Save statistics', '', 'tab-separated values (*.tsv)')
|
|
70
|
+
if not opath:
|
|
71
|
+
# Abort export
|
|
72
|
+
return False
|
|
73
|
+
elif not opath.endswith(".tsv"):
|
|
74
|
+
opath += ".tsv"
|
|
75
|
+
opath = pathlib.Path(opath)
|
|
76
|
+
|
|
77
|
+
# get features
|
|
78
|
+
features = self.bulklist_features.get_selection()
|
|
79
|
+
# get methods
|
|
80
|
+
methods = self.bulklist_stats.get_selection()
|
|
81
|
+
prog = QtWidgets.QProgressDialog("Computing statistics...", "Abort", 1,
|
|
82
|
+
1, self)
|
|
83
|
+
prog.setMinimumDuration(0)
|
|
84
|
+
time.sleep(0.01)
|
|
85
|
+
prog.setValue(0)
|
|
86
|
+
# compute statistics
|
|
87
|
+
values = []
|
|
88
|
+
if self.comboBox.currentIndex() == 0:
|
|
89
|
+
# from pipeline
|
|
90
|
+
prog.setMaximum(len(self.pipeline.slots))
|
|
91
|
+
for slot_index in range(len(self.pipeline.slots)):
|
|
92
|
+
slot = self.pipeline.slots[slot_index]
|
|
93
|
+
if slot.slot_used: # only export slots "used" (#15)
|
|
94
|
+
ds = self.pipeline.get_dataset(slot_index)
|
|
95
|
+
h, v = dclab.statistics.get_statistics(ds,
|
|
96
|
+
methods=methods,
|
|
97
|
+
features=features)
|
|
98
|
+
h = ["Path", "Slot", "Name"] + h
|
|
99
|
+
v = ["{}".format(ds.path), slot_index, slot.name] + v
|
|
100
|
+
values.append(v)
|
|
101
|
+
if prog.wasCanceled():
|
|
102
|
+
break
|
|
103
|
+
prog.setValue(slot_index + 1)
|
|
104
|
+
QtWidgets.QApplication.processEvents(
|
|
105
|
+
QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)
|
|
106
|
+
else:
|
|
107
|
+
# from path
|
|
108
|
+
inpath = pathlib.Path(self.path)
|
|
109
|
+
files = sorted(inpath.rglob("*.rtdc"))
|
|
110
|
+
prog.setMaximum(len(files))
|
|
111
|
+
for ii, pp in enumerate(files):
|
|
112
|
+
ds = dclab.new_dataset(pp)
|
|
113
|
+
title = ds.title
|
|
114
|
+
slot_id = self.comboBox_filter_ray.currentData()
|
|
115
|
+
if slot_id is not None:
|
|
116
|
+
ds = self.pipeline.apply_filter_ray(rtdc_ds=ds,
|
|
117
|
+
slot_id=slot_id)
|
|
118
|
+
title += " ({})".format(slot_id)
|
|
119
|
+
h, v = dclab.statistics.get_statistics(ds,
|
|
120
|
+
methods=methods,
|
|
121
|
+
features=features)
|
|
122
|
+
h = ["Path", "Name"] + h
|
|
123
|
+
v = ["{}".format(pp), title] + v
|
|
124
|
+
values.append(v)
|
|
125
|
+
prog.setValue(ii + 1)
|
|
126
|
+
QtWidgets.QApplication.processEvents(
|
|
127
|
+
QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)
|
|
128
|
+
|
|
129
|
+
# Header
|
|
130
|
+
header = ["Statistics Output",
|
|
131
|
+
"DCscope {}".format(version),
|
|
132
|
+
"",
|
|
133
|
+
"\t".join(h),
|
|
134
|
+
]
|
|
135
|
+
# Data
|
|
136
|
+
data = []
|
|
137
|
+
for v in values:
|
|
138
|
+
line = []
|
|
139
|
+
for vi in v:
|
|
140
|
+
if (isinstance(vi, numbers.Real)
|
|
141
|
+
and not isinstance(vi, numbers.Integral)):
|
|
142
|
+
line.append("{:.5e}".format(vi))
|
|
143
|
+
else:
|
|
144
|
+
line.append("{}".format(vi))
|
|
145
|
+
data.append("\t".join(line))
|
|
146
|
+
# Write BOM
|
|
147
|
+
with opath.open("wb") as fd:
|
|
148
|
+
fd.write(codecs.BOM_UTF8)
|
|
149
|
+
# Write rest
|
|
150
|
+
with opath.open("a", encoding="utf-8") as fd:
|
|
151
|
+
for line in header:
|
|
152
|
+
fd.write("# " + line + "\n")
|
|
153
|
+
for line in data:
|
|
154
|
+
fd.write(line + "\n")
|
|
155
|
+
return True # True means success
|
|
156
|
+
|
|
157
|
+
@QtCore.pyqtSlot()
|
|
158
|
+
def on_browse(self):
|
|
159
|
+
out = QtWidgets.QFileDialog.getExistingDirectory(self,
|
|
160
|
+
'Export directory')
|
|
161
|
+
if out:
|
|
162
|
+
self.path = out
|
|
163
|
+
self.lineEdit_path.setText(self.path)
|
|
164
|
+
self.comboBox.setCurrentIndex(1)
|
|
165
|
+
else:
|
|
166
|
+
self.path = None
|
|
167
|
+
self.comboBox.setCurrentIndex(0)
|
|
168
|
+
|
|
169
|
+
@QtCore.pyqtSlot()
|
|
170
|
+
def on_combobox(self):
|
|
171
|
+
if self.comboBox.currentIndex() == 1:
|
|
172
|
+
# Datasets from a folder
|
|
173
|
+
self.widget_other.show()
|
|
174
|
+
if self.path is None:
|
|
175
|
+
self.on_browse()
|
|
176
|
+
if self.path:
|
|
177
|
+
self.update_feature_list(use_pipeline=False)
|
|
178
|
+
# else, on_combobox is triggered again
|
|
179
|
+
else:
|
|
180
|
+
# Datasets from current session
|
|
181
|
+
self.widget_other.hide()
|
|
182
|
+
self.update_feature_list(use_pipeline=True)
|
|
183
|
+
|
|
184
|
+
@QtCore.pyqtSlot()
|
|
185
|
+
def on_select_features_innate(self):
|
|
186
|
+
"""Only select all innate features of the first dataset"""
|
|
187
|
+
|
|
188
|
+
if self.pipeline.num_slots:
|
|
189
|
+
ds = self.pipeline.get_dataset(0)
|
|
190
|
+
features_innate = ds.features_innate
|
|
191
|
+
lw = self.bulklist_features.listWidget
|
|
192
|
+
for ii in range(lw.count()):
|
|
193
|
+
wid = lw.item(ii)
|
|
194
|
+
for feat in features_innate:
|
|
195
|
+
if wid.data(101) == feat:
|
|
196
|
+
wid.setCheckState(QtCore.Qt.CheckState.Checked)
|
|
197
|
+
break
|
|
198
|
+
else:
|
|
199
|
+
wid.setCheckState(QtCore.Qt.CheckState.Unchecked)
|
|
200
|
+
|
|
201
|
+
def update_feature_list(self, use_pipeline=True):
|
|
202
|
+
if use_pipeline:
|
|
203
|
+
self.features = self.pipeline.get_features(scalar=True,
|
|
204
|
+
union=True,
|
|
205
|
+
label_sort=True)
|
|
206
|
+
else:
|
|
207
|
+
# We want to compute statistics from a folder
|
|
208
|
+
# TODO:
|
|
209
|
+
# - Add ml_score_??? features
|
|
210
|
+
|
|
211
|
+
# label-sorted features
|
|
212
|
+
features = dclab.dfn.scalar_feature_names
|
|
213
|
+
labs = [dclab.dfn.get_feature_label(f) for f in features]
|
|
214
|
+
lf = sorted(zip(labs, features))
|
|
215
|
+
self.features = [it[1] for it in lf]
|
|
216
|
+
|
|
217
|
+
# do not compute statistics for basinmap features
|
|
218
|
+
for feat in HIDDEN_FEATURES + ["index"]:
|
|
219
|
+
if feat in self.features:
|
|
220
|
+
self.features.remove(feat)
|
|
221
|
+
|
|
222
|
+
labels = [dclab.dfn.get_feature_label(feat) for feat in self.features]
|
|
223
|
+
self.bulklist_features.set_items(self.features, labels)
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<ui version="4.0">
|
|
3
|
+
<class>Dialog</class>
|
|
4
|
+
<widget class="QDialog" name="Dialog">
|
|
5
|
+
<property name="geometry">
|
|
6
|
+
<rect>
|
|
7
|
+
<x>0</x>
|
|
8
|
+
<y>0</y>
|
|
9
|
+
<width>693</width>
|
|
10
|
+
<height>446</height>
|
|
11
|
+
</rect>
|
|
12
|
+
</property>
|
|
13
|
+
<property name="windowTitle">
|
|
14
|
+
<string>Compute and export statistical data</string>
|
|
15
|
+
</property>
|
|
16
|
+
<property name="windowIcon">
|
|
17
|
+
<iconset theme="view-statistics">
|
|
18
|
+
<normaloff>.</normaloff>.</iconset>
|
|
19
|
+
</property>
|
|
20
|
+
<layout class="QVBoxLayout" name="verticalLayout">
|
|
21
|
+
<item>
|
|
22
|
+
<widget class="QLabel" name="label">
|
|
23
|
+
<property name="text">
|
|
24
|
+
<string>Compute statistics for multiple datasets.</string>
|
|
25
|
+
</property>
|
|
26
|
+
</widget>
|
|
27
|
+
</item>
|
|
28
|
+
<item>
|
|
29
|
+
<widget class="QComboBox" name="comboBox">
|
|
30
|
+
<item>
|
|
31
|
+
<property name="text">
|
|
32
|
+
<string>All datasets of the current session</string>
|
|
33
|
+
</property>
|
|
34
|
+
</item>
|
|
35
|
+
<item>
|
|
36
|
+
<property name="text">
|
|
37
|
+
<string>All datasets in a directory</string>
|
|
38
|
+
</property>
|
|
39
|
+
</item>
|
|
40
|
+
</widget>
|
|
41
|
+
</item>
|
|
42
|
+
<item>
|
|
43
|
+
<widget class="QWidget" name="widget_other" native="true">
|
|
44
|
+
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
45
|
+
<property name="leftMargin">
|
|
46
|
+
<number>0</number>
|
|
47
|
+
</property>
|
|
48
|
+
<property name="topMargin">
|
|
49
|
+
<number>0</number>
|
|
50
|
+
</property>
|
|
51
|
+
<property name="rightMargin">
|
|
52
|
+
<number>0</number>
|
|
53
|
+
</property>
|
|
54
|
+
<property name="bottomMargin">
|
|
55
|
+
<number>0</number>
|
|
56
|
+
</property>
|
|
57
|
+
<item>
|
|
58
|
+
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
59
|
+
<property name="topMargin">
|
|
60
|
+
<number>0</number>
|
|
61
|
+
</property>
|
|
62
|
+
<item>
|
|
63
|
+
<widget class="QLineEdit" name="lineEdit_path">
|
|
64
|
+
<property name="placeholderText">
|
|
65
|
+
<string>PATH</string>
|
|
66
|
+
</property>
|
|
67
|
+
</widget>
|
|
68
|
+
</item>
|
|
69
|
+
<item>
|
|
70
|
+
<widget class="QPushButton" name="pushButton_path">
|
|
71
|
+
<property name="text">
|
|
72
|
+
<string>Browse</string>
|
|
73
|
+
</property>
|
|
74
|
+
</widget>
|
|
75
|
+
</item>
|
|
76
|
+
</layout>
|
|
77
|
+
</item>
|
|
78
|
+
<item>
|
|
79
|
+
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
80
|
+
<property name="topMargin">
|
|
81
|
+
<number>0</number>
|
|
82
|
+
</property>
|
|
83
|
+
<item>
|
|
84
|
+
<widget class="QLabel" name="label_2">
|
|
85
|
+
<property name="toolTip">
|
|
86
|
+
<string>All filters from this filter ray will be applied before computing statistics</string>
|
|
87
|
+
</property>
|
|
88
|
+
<property name="text">
|
|
89
|
+
<string>Filter ray</string>
|
|
90
|
+
</property>
|
|
91
|
+
</widget>
|
|
92
|
+
</item>
|
|
93
|
+
<item>
|
|
94
|
+
<widget class="QComboBox" name="comboBox_filter_ray">
|
|
95
|
+
<property name="sizePolicy">
|
|
96
|
+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
97
|
+
<horstretch>0</horstretch>
|
|
98
|
+
<verstretch>0</verstretch>
|
|
99
|
+
</sizepolicy>
|
|
100
|
+
</property>
|
|
101
|
+
</widget>
|
|
102
|
+
</item>
|
|
103
|
+
</layout>
|
|
104
|
+
</item>
|
|
105
|
+
</layout>
|
|
106
|
+
</widget>
|
|
107
|
+
</item>
|
|
108
|
+
<item>
|
|
109
|
+
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="2,1">
|
|
110
|
+
<item>
|
|
111
|
+
<widget class="BulkList" name="bulklist_features" native="true">
|
|
112
|
+
<property name="sizePolicy">
|
|
113
|
+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
114
|
+
<horstretch>0</horstretch>
|
|
115
|
+
<verstretch>0</verstretch>
|
|
116
|
+
</sizepolicy>
|
|
117
|
+
</property>
|
|
118
|
+
</widget>
|
|
119
|
+
</item>
|
|
120
|
+
<item>
|
|
121
|
+
<widget class="BulkList" name="bulklist_stats" native="true">
|
|
122
|
+
<property name="sizePolicy">
|
|
123
|
+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
124
|
+
<horstretch>0</horstretch>
|
|
125
|
+
<verstretch>0</verstretch>
|
|
126
|
+
</sizepolicy>
|
|
127
|
+
</property>
|
|
128
|
+
</widget>
|
|
129
|
+
</item>
|
|
130
|
+
</layout>
|
|
131
|
+
</item>
|
|
132
|
+
<item>
|
|
133
|
+
<widget class="QDialogButtonBox" name="buttonBox">
|
|
134
|
+
<property name="orientation">
|
|
135
|
+
<enum>Qt::Horizontal</enum>
|
|
136
|
+
</property>
|
|
137
|
+
<property name="standardButtons">
|
|
138
|
+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
139
|
+
</property>
|
|
140
|
+
</widget>
|
|
141
|
+
</item>
|
|
142
|
+
</layout>
|
|
143
|
+
</widget>
|
|
144
|
+
<customwidgets>
|
|
145
|
+
<customwidget>
|
|
146
|
+
<class>BulkList</class>
|
|
147
|
+
<extends>QWidget</extends>
|
|
148
|
+
<header>dcscope.gui.widgets.bulk_list</header>
|
|
149
|
+
<container>1</container>
|
|
150
|
+
</customwidget>
|
|
151
|
+
</customwidgets>
|
|
152
|
+
<resources/>
|
|
153
|
+
<connections>
|
|
154
|
+
<connection>
|
|
155
|
+
<sender>buttonBox</sender>
|
|
156
|
+
<signal>accepted()</signal>
|
|
157
|
+
<receiver>Dialog</receiver>
|
|
158
|
+
<slot>accept()</slot>
|
|
159
|
+
<hints>
|
|
160
|
+
<hint type="sourcelabel">
|
|
161
|
+
<x>248</x>
|
|
162
|
+
<y>254</y>
|
|
163
|
+
</hint>
|
|
164
|
+
<hint type="destinationlabel">
|
|
165
|
+
<x>157</x>
|
|
166
|
+
<y>274</y>
|
|
167
|
+
</hint>
|
|
168
|
+
</hints>
|
|
169
|
+
</connection>
|
|
170
|
+
<connection>
|
|
171
|
+
<sender>buttonBox</sender>
|
|
172
|
+
<signal>rejected()</signal>
|
|
173
|
+
<receiver>Dialog</receiver>
|
|
174
|
+
<slot>reject()</slot>
|
|
175
|
+
<hints>
|
|
176
|
+
<hint type="sourcelabel">
|
|
177
|
+
<x>316</x>
|
|
178
|
+
<y>260</y>
|
|
179
|
+
</hint>
|
|
180
|
+
<hint type="destinationlabel">
|
|
181
|
+
<x>286</x>
|
|
182
|
+
<y>274</y>
|
|
183
|
+
</hint>
|
|
184
|
+
</hints>
|
|
185
|
+
</connection>
|
|
186
|
+
</connections>
|
|
187
|
+
</ui>
|