tomwer 1.2.0a1__py3-none-any.whl → 1.2.0a3__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 (219) hide show
  1. orangecontrib/tomwer/tutorials/append_raw_darks_and_flats_frames_to_NXtomos.ows +44 -0
  2. orangecontrib/tomwer/tutorials/copy_reduced_darks_and_flats_meth1.ows +55 -0
  3. orangecontrib/tomwer/tutorials/copy_reduced_darks_and_flats_meth2.ows +48 -0
  4. orangecontrib/tomwer/tutorials/default_cor_search.ows +40 -0
  5. orangecontrib/tomwer/tutorials/hello_world_python_script.ows +50 -0
  6. orangecontrib/tomwer/tutorials/simple_slice_reconstruction_on_slurm.ows +50 -0
  7. orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +8 -8
  8. orangecontrib/tomwer/widgets/__init__.py +1 -1
  9. orangecontrib/tomwer/widgets/cluster/FutureSupervisorOW.py +0 -1
  10. orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +8 -6
  11. orangecontrib/tomwer/widgets/control/AdvancementOW.py +0 -1
  12. orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +1 -6
  13. orangecontrib/tomwer/widgets/control/DataListOW.py +0 -1
  14. orangecontrib/tomwer/widgets/control/DataListenerOW.py +4 -4
  15. orangecontrib/tomwer/widgets/control/DataSelectorOW.py +0 -1
  16. orangecontrib/tomwer/widgets/control/DataTransfertOW.py +7 -7
  17. orangecontrib/tomwer/widgets/control/DataValidatorOW.py +0 -1
  18. orangecontrib/tomwer/widgets/control/DataWatcherOW.py +0 -3
  19. orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +3 -2
  20. orangecontrib/tomwer/widgets/control/EmailOW.py +82 -0
  21. orangecontrib/tomwer/widgets/control/FilterOW.py +3 -3
  22. orangecontrib/tomwer/widgets/control/NXTomomillOW.py +1 -1
  23. orangecontrib/tomwer/widgets/control/NotifierOW.py +0 -1
  24. orangecontrib/tomwer/widgets/control/ReduceDarkFlatSelectorOW.py +93 -0
  25. orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +29 -5
  26. orangecontrib/tomwer/widgets/control/TimerOW.py +1 -2
  27. orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +0 -1
  28. orangecontrib/tomwer/widgets/control/VolumeSelector.py +0 -1
  29. orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +4 -10
  30. orangecontrib/tomwer/widgets/control/icons/email.png +0 -0
  31. orangecontrib/tomwer/widgets/control/icons/email.svg +58 -0
  32. orangecontrib/tomwer/widgets/control/icons/reduced_darkflat_selector.png +0 -0
  33. orangecontrib/tomwer/widgets/control/icons/reduced_darkflat_selector.svg +199 -0
  34. orangecontrib/tomwer/widgets/debugtools/DatasetGeneratorOW.py +0 -1
  35. orangecontrib/tomwer/widgets/debugtools/ObjectInspectorOW.py +0 -1
  36. orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +1 -2
  37. orangecontrib/tomwer/widgets/edit/ImageKeyEditorOW.py +1 -2
  38. orangecontrib/tomwer/widgets/edit/ImageKeyUpgraderOW.py +0 -1
  39. orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +0 -1
  40. orangecontrib/tomwer/widgets/other/PythonScriptOW.py +29 -1
  41. orangecontrib/tomwer/widgets/other/TomoObjsHub.py +28 -0
  42. orangecontrib/tomwer/widgets/other/icons/hub.png +0 -0
  43. orangecontrib/tomwer/widgets/other/icons/hub.svg +113 -0
  44. orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +18 -12
  45. orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +0 -2
  46. orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +21 -6
  47. orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +29 -7
  48. orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +18 -5
  49. orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +40 -13
  50. orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +37 -10
  51. orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +2 -3
  52. orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +5 -4
  53. orangecontrib/tomwer/widgets/stitching/StitcherOW.py +0 -1
  54. orangecontrib/tomwer/widgets/stitching/ZStitchingConfigOW.py +0 -1
  55. orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +10 -4
  56. orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
  57. orangecontrib/tomwer/widgets/visualization/LivesliceOW.py +0 -1
  58. orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +0 -1
  59. orangecontrib/tomwer/widgets/visualization/RadioStackOW.py +7 -5
  60. orangecontrib/tomwer/widgets/visualization/SampleMovedOW.py +1 -1
  61. orangecontrib/tomwer/widgets/visualization/SinogramViewerOW.py +0 -3
  62. orangecontrib/tomwer/widgets/visualization/SliceStackOW.py +7 -5
  63. orangecontrib/tomwer/widgets/visualization/VolumeViewerOW.py +4 -4
  64. tomwer/__main__.py +139 -5
  65. tomwer/app/axis.py +16 -5
  66. tomwer/app/canvas_launcher/config.py +1 -1
  67. tomwer/app/canvas_launcher/mainwindow.py +164 -6
  68. tomwer/app/darkref.py +10 -181
  69. tomwer/app/darkrefpatch.py +10 -131
  70. tomwer/app/diffframe.py +11 -0
  71. tomwer/app/imagekeyeditor.py +12 -19
  72. tomwer/app/intensitynormalization.py +1 -0
  73. tomwer/app/lamino.py +7 -2
  74. tomwer/app/patchrawdarkflat.py +131 -0
  75. tomwer/app/radiostack.py +10 -0
  76. tomwer/app/reducedarkflat.py +205 -0
  77. tomwer/app/saaxis.py +27 -8
  78. tomwer/app/sadeltabeta.py +29 -8
  79. tomwer/app/samplemoved.py +11 -0
  80. tomwer/app/scanviewer.py +12 -0
  81. tomwer/app/sinogramviewer.py +11 -0
  82. tomwer/app/slicestack.py +11 -0
  83. tomwer/app/zstitching.py +12 -0
  84. tomwer/core/futureobject.py +4 -2
  85. tomwer/core/process/conditions/filters.py +26 -4
  86. tomwer/core/process/control/datadiscovery.py +4 -0
  87. tomwer/core/process/control/datawatcher/datawatcher.py +5 -1
  88. tomwer/core/process/control/email.py +148 -0
  89. tomwer/core/process/control/nxtomoconcatenate.py +9 -2
  90. tomwer/core/process/control/nxtomomill.py +58 -16
  91. tomwer/core/process/control/scanselector.py +4 -0
  92. tomwer/core/process/control/scantransfer.py +52 -23
  93. tomwer/core/process/control/test/test_concatenate_nxtomos.py +1 -0
  94. tomwer/core/process/control/test/test_email.py +52 -0
  95. tomwer/core/process/control/test/test_h52nx_process.py +106 -0
  96. tomwer/core/process/control/test/test_volume_link.py +5 -4
  97. tomwer/core/process/control/timer.py +27 -6
  98. tomwer/core/process/control/tomoobjserie.py +4 -0
  99. tomwer/core/process/control/volumeselector.py +4 -0
  100. tomwer/core/process/control/volumesymlink.py +47 -8
  101. tomwer/core/process/edit/darkflatpatch.py +49 -8
  102. tomwer/core/process/edit/imagekeyeditor.py +63 -13
  103. tomwer/core/process/reconstruction/axis/__init__.py +1 -1
  104. tomwer/core/process/reconstruction/axis/axis.py +61 -41
  105. tomwer/core/process/reconstruction/axis/params.py +4 -6
  106. tomwer/core/process/reconstruction/darkref/darkrefs.py +53 -16
  107. tomwer/core/process/reconstruction/darkref/darkrefscopy.py +12 -2
  108. tomwer/core/process/reconstruction/lamino/__init__.py +1 -1
  109. tomwer/core/process/reconstruction/lamino/tofu.py +22 -2
  110. tomwer/core/process/reconstruction/nabu/nabucommon.py +93 -14
  111. tomwer/core/process/reconstruction/nabu/nabuscores.py +70 -33
  112. tomwer/core/process/reconstruction/nabu/nabuslices.py +219 -41
  113. tomwer/core/process/reconstruction/nabu/nabuvolume.py +240 -108
  114. tomwer/core/process/reconstruction/nabu/utils.py +10 -36
  115. tomwer/core/process/reconstruction/normalization/normalization.py +10 -3
  116. tomwer/core/process/reconstruction/saaxis/__init__.py +1 -0
  117. tomwer/core/process/reconstruction/saaxis/saaxis.py +564 -376
  118. tomwer/core/process/reconstruction/sadeltabeta/__init__.py +1 -0
  119. tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +481 -268
  120. tomwer/core/process/reconstruction/scores/params.py +21 -8
  121. tomwer/core/process/reconstruction/test/test_darkref_copy.py +2 -0
  122. tomwer/core/process/reconstruction/test/test_saaxis.py +21 -8
  123. tomwer/core/process/reconstruction/test/test_sadeltabeta.py +8 -5
  124. tomwer/core/process/script/python.py +7 -2
  125. tomwer/core/process/stitching/nabustitcher.py +10 -3
  126. tomwer/core/process/task.py +2 -9
  127. tomwer/core/process/test/test_axis.py +25 -15
  128. tomwer/core/process/test/test_conditions.py +6 -6
  129. tomwer/core/process/test/test_dark_and_flat.py +20 -15
  130. tomwer/core/process/test/test_data_transfer.py +8 -8
  131. tomwer/core/process/test/test_data_watcher.py +1 -1
  132. tomwer/core/process/test/test_lamino.py +6 -6
  133. tomwer/core/process/test/test_nabu.py +13 -8
  134. tomwer/core/process/test/test_normalization.py +1 -0
  135. tomwer/core/process/test/test_timer.py +6 -6
  136. tomwer/core/process/visualization/dataviewer.py +4 -0
  137. tomwer/core/process/visualization/diffviewer.py +4 -0
  138. tomwer/core/process/visualization/imagestackviewer.py +4 -0
  139. tomwer/core/process/visualization/radiostack.py +4 -0
  140. tomwer/core/process/visualization/samplemoved.py +4 -0
  141. tomwer/core/process/visualization/sinogramviewer.py +4 -0
  142. tomwer/core/process/visualization/slicestack.py +4 -0
  143. tomwer/core/process/visualization/volumeviewer.py +4 -0
  144. tomwer/core/scan/hdf5scan.py +4 -4
  145. tomwer/core/scan/scanbase.py +5 -1
  146. tomwer/core/scan/test/test_process_registration.py +9 -9
  147. tomwer/core/settings.py +59 -1
  148. tomwer/core/test/test_lamino.py +2 -1
  149. tomwer/core/utils/__init__.py +16 -0
  150. tomwer/core/utils/locker.py +0 -1
  151. tomwer/core/utils/resource.py +6 -11
  152. tomwer/core/utils/scanutils.py +2 -0
  153. tomwer/gui/cluster/slurm.py +91 -7
  154. tomwer/gui/cluster/supervisor.py +16 -11
  155. tomwer/gui/cluster/test/test_cluster.py +16 -1
  156. tomwer/gui/conditions/filter.py +3 -3
  157. tomwer/gui/control/datalist.py +24 -11
  158. tomwer/gui/control/email.py +183 -0
  159. tomwer/gui/control/reducedarkflatselector.py +545 -0
  160. tomwer/gui/control/singletomoobj.py +23 -1
  161. tomwer/gui/control/test/test_email.py +35 -0
  162. tomwer/gui/control/test/test_reducedarkflat_selector.py +280 -0
  163. tomwer/gui/reconstruction/axis/CompareImages.py +1 -1
  164. tomwer/gui/reconstruction/axis/axis.py +10 -6
  165. tomwer/gui/reconstruction/axis/radioaxis.py +14 -6
  166. tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +2 -0
  167. tomwer/gui/reconstruction/darkref/darkrefwidget.py +4 -4
  168. tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +3 -1
  169. tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +34 -33
  170. tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +1 -1
  171. tomwer/gui/reconstruction/normalization/intensity.py +5 -5
  172. tomwer/gui/reconstruction/saaxis/corrangeselector.py +1 -0
  173. tomwer/gui/reconstruction/saaxis/saaxis.py +6 -6
  174. tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +6 -6
  175. tomwer/gui/reconstruction/scores/scoreplot.py +6 -4
  176. tomwer/gui/samplemoved/__init__.py +2 -2
  177. tomwer/gui/stackplot.py +18 -7
  178. tomwer/gui/stacks.py +2 -2
  179. tomwer/gui/stitching/stitchandbackground.py +2 -2
  180. tomwer/gui/stitching/stitching.py +1 -1
  181. tomwer/gui/stitching/stitching_raw.py +1 -1
  182. tomwer/gui/utils/__init__.py +1 -85
  183. tomwer/gui/utils/illustrations.py +1 -1
  184. tomwer/gui/utils/inputwidget.py +41 -36
  185. tomwer/gui/utils/slider.py +2 -2
  186. tomwer/gui/utils/utils.py +93 -0
  187. tomwer/gui/visualization/dataviewer.py +8 -5
  188. tomwer/gui/visualization/diffviewer/diffviewer.py +4 -4
  189. tomwer/gui/visualization/reconstructionparameters.py +26 -6
  190. tomwer/gui/visualization/sinogramviewer.py +7 -1
  191. tomwer/gui/visualization/test/test_reconstruction_parameters.py +2 -4
  192. tomwer/gui/visualization/volumeviewer.py +2 -0
  193. tomwer/resources/__init__.py +55 -43
  194. tomwer/resources/gui/icons/compose.png +0 -0
  195. tomwer/resources/gui/icons/compose.svg +75 -0
  196. tomwer/synctools/datatransfert.py +3 -1
  197. tomwer/synctools/stacks/edit/darkflatpatch.py +39 -34
  198. tomwer/synctools/stacks/edit/imagekeyeditor.py +8 -27
  199. tomwer/synctools/stacks/processingstack.py +45 -9
  200. tomwer/synctools/stacks/reconstruction/axis.py +6 -5
  201. tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -0
  202. tomwer/synctools/stacks/reconstruction/lamino.py +3 -3
  203. tomwer/synctools/stacks/reconstruction/nabu.py +49 -140
  204. tomwer/synctools/stacks/reconstruction/normalization.py +1 -0
  205. tomwer/synctools/stacks/reconstruction/saaxis.py +19 -33
  206. tomwer/synctools/stacks/reconstruction/sadeltabeta.py +16 -32
  207. tomwer/synctools/test/test_darkRefs.py +19 -10
  208. tomwer/synctools/test/test_foldertransfer.py +7 -7
  209. tomwer/third_party/nabu/preproc/phase.py +6 -8
  210. tomwer/third_party/nabu/utils.py +2 -3
  211. tomwer/version.py +1 -1
  212. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/METADATA +15 -54
  213. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/RECORD +219 -192
  214. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/WHEEL +1 -1
  215. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/entry_points.txt +3 -3
  216. /tomwer-1.2.0a1-py3.9-nspkg.pth → /tomwer-1.2.0a3-py3.11-nspkg.pth +0 -0
  217. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/LICENSE +0 -0
  218. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/namespace_packages.txt +0 -0
  219. {tomwer-1.2.0a1.dist-info → tomwer-1.2.0a3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,205 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import argparse
5
+ import logging
6
+ import signal
7
+ import sys
8
+
9
+ from silx.gui import qt
10
+
11
+ from tomwer.core.process.reconstruction.darkref.darkrefs import DarkRefsTask
12
+ from tomwer.core.process.reconstruction.darkref.params import DKRFRP, ReduceMethod
13
+ from tomwer.core.scan.scanfactory import ScanFactory
14
+ from tomwer.core.utils.resource import increase_max_number_file
15
+ from tomwer.gui import icons
16
+ from tomwer.gui.reconstruction.darkref.darkrefwidget import DarkRefWidget
17
+ from tomwer.gui.utils.splashscreen import getMainSplashScreen
18
+ from tomwer.synctools.darkref import QDKRFRP
19
+
20
+ logging.basicConfig(level=logging.WARNING)
21
+ _logger = logging.getLogger(__name__)
22
+
23
+
24
+ def getinputinfo():
25
+ return "tomwer darkref [scanDir]"
26
+
27
+
28
+ def _exec_without_interaction(scan, dark_method, flat_method, overwrite):
29
+ recons_params = DKRFRP()
30
+ recons_params.overwrite_dark = overwrite
31
+ recons_params.overwrite_ref = overwrite
32
+ recons_params.dark_calc_method = dark_method
33
+ recons_params.flat_calc_method = flat_method
34
+ dark_ref = DarkRefsTask(
35
+ inputs={
36
+ "data": scan,
37
+ "dark_ref_params": recons_params,
38
+ "serialize_output_data": False,
39
+ }
40
+ )
41
+ _logger.info(f"Start processing of {scan}")
42
+ dark_ref.run()
43
+ _logger.info(f"End processing of {scan}")
44
+ return 0
45
+
46
+
47
+ def _exec_with_interaction(scan, dark_method, flat_method, overwrite):
48
+ class ProcessingThread(qt.QThread):
49
+ """
50
+ Thread used to run the processing
51
+ """
52
+
53
+ def __init__(self, inputs: dict) -> None:
54
+ super().__init__()
55
+ self._inputs = inputs
56
+
57
+ def run(self):
58
+ process = DarkRefsTask(inputs=self._inputs)
59
+ process.run()
60
+
61
+ class _DarkRefWidgetRunnable(DarkRefWidget):
62
+ sigScanReady = qt.Signal(str)
63
+
64
+ def __init__(self, scan, parent=None):
65
+ self.__scan = scan
66
+ self.__darkref_rp = QDKRFRP()
67
+ DarkRefWidget.__init__(self, parent=parent, reconsparams=self.__darkref_rp)
68
+ buttonExec = qt.QPushButton("execute", parent=self)
69
+ buttonExec.setAutoDefault(True)
70
+ # needed to be used as an application to return end only when the
71
+ # processing thread is needed
72
+ self._forceSync = True
73
+ self.layout().addWidget(buttonExec)
74
+ buttonExec.pressed.connect(self._process)
75
+ self.setWindowIcon(icons.getQIcon("tomwer"))
76
+ self._processingThread = None
77
+
78
+ def _notifyEnd(self, *args, **kwargs):
79
+ self._processingThread.finished.disconnect(self._notifyEnd)
80
+ print(f"computation of {self.__scan} reduced dark and flat done.")
81
+ self._processingThread = None
82
+
83
+ def _process(self):
84
+ if self._processingThread is not None:
85
+ print("processing already on-going...")
86
+ else:
87
+ self._processingThread = ProcessingThread(
88
+ inputs={
89
+ "data": self.__scan,
90
+ "dark_ref_params": self.__darkref_rp,
91
+ "force_sync": self._forceSync,
92
+ }
93
+ )
94
+ self._processingThread.finished.connect(self._notifyEnd)
95
+ print(f"start reducing dark and flat of {self.__scan} ...")
96
+ self._processingThread.start()
97
+
98
+ def sigintHandler(*args):
99
+ """Handler for the SIGINT signal."""
100
+ qt.QApplication.quit()
101
+
102
+ global app # QApplication must be global to avoid seg fault on quit
103
+ app = qt.QApplication.instance() or qt.QApplication(["tomwer"])
104
+
105
+ qt.QLocale.setDefault(qt.QLocale(qt.QLocale.English))
106
+ qt.QLocale.setDefault(qt.QLocale.c())
107
+ signal.signal(signal.SIGINT, sigintHandler)
108
+ sys.excepthook = qt.exceptionHandler
109
+
110
+ timer = qt.QTimer()
111
+ timer.start(500)
112
+ # Application have to wake up Python interpreter, else SIGINT is not
113
+ # catched
114
+ timer.timeout.connect(lambda: None)
115
+
116
+ splash = getMainSplashScreen()
117
+
118
+ widget = _DarkRefWidgetRunnable(scan)
119
+ # set up
120
+ widget.recons_params.overwrite_dark = overwrite
121
+ widget.recons_params.overwrite_flat = overwrite
122
+ widget.recons_params.dark_calc_method = dark_method
123
+ widget.recons_params.flat_calc_method = flat_method
124
+ splash.finish(widget)
125
+ widget.show()
126
+ return app.exec_()
127
+
128
+
129
+ def main(argv):
130
+ parser = argparse.ArgumentParser(description=__doc__)
131
+ parser.add_argument(
132
+ "scan_path", help="Data file to show (h5 file, edf files, spec files)"
133
+ )
134
+ parser.add_argument(
135
+ "--entry",
136
+ help="an entry can be specify in case of hdf5 the master file",
137
+ default=None,
138
+ )
139
+ parser.add_argument(
140
+ "--dark-method",
141
+ help="Define the method to be used for computing dark",
142
+ default=ReduceMethod.MEAN,
143
+ )
144
+ parser.add_argument(
145
+ "--flat-method",
146
+ help="Define the method to be used for computing flat",
147
+ default=ReduceMethod.MEDIAN,
148
+ )
149
+ parser.add_argument(
150
+ "--no-gui",
151
+ help="Will run directly the dark and ref without any interaction",
152
+ dest="run",
153
+ action="store_true",
154
+ default=False,
155
+ )
156
+ parser.add_argument(
157
+ "--overwrite",
158
+ dest="overwrite",
159
+ action="store_true",
160
+ default=False,
161
+ help="Overwrite dark/flats if exists",
162
+ )
163
+ parser.add_argument(
164
+ "--debug",
165
+ dest="debug",
166
+ action="store_true",
167
+ default=False,
168
+ help="Set logging system in debug mode",
169
+ )
170
+
171
+ options = parser.parse_args(argv[1:])
172
+
173
+ if options.debug:
174
+ logging.root.setLevel(logging.DEBUG)
175
+
176
+ increase_max_number_file()
177
+
178
+ scan = ScanFactory.create_scan_object(options.scan_path, entry=options.entry)
179
+ scan.set_process_index_frm_tomwer_process_file()
180
+
181
+ dark_method = ReduceMethod.from_value(options.dark_method)
182
+ flat_method = ReduceMethod.from_value(options.flat_method)
183
+
184
+ if options.run:
185
+ exit(
186
+ _exec_without_interaction(
187
+ scan=scan,
188
+ dark_method=dark_method,
189
+ flat_method=flat_method,
190
+ overwrite=options.overwrite,
191
+ )
192
+ )
193
+ else:
194
+ exit(
195
+ _exec_with_interaction(
196
+ scan=scan,
197
+ dark_method=dark_method,
198
+ flat_method=flat_method,
199
+ overwrite=options.overwrite,
200
+ )
201
+ )
202
+
203
+
204
+ if __name__ == "__main__":
205
+ main(sys.argv)
tomwer/app/saaxis.py CHANGED
@@ -12,11 +12,11 @@ from silx.gui import qt
12
12
  from silx.io.utils import h5py_read_dataset
13
13
 
14
14
  from tomwer.core.process import utils as core_utils
15
- from tomwer.core.process.reconstruction.axis.axis import AxisProcess, NoAxisUrl
15
+ from tomwer.core.process.reconstruction.axis.axis import AxisTask, NoAxisUrl
16
16
  from tomwer.core.process.reconstruction.darkref.darkrefs import (
17
17
  requires_reduced_dark_and_flat,
18
18
  )
19
- from tomwer.core.process.reconstruction.saaxis.saaxis import SAAxisProcess
19
+ from tomwer.core.process.reconstruction.saaxis.saaxis import SAAxisTask
20
20
  from tomwer.core.process.task import Task
21
21
  from tomwer.core.scan.scanfactory import ScanFactory
22
22
  from tomwer.core.utils.resource import increase_max_number_file
@@ -42,8 +42,14 @@ class SAAxisThread(qt.QThread):
42
42
  self._dump_roi = dump_roi
43
43
 
44
44
  def run(self) -> None:
45
- process = SAAxisProcess(process_id=None, inputs={"data": self.scan})
46
- process.set_configuration(self._configuration)
45
+ process = SAAxisTask(
46
+ process_id=None,
47
+ inputs={
48
+ "data": self.scan,
49
+ "sa_axis_params": self._configuration,
50
+ "serialize_output_data": False,
51
+ },
52
+ )
47
53
  process.dump_roi = self._dump_roi
48
54
  t0 = time.time()
49
55
  process.run()
@@ -51,9 +57,9 @@ class SAAxisThread(qt.QThread):
51
57
 
52
58
 
53
59
  class SAAxisWindow(_SAAxisWindow):
54
- def __init__(self, parent=None, dump_roi=False):
60
+ def __init__(self, parent=None, dump_roi=False, backend=None):
55
61
  self._scan = None
56
- super().__init__(parent)
62
+ super().__init__(parent, backend=backend)
57
63
  # thread for computing cors
58
64
  self._processingThread = SAAxisThread()
59
65
  self._processingThread.finished.connect(self._threadedProcessEnded)
@@ -120,10 +126,11 @@ class SAAxisWindow(_SAAxisWindow):
120
126
  scan = self.getScan()
121
127
  if scan is None:
122
128
  return
123
- _cor_estimation_process = AxisProcess(
129
+ _cor_estimation_process = AxisTask(
124
130
  inputs={
125
131
  "axis_params": self.getQAxisRP(),
126
132
  "data": scan,
133
+ "serialize_output_data": False,
127
134
  }
128
135
  )
129
136
 
@@ -187,6 +194,13 @@ def main(argv):
187
194
  default=False,
188
195
  help="Save roi where the score is computed on the .hdf5",
189
196
  )
197
+ parser.add_argument(
198
+ "--use-opengl-plot",
199
+ help="Use OpenGL for plots (instead of matplotlib)",
200
+ action="store_true",
201
+ default=False,
202
+ )
203
+
190
204
  options = parser.parse_args(argv[1:])
191
205
 
192
206
  if options.debug:
@@ -219,6 +233,11 @@ def main(argv):
219
233
  )
220
234
  requires_reduced_dark_and_flat(scan=scan, logger_=_logger)
221
235
 
236
+ if options.use_opengl_plot:
237
+ import silx
238
+
239
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
240
+
222
241
  window = SAAxisWindow(dump_roi=options.dump_roi)
223
242
  window.setWindowTitle("saaxis")
224
243
  window.setWindowIcon(icons.getQIcon("tomwer"))
@@ -261,7 +280,7 @@ def _load_latest_scores(scan) -> tuple:
261
280
  return scores, selected
262
281
 
263
282
  with EntryReader(scan.process_file_url) as h5f:
264
- latest_saaxis_node = Task.get_most_recent_process(h5f, SAAxisProcess)
283
+ latest_saaxis_node = Task.get_most_recent_process(h5f, SAAxisTask)
265
284
  if latest_saaxis_node and "results" in latest_saaxis_node:
266
285
  scores = core_utils.get_scores(latest_saaxis_node)
267
286
  if "center_of_rotation" in latest_saaxis_node["results"]:
tomwer/app/sadeltabeta.py CHANGED
@@ -12,12 +12,12 @@ from silx.gui import qt
12
12
  from silx.io.utils import h5py_read_dataset
13
13
 
14
14
  from tomwer.core.process import utils as core_utils
15
- from tomwer.core.process.reconstruction.axis.axis import AxisProcess, NoAxisUrl
15
+ from tomwer.core.process.reconstruction.axis.axis import AxisTask, NoAxisUrl
16
16
  from tomwer.core.process.reconstruction.darkref.darkrefs import (
17
17
  requires_reduced_dark_and_flat,
18
18
  )
19
19
  from tomwer.core.process.reconstruction.sadeltabeta.sadeltabeta import (
20
- SADeltaBetaProcess,
20
+ SADeltaBetaTask,
21
21
  )
22
22
  from tomwer.core.process.task import Task
23
23
  from tomwer.core.scan.scanfactory import ScanFactory
@@ -47,7 +47,13 @@ class SADeltaBetaThread(qt.QThread):
47
47
  self._dump_roi = dump_roi
48
48
 
49
49
  def run(self) -> None:
50
- process = SADeltaBetaProcess(process_id=None, inputs={"scan": self.scan})
50
+ process = SADeltaBetaTask(
51
+ process_id=None,
52
+ inputs={
53
+ "scan": self.scan,
54
+ "serialize_output_data": False,
55
+ },
56
+ )
51
57
  process.set_configuration(self._configuration)
52
58
  process.dump_roi = self._dump_roi
53
59
  t0 = time.time()
@@ -56,9 +62,9 @@ class SADeltaBetaThread(qt.QThread):
56
62
 
57
63
 
58
64
  class SADeltaBetaWindow(_SADeltaBetaWindow):
59
- def __init__(self, parent=None, dump_roi=False):
65
+ def __init__(self, parent=None, dump_roi=False, backend=None):
60
66
  self._scan = None
61
- super().__init__(parent)
67
+ super().__init__(parent, backend=backend)
62
68
  self._insert_cor_gui()
63
69
  # thread for computing cors
64
70
  self._processingThread = SADeltaBetaThread()
@@ -198,8 +204,12 @@ class SADeltaBetaWindow(_SADeltaBetaWindow):
198
204
  scan = self.getScan()
199
205
  if scan is None:
200
206
  return
201
- _cor_estimation_process = AxisProcess(
202
- inputs={"data": scan, "axis_params": self._qaxis_rp}
207
+ _cor_estimation_process = AxisTask(
208
+ inputs={
209
+ "data": scan,
210
+ "axis_params": self._qaxis_rp,
211
+ "serialize_output_data": False,
212
+ }
203
213
  )
204
214
 
205
215
  _logger.info(f"{scan} - start cor estimation for")
@@ -261,11 +271,22 @@ def main(argv):
261
271
  default=False,
262
272
  help="Save roi where the score is computed on the .hdf5",
263
273
  )
274
+ parser.add_argument(
275
+ "--use-opengl-plot",
276
+ help="Use OpenGL for plots (instead of matplotlib)",
277
+ action="store_true",
278
+ default=False,
279
+ )
264
280
  options = parser.parse_args(argv[1:])
265
281
 
266
282
  if options.debug:
267
283
  logging.root.setLevel(logging.DEBUG)
268
284
 
285
+ if options.use_opengl_plot:
286
+ import silx
287
+
288
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
289
+
269
290
  increase_max_number_file()
270
291
  scan = ScanFactory.create_scan_object(
271
292
  scan_path=options.scan_path, entry=options.entry
@@ -334,7 +355,7 @@ def _load_latest_scores(scan) -> tuple:
334
355
  return scores, selected
335
356
 
336
357
  with EntryReader(scan.process_file_url) as h5f:
337
- latest_sa_db_node = Task.get_most_recent_process(h5f, SADeltaBetaProcess)
358
+ latest_sa_db_node = Task.get_most_recent_process(h5f, SADeltaBetaTask)
338
359
  if latest_sa_db_node and "results" in latest_sa_db_node:
339
360
  scores = core_utils.get_scores(latest_sa_db_node)
340
361
  if "delta_beta" in latest_sa_db_node["results"]:
tomwer/app/samplemoved.py CHANGED
@@ -45,8 +45,19 @@ def main(argv):
45
45
  help="For Nexus files: entry in the master file",
46
46
  default=None,
47
47
  )
48
+ parser.add_argument(
49
+ "--use-opengl-plot",
50
+ help="Use OpenGL for plots (instead of matplotlib)",
51
+ action="store_true",
52
+ default=False,
53
+ )
48
54
  options = parser.parse_args(argv[1:])
49
55
 
56
+ if options.use_opengl_plot:
57
+ import silx
58
+
59
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
60
+
50
61
  increase_max_number_file()
51
62
 
52
63
  global app # QApplication must be global to avoid seg fault on quit
tomwer/app/scanviewer.py CHANGED
@@ -32,12 +32,24 @@ def main(argv):
32
32
  default=None,
33
33
  nargs="?",
34
34
  )
35
+ parser.add_argument(
36
+ "--use-opengl-plot",
37
+ help="Use OpenGL for plots (instead of matplotlib)",
38
+ action="store_true",
39
+ default=False,
40
+ )
35
41
 
36
42
  options = parser.parse_args(argv[1:])
37
43
 
38
44
  scan = ScanFactory.create_scan_object(
39
45
  scan_path=options.scan_path, entry=options.entry
40
46
  )
47
+
48
+ if options.use_opengl_plot:
49
+ import silx
50
+
51
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
52
+
41
53
  increase_max_number_file()
42
54
 
43
55
  global app # QApplication must be global to avoid seg fault on quit
@@ -62,9 +62,20 @@ def main(argv):
62
62
  help="You can define a subsampling to generate the sinogram in order"
63
63
  "to speed up creation",
64
64
  )
65
+ parser.add_argument(
66
+ "--use-opengl-plot",
67
+ help="Use OpenGL for plots (instead of matplotlib)",
68
+ action="store_true",
69
+ default=False,
70
+ )
65
71
 
66
72
  options = parser.parse_args(argv[1:])
67
73
 
74
+ if options.use_opengl_plot:
75
+ import silx
76
+
77
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
78
+
68
79
  scan = ScanFactory.create_scan_object(options.scan_path, entry=options.entry)
69
80
  increase_max_number_file()
70
81
 
tomwer/app/slicestack.py CHANGED
@@ -40,6 +40,12 @@ def main(argv):
40
40
  parser.add_argument(
41
41
  "root_dir", help="Root dir to browse and to extract all slices files under it."
42
42
  )
43
+ parser.add_argument(
44
+ "--use-opengl-plot",
45
+ help="Use OpenGL for plots (instead of matplotlib)",
46
+ action="store_true",
47
+ default=False,
48
+ )
43
49
  parser.add_argument(
44
50
  "--debug",
45
51
  dest="debug",
@@ -50,6 +56,11 @@ def main(argv):
50
56
 
51
57
  options = parser.parse_args(argv[1:])
52
58
 
59
+ if options.use_opengl_plot:
60
+ import silx
61
+
62
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
63
+
53
64
  increase_max_number_file()
54
65
 
55
66
  global app # QApplication must be global to avoid seg fault on quit
tomwer/app/zstitching.py CHANGED
@@ -107,6 +107,7 @@ class _StitcherThread(qt.QThread):
107
107
  "stitching_config": self._stitching_config,
108
108
  "cluster_config": self._cluster_config,
109
109
  "progress": Progress("stitching"),
110
+ "serialize_output_data": False,
110
111
  },
111
112
  )
112
113
 
@@ -220,9 +221,20 @@ def main(argv):
220
221
  default=None,
221
222
  help="Provide stitching configuration file to load parameters from it",
222
223
  )
224
+ parser.add_argument(
225
+ "--use-opengl-plot",
226
+ help="Use OpenGL for plots (instead of matplotlib)",
227
+ action="store_true",
228
+ default=False,
229
+ )
223
230
 
224
231
  options = parser.parse_args(argv[1:])
225
232
 
233
+ if options.use_opengl_plot:
234
+ import silx
235
+
236
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
237
+
226
238
  if options.debug:
227
239
  logging.root.setLevel(logging.DEBUG)
228
240
 
@@ -32,7 +32,7 @@ import datetime
32
32
  import logging
33
33
  from typing import Iterable, Optional, Union
34
34
 
35
- from sluurp.job import get_job_status
35
+ from sluurp.job import get_job_status, cancel_slurm_job
36
36
 
37
37
  from tomwer.core.scan.scanbase import TomwerScanBase
38
38
  from tomwer.core.tomwer_object import TomwerObject
@@ -180,4 +180,6 @@ class FutureTomwerObject:
180
180
 
181
181
  def cancel(self):
182
182
  for future in self.futures:
183
- future.cancel()
183
+ if hasattr(future, "job_id"):
184
+ print("cancel ", future.job_id)
185
+ cancel_slurm_job(future.job_id)
@@ -41,6 +41,8 @@ from tomwer.core.process.task import Task
41
41
  from tomwer.core.scan.scanbase import TomwerScanBase
42
42
  from tomwer.core.scan.scanfactory import ScanFactory
43
43
 
44
+ from silx.utils.deprecation import deprecated_warning
45
+
44
46
  _logger = logging.getLogger(__name__)
45
47
 
46
48
 
@@ -130,10 +132,16 @@ class UnixFileNamePatternFilter(_PatternBaseFilter):
130
132
  return not match
131
133
 
132
134
 
133
- class FileNameFilter(
134
- _PatternBaseFilter, Task, input_names=("data",), output_names=("data",)
135
+ class FileNameFilterTask(
136
+ _PatternBaseFilter,
137
+ Task,
138
+ input_names=("data", "pattern"),
139
+ output_names=("data",),
140
+ optional_input_names=("serialize_output_data",),
135
141
  ):
136
- """Filter than can call several filter type"""
142
+ """
143
+ Task to filter a scan according to his name and a 'unix file name pattern' or a 'regular expression'
144
+ """
137
145
 
138
146
  UNIX_PATTERN_FILTER = "unix file name pattern"
139
147
 
@@ -195,7 +203,7 @@ class FileNameFilter(
195
203
  assert isinstance(scan, TomwerScanBase)
196
204
 
197
205
  if not self.isFiltered(os.path.basename(scan.path)):
198
- if self._return_dict:
206
+ if self.get_input_value("serialize_output_data", True):
199
207
  self.outputs.data = scan.to_dict()
200
208
  else:
201
209
  self.outputs.data = scan
@@ -215,3 +223,17 @@ class FileNameFilter(
215
223
  def definition():
216
224
  """definition of the process"""
217
225
  return "filter a scan according to his name"
226
+
227
+
228
+ class FileNameFilter(FileNameFilterTask):
229
+ def __init__(
230
+ self, varinfo=None, inputs=None, node_id=None, node_attrs=None, execinfo=None
231
+ ):
232
+ deprecated_warning(
233
+ name="tomwer.core.process.conditions.filters.FileNameFilter",
234
+ type_="class",
235
+ reason="improve readibility",
236
+ since_version="1.2",
237
+ replacement="FileNameFilterTask",
238
+ )
239
+ super().__init__(varinfo, inputs, node_id, node_attrs, execinfo)
@@ -3,5 +3,9 @@ from tomwer.core.utils.scanutils import data_identifier_to_scan
3
3
 
4
4
 
5
5
  class _DataDiscoveryPlaceHolder(EwoksTask, input_names=["data"], output_names=["data"]):
6
+ """
7
+ Task to recursivly search under a root folder for any scan / data.
8
+ """
9
+
6
10
  def run(self):
7
11
  self.outputs.data = data_identifier_to_scan(self.inputs.data)
@@ -103,6 +103,10 @@ class _DataWatcher(BaseProcessInfo):
103
103
  self._setCurrentStatus("not processing")
104
104
  self._launchObservation()
105
105
  self._checkThread = None
106
+ self._serialize_output_data = False
107
+
108
+ def set_serialize_output_data(self, serialize: bool):
109
+ self._serialize_output_data = serialize
106
110
 
107
111
  def _launchObservation(self):
108
112
  """Main function of the widget"""
@@ -434,7 +438,7 @@ class DataWatcher(_DataWatcher):
434
438
  def _signalScanReady(self, scan):
435
439
  assert isinstance(scan, TomwerScanBase)
436
440
  super()._signalScanReady(scan)
437
- if self._return_dict:
441
+ if self._serialize_output_data:
438
442
  value = scan.to_dict()
439
443
  else:
440
444
  value = scan