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
tomwer/app/darkref.py CHANGED
@@ -1,181 +1,10 @@
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 tomwer.core.process.reconstruction.darkref.darkrefs import DarkRefs
10
- from tomwer.core.process.reconstruction.darkref.params import DKRFRP, ReduceMethod
11
- from tomwer.core.scan.scanfactory import ScanFactory
12
- from tomwer.core.utils.resource import increase_max_number_file
13
-
14
- logging.basicConfig(level=logging.WARNING)
15
- _logger = logging.getLogger(__name__)
16
-
17
-
18
- def getinputinfo():
19
- return "tomwer darkref [scanDir]"
20
-
21
-
22
- def _exec_without_interaction(scan, dark_method, flat_method, overwrite):
23
- recons_params = DKRFRP()
24
- recons_params.overwrite_dark = overwrite
25
- recons_params.overwrite_ref = overwrite
26
- recons_params.dark_calc_method = dark_method
27
- recons_params.flat_calc_method = flat_method
28
- dark_ref = DarkRefs(
29
- inputs={
30
- "data": scan,
31
- "dark_ref_params": recons_params,
32
- }
33
- )
34
- _logger.info(f"Start processing of {scan}")
35
- dark_ref.run()
36
- _logger.info(f"End processing of {scan}")
37
- return 0
38
-
39
-
40
- def _exec_with_interaction(scan, dark_method, flat_method, overwrite):
41
- from silx.gui import qt
42
-
43
- from tomwer.gui import icons
44
- from tomwer.gui.reconstruction.darkref.darkrefwidget import DarkRefWidget
45
- from tomwer.gui.utils.splashscreen import getMainSplashScreen
46
- from tomwer.synctools.darkref import QDKRFRP
47
-
48
- class _DarkRefWidgetRunnable(DarkRefWidget):
49
- sigScanReady = qt.Signal(str)
50
-
51
- def __init__(self, scan, parent=None):
52
- self.__scan = scan
53
- self.__darkref_rp = QDKRFRP()
54
- DarkRefWidget.__init__(self, parent=parent, reconsparams=self.__darkref_rp)
55
- buttonExec = qt.QPushButton("execute", parent=self)
56
- buttonExec.setAutoDefault(True)
57
- # needed to be used as an application to return end only when the
58
- # processing thread is needed
59
- self._forceSync = True
60
- self.layout().addWidget(buttonExec)
61
- buttonExec.pressed.connect(self._process)
62
- self.setWindowIcon(icons.getQIcon("tomwer"))
63
-
64
- def _process(self):
65
- process = DarkRefs(
66
- inputs={
67
- "data": self.__scan,
68
- "dark_ref_params": self.__darkref_rp,
69
- "force_sync": self._forceSync,
70
- }
71
- )
72
- process.run()
73
-
74
- def sigintHandler(*args):
75
- """Handler for the SIGINT signal."""
76
- qt.QApplication.quit()
77
-
78
- global app # QApplication must be global to avoid seg fault on quit
79
- app = qt.QApplication.instance() or qt.QApplication(["tomwer"])
80
-
81
- qt.QLocale.setDefault(qt.QLocale(qt.QLocale.English))
82
- qt.QLocale.setDefault(qt.QLocale.c())
83
- signal.signal(signal.SIGINT, sigintHandler)
84
- sys.excepthook = qt.exceptionHandler
85
-
86
- timer = qt.QTimer()
87
- timer.start(500)
88
- # Application have to wake up Python interpreter, else SIGINT is not
89
- # catched
90
- timer.timeout.connect(lambda: None)
91
-
92
- splash = getMainSplashScreen()
93
-
94
- widget = _DarkRefWidgetRunnable(scan)
95
- # set up
96
- widget.recons_params.overwrite_dark = overwrite
97
- widget.recons_params.overwrite_flat = overwrite
98
- widget.recons_params.dark_calc_method = dark_method
99
- widget.recons_params.flat_calc_method = flat_method
100
- splash.finish(widget)
101
- widget.show()
102
- return app.exec_()
103
-
104
-
105
- def main(argv):
106
- parser = argparse.ArgumentParser(description=__doc__)
107
- parser.add_argument(
108
- "scan_path", help="Data file to show (h5 file, edf files, spec files)"
109
- )
110
- parser.add_argument(
111
- "--entry",
112
- help="an entry can be specify in case of hdf5 the master file",
113
- default=None,
114
- )
115
- parser.add_argument(
116
- "--dark-method",
117
- help="Define the method to be used for computing dark",
118
- default=ReduceMethod.MEAN,
119
- )
120
- parser.add_argument(
121
- "--flat-method",
122
- help="Define the method to be used for computing flat",
123
- default=ReduceMethod.MEDIAN,
124
- )
125
- parser.add_argument(
126
- "--no-gui",
127
- help="Will run directly the dark and ref without any interaction",
128
- dest="run",
129
- action="store_true",
130
- default=False,
131
- )
132
- parser.add_argument(
133
- "--overwrite",
134
- dest="overwrite",
135
- action="store_true",
136
- default=False,
137
- help="Overwrite dark/flats if exists",
138
- )
139
- parser.add_argument(
140
- "--debug",
141
- dest="debug",
142
- action="store_true",
143
- default=False,
144
- help="Set logging system in debug mode",
145
- )
146
-
147
- options = parser.parse_args(argv[1:])
148
-
149
- if options.debug:
150
- logging.root.setLevel(logging.DEBUG)
151
-
152
- increase_max_number_file()
153
-
154
- scan = ScanFactory.create_scan_object(options.scan_path, entry=options.entry)
155
- scan.set_process_index_frm_tomwer_process_file()
156
-
157
- dark_method = ReduceMethod.from_value(options.dark_method)
158
- flat_method = ReduceMethod.from_value(options.flat_method)
159
-
160
- if options.run:
161
- exit(
162
- _exec_without_interaction(
163
- scan=scan,
164
- dark_method=dark_method,
165
- flat_method=flat_method,
166
- overwrite=options.overwrite,
167
- )
168
- )
169
- else:
170
- exit(
171
- _exec_with_interaction(
172
- scan=scan,
173
- dark_method=dark_method,
174
- flat_method=flat_method,
175
- overwrite=options.overwrite,
176
- )
177
- )
178
-
179
-
180
- if __name__ == "__main__":
181
- main(sys.argv)
1
+ from silx.utils.deprecation import deprecated_warning
2
+
3
+ deprecated_warning(
4
+ "module",
5
+ name="tomwer.app.darkref",
6
+ reason="Has been moved",
7
+ replacement="tomwer.app.reducedarkflat",
8
+ only_once=True,
9
+ )
10
+ from tomwer.app.reducedarkflat import * # noqa F401
@@ -1,131 +1,10 @@
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 nxtomomill.utils import add_dark_flat_nx_file
10
- from silx.gui import qt
11
-
12
- from tomwer.core.scan.scanfactory import ScanFactory
13
- from tomwer.core.utils.resource import increase_max_number_file
14
- from tomwer.gui import icons
15
- from tomwer.gui.edit.dkrfpatch import DarkRefPatchWidget
16
- from tomwer.gui.utils.splashscreen import getMainSplashScreen
17
-
18
- logging.basicConfig(level=logging.WARNING)
19
- _logger = logging.getLogger(__name__)
20
-
21
-
22
- class _DarkRefPatchDialog(qt.QDialog):
23
- def __init__(self, parent):
24
- qt.QDialog.__init__(self, parent)
25
- self._scan = None
26
- self.setLayout(qt.QVBoxLayout())
27
- self._mainWidget = DarkRefPatchWidget(self)
28
- self.layout().addWidget(self._mainWidget)
29
-
30
- # buttons
31
- types = qt.QDialogButtonBox.Ok
32
- self._buttons = qt.QDialogButtonBox(parent=self)
33
- self._buttons.setStandardButtons(types)
34
- self._buttons.button(qt.QDialogButtonBox.Ok).setText("Apply")
35
- self.layout().addWidget(self._buttons)
36
-
37
- # connect signal slot
38
- self._buttons.button(qt.QDialogButtonBox.Ok).clicked.connect(self._apply)
39
-
40
- def _apply(self):
41
- if self._scan is None:
42
- raise ValueError("Scan should be set before applying patch")
43
- url_sd = self._mainWidget.getStartDarkUrl()
44
- url_sf = self._mainWidget.getStartFlatUrl()
45
- url_ed = self._mainWidget.getEndDarkUrl()
46
- url_ef = self._mainWidget.getEndFlatUrl()
47
- add_dark_flat_nx_file(
48
- file_path=self._scan.master_file,
49
- entry=self._scan.entry,
50
- darks_start=url_sd,
51
- flats_start=url_sf,
52
- darks_end=url_ed,
53
- flats_end=url_ef,
54
- )
55
-
56
- def setScan(self, scan):
57
- self._scan = scan
58
-
59
-
60
- def main(argv):
61
- parser = argparse.ArgumentParser(description=__doc__)
62
- parser.add_argument(
63
- "scan_path",
64
- help="HDF5 - Nexus file path",
65
- default=None,
66
- )
67
- parser.add_argument("entry", help="NXTomo entry to load", default=None)
68
- parser.add_argument(
69
- "--debug",
70
- dest="debug",
71
- action="store_true",
72
- default=False,
73
- help="Set logging system in debug mode",
74
- )
75
-
76
- options = parser.parse_args(argv[1:])
77
-
78
- if options.debug:
79
- logging.root.setLevel(logging.DEBUG)
80
-
81
- increase_max_number_file()
82
-
83
- global app # QApplication must be global to avoid seg fault on quit
84
- app = qt.QApplication.instance() or qt.QApplication(["tomwer"])
85
- splash = getMainSplashScreen()
86
- qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
87
- qt.QApplication.processEvents()
88
-
89
- qt.QLocale.setDefault(qt.QLocale(qt.QLocale.English))
90
- qt.QLocale.setDefault(qt.QLocale.c())
91
- signal.signal(signal.SIGINT, sigintHandler)
92
- sys.excepthook = qt.exceptionHandler
93
-
94
- timer = qt.QTimer()
95
- timer.start(500)
96
- # Application have to wake up Python interpreter, else SIGINT is not
97
- # catch
98
- timer.timeout.connect(lambda: None)
99
-
100
- scan = ScanFactory.create_scan_object(
101
- scan_path=options.scan_path, entry=options.entry
102
- )
103
-
104
- # define the process_index is any tomwer_processes_existing
105
- scan.set_process_index_frm_tomwer_process_file()
106
-
107
- if options.debug:
108
- _logger.setLevel(logging.DEBUG)
109
-
110
- window = _DarkRefPatchDialog(parent=None)
111
- window.setScan(scan=scan)
112
- window.setWindowTitle("patch dark & flat")
113
- window.setWindowIcon(icons.getQIcon("tomwer"))
114
-
115
- splash.finish(window)
116
- window.show()
117
- qt.QApplication.restoreOverrideCursor()
118
- app.exec_()
119
-
120
-
121
- def getinputinfo():
122
- return "tomwer darkref-patch [scanDir]"
123
-
124
-
125
- def sigintHandler(*args):
126
- """Handler for the SIGINT signal."""
127
- qt.QApplication.quit()
128
-
129
-
130
- if __name__ == "__main__":
131
- main(sys.argv)
1
+ from silx.utils.deprecation import deprecated_warning
2
+
3
+ deprecated_warning(
4
+ "module",
5
+ name="tomwer.app.darkrefpatch",
6
+ reason="Has been moved",
7
+ replacement="tomwer.app.patchrawdarkflat",
8
+ only_once=True,
9
+ )
10
+ from tomwer.app.patchrawdarkflat import * # noqa F401
tomwer/app/diffframe.py CHANGED
@@ -40,6 +40,12 @@ def main(argv):
40
40
  )
41
41
  parser.add_argument("--second-scan", default=None, help="Second data files")
42
42
  parser.add_argument("--second-entry", default=None, help="Second entry")
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
  options = parser.parse_args(argv[1:])
44
50
  options.scan_path = options.scan_path.rstrip(os.path.sep)
45
51
 
@@ -75,6 +81,11 @@ def main(argv):
75
81
  else:
76
82
  scan_2 = None
77
83
 
84
+ if options.use_opengl_plot:
85
+ import silx
86
+
87
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
88
+
78
89
  # handle gui
79
90
  widget = DiffFrameViewer(parent=None)
80
91
  widget.addScan(scan_1)
@@ -6,12 +6,11 @@ import logging
6
6
  import signal
7
7
  import sys
8
8
 
9
- from nxtomomill.utils import change_image_key_control
10
9
  from silx.gui import qt
11
- from tomoscan.esrf.scan.hdf5scan import ImageKey
12
10
 
13
11
  from tomwer.core.scan.hdf5scan import HDF5TomoScan
14
12
  from tomwer.core.utils.resource import increase_max_number_file
13
+ from tomwer.core.process.edit.imagekeyeditor import ImageKeyEditorTask
15
14
  from tomwer.gui import icons
16
15
  from tomwer.gui.edit.imagekeyeditor import ImageKeyDialog as _ImageKeyDialog
17
16
  from tomwer.gui.utils.splashscreen import getMainSplashScreen
@@ -35,24 +34,18 @@ class ImageKeyDialog(_ImageKeyDialog):
35
34
  if not self._scan:
36
35
  raise ValueError("Scan should be set first")
37
36
 
38
- modifications = self.getModifications()
39
- image_keys_set = set(self.getModifications().values())
40
- image_keys_set = set(
41
- [ImageKey.from_value(image_key) for image_key in image_keys_set]
37
+ task = ImageKeyEditorTask(
38
+ inputs={
39
+ "data": self._scan,
40
+ "configuration": {"modifications": self.getModifications()},
41
+ }
42
42
  )
43
- for image_key_type in image_keys_set:
44
- frame_indexes_dict = dict(
45
- filter(lambda item: item[1] is image_key_type, modifications.items())
46
- )
47
- frame_indexes = tuple(frame_indexes_dict.keys())
48
- _logger.warning(f"will modify {frame_indexes} to {image_key_type}")
49
- change_image_key_control(
50
- file_path=self._scan.master_file,
51
- entry=self._scan.entry,
52
- frames_indexes=frame_indexes,
53
- image_key_control_value=image_key_type.value,
54
- logger=_logger,
55
- )
43
+ try:
44
+ task.run()
45
+ except Exception as e:
46
+ _logger.error(e)
47
+ else:
48
+ print("edition succeed")
56
49
 
57
50
 
58
51
  def getinputinfo():
@@ -51,6 +51,7 @@ class IntensityNormalizationThread(qt.QThread):
51
51
  inputs={
52
52
  "data": self.scan,
53
53
  "configuration": self._configuration,
54
+ "serialize_output_data": False,
54
55
  },
55
56
  varinfo=None,
56
57
  )
tomwer/app/lamino.py CHANGED
@@ -9,7 +9,7 @@ import sys
9
9
 
10
10
  from silx.gui import qt
11
11
 
12
- from tomwer.core.process.reconstruction.lamino.tofu import LaminoReconstruction
12
+ from tomwer.core.process.reconstruction.lamino.tofu import LaminoReconstructionTask
13
13
  from tomwer.core.scan.scanbase import TomwerScanBase
14
14
  from tomwer.core.scan.scanfactory import ScanFactory
15
15
  from tomwer.core.utils.resource import increase_max_number_file
@@ -115,7 +115,12 @@ class ToFuDialog(qt.QDialog):
115
115
  self.tofuWidget.setEnabled(False)
116
116
  qt.QApplication.processEvents()
117
117
  qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
118
- self._reconsProcess = LaminoReconstruction(inputs={"scan": self._scan})
118
+ self._reconsProcess = LaminoReconstructionTask(
119
+ inputs={
120
+ "scan": self._scan,
121
+ "serialize_output_data": False,
122
+ }
123
+ )
119
124
  self._reconsProcess.set_configuration(
120
125
  (preprocess_add_options, reco_add_options)
121
126
  )
@@ -0,0 +1,131 @@
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 nxtomomill.utils import add_dark_flat_nx_file
10
+ from silx.gui import qt
11
+
12
+ from tomwer.core.scan.scanfactory import ScanFactory
13
+ from tomwer.core.utils.resource import increase_max_number_file
14
+ from tomwer.gui import icons
15
+ from tomwer.gui.edit.dkrfpatch import DarkRefPatchWidget
16
+ from tomwer.gui.utils.splashscreen import getMainSplashScreen
17
+
18
+ logging.basicConfig(level=logging.WARNING)
19
+ _logger = logging.getLogger(__name__)
20
+
21
+
22
+ class _DarkRefPatchDialog(qt.QDialog):
23
+ def __init__(self, parent):
24
+ qt.QDialog.__init__(self, parent)
25
+ self._scan = None
26
+ self.setLayout(qt.QVBoxLayout())
27
+ self._mainWidget = DarkRefPatchWidget(self)
28
+ self.layout().addWidget(self._mainWidget)
29
+
30
+ # buttons
31
+ types = qt.QDialogButtonBox.Ok
32
+ self._buttons = qt.QDialogButtonBox(parent=self)
33
+ self._buttons.setStandardButtons(types)
34
+ self._buttons.button(qt.QDialogButtonBox.Ok).setText("Apply")
35
+ self.layout().addWidget(self._buttons)
36
+
37
+ # connect signal slot
38
+ self._buttons.button(qt.QDialogButtonBox.Ok).clicked.connect(self._apply)
39
+
40
+ def _apply(self):
41
+ if self._scan is None:
42
+ raise ValueError("Scan should be set before applying patch")
43
+ url_sd = self._mainWidget.getStartDarkUrl()
44
+ url_sf = self._mainWidget.getStartFlatUrl()
45
+ url_ed = self._mainWidget.getEndDarkUrl()
46
+ url_ef = self._mainWidget.getEndFlatUrl()
47
+ add_dark_flat_nx_file(
48
+ file_path=self._scan.master_file,
49
+ entry=self._scan.entry,
50
+ darks_start=url_sd,
51
+ flats_start=url_sf,
52
+ darks_end=url_ed,
53
+ flats_end=url_ef,
54
+ )
55
+
56
+ def setScan(self, scan):
57
+ self._scan = scan
58
+
59
+
60
+ def main(argv):
61
+ parser = argparse.ArgumentParser(description=__doc__)
62
+ parser.add_argument(
63
+ "scan_path",
64
+ help="HDF5 - Nexus file path",
65
+ default=None,
66
+ )
67
+ parser.add_argument("entry", help="NXTomo entry to load", default=None)
68
+ parser.add_argument(
69
+ "--debug",
70
+ dest="debug",
71
+ action="store_true",
72
+ default=False,
73
+ help="Set logging system in debug mode",
74
+ )
75
+
76
+ options = parser.parse_args(argv[1:])
77
+
78
+ if options.debug:
79
+ logging.root.setLevel(logging.DEBUG)
80
+
81
+ increase_max_number_file()
82
+
83
+ global app # QApplication must be global to avoid seg fault on quit
84
+ app = qt.QApplication.instance() or qt.QApplication(["tomwer"])
85
+ splash = getMainSplashScreen()
86
+ qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
87
+ qt.QApplication.processEvents()
88
+
89
+ qt.QLocale.setDefault(qt.QLocale(qt.QLocale.English))
90
+ qt.QLocale.setDefault(qt.QLocale.c())
91
+ signal.signal(signal.SIGINT, sigintHandler)
92
+ sys.excepthook = qt.exceptionHandler
93
+
94
+ timer = qt.QTimer()
95
+ timer.start(500)
96
+ # Application have to wake up Python interpreter, else SIGINT is not
97
+ # catch
98
+ timer.timeout.connect(lambda: None)
99
+
100
+ scan = ScanFactory.create_scan_object(
101
+ scan_path=options.scan_path, entry=options.entry
102
+ )
103
+
104
+ # define the process_index is any tomwer_processes_existing
105
+ scan.set_process_index_frm_tomwer_process_file()
106
+
107
+ if options.debug:
108
+ _logger.setLevel(logging.DEBUG)
109
+
110
+ window = _DarkRefPatchDialog(parent=None)
111
+ window.setScan(scan=scan)
112
+ window.setWindowTitle("patch dark & flat")
113
+ window.setWindowIcon(icons.getQIcon("tomwer"))
114
+
115
+ splash.finish(window)
116
+ window.show()
117
+ qt.QApplication.restoreOverrideCursor()
118
+ app.exec_()
119
+
120
+
121
+ def getinputinfo():
122
+ return "tomwer darkref-patch [scanDir]"
123
+
124
+
125
+ def sigintHandler(*args):
126
+ """Handler for the SIGINT signal."""
127
+ qt.QApplication.quit()
128
+
129
+
130
+ if __name__ == "__main__":
131
+ main(sys.argv)
tomwer/app/radiostack.py CHANGED
@@ -43,6 +43,12 @@ def main(argv):
43
43
  parser.add_argument(
44
44
  "root_dir", help="Root dir to browse and to extract all radio under it."
45
45
  )
46
+ parser.add_argument(
47
+ "--use-opengl-plot",
48
+ help="Use OpenGL for plots (instead of matplotlib)",
49
+ action="store_true",
50
+ default=False,
51
+ )
46
52
  parser.add_argument(
47
53
  "--debug",
48
54
  dest="debug",
@@ -54,6 +60,10 @@ def main(argv):
54
60
  increase_max_number_file()
55
61
 
56
62
  options = parser.parse_args(argv[1:])
63
+ if options.use_opengl_plot:
64
+ import silx
65
+
66
+ silx.config.DEFAULT_PLOT_BACKEND = "gl"
57
67
 
58
68
  global app # QApplication must be global to avoid seg fault on quit
59
69
  app = qt.QApplication.instance() or qt.QApplication(["tomwer"])