tomwer 1.3.5__py3-none-any.whl → 1.3.7__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.
- orangecontrib/tomwer/test/TestAcquisition.py +246 -0
- orangecontrib/tomwer/widgets/cluster/test/test_future_supervisorow.py +87 -0
- orangecontrib/tomwer/widgets/cluster/test/test_slurm_clusterow.py +67 -0
- orangecontrib/tomwer/widgets/control/test/test_advancement.py +51 -0
- orangecontrib/tomwer/widgets/control/test/test_data_validator.py +55 -0
- orangecontrib/tomwer/widgets/control/test/test_datadiscovery.py +131 -0
- orangecontrib/tomwer/widgets/control/test/test_datalist.py +70 -0
- orangecontrib/tomwer/widgets/control/test/test_datalistener.py +137 -0
- orangecontrib/tomwer/widgets/control/test/test_dataselector.py +95 -0
- orangecontrib/tomwer/widgets/control/test/test_datawatcher.py +436 -0
- orangecontrib/tomwer/widgets/control/test/test_emailow.py +29 -0
- orangecontrib/tomwer/widgets/control/test/test_notifier.py +51 -0
- orangecontrib/tomwer/widgets/control/test/test_nxtomo_concatenate_ow.py +64 -0
- orangecontrib/tomwer/widgets/control/test/test_nxtomomill.py +160 -0
- orangecontrib/tomwer/widgets/control/test/test_reduce_dark_flat_selector.py +40 -0
- orangecontrib/tomwer/widgets/control/test/test_singletomoobj.py +40 -0
- orangecontrib/tomwer/widgets/control/test/test_timerow.py +51 -0
- orangecontrib/tomwer/widgets/control/test/test_tomoobj_serie.py +96 -0
- orangecontrib/tomwer/widgets/control/test/test_volume_selector.py +69 -0
- orangecontrib/tomwer/widgets/control/test/test_volumesymlink.py +51 -0
- orangecontrib/tomwer/widgets/debugtools/test/test_dataset_generator.py +57 -0
- orangecontrib/tomwer/widgets/debugtools/test/test_object_inspector.py +62 -0
- orangecontrib/tomwer/widgets/other/test/test_pythonscript.py +31 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_axis.py +224 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_cast_volumeow.py +85 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_dark_refs_widget.py +136 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_delta_beta_selector.py +15 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_i_norm.py +226 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_helical_prepare_weights_double.py +20 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_volume.py +100 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_widget.py +107 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_sa_delta_beta.py +194 -0
- orangecontrib/tomwer/widgets/reconstruction/test/test_saaxis.py +220 -0
- orangecontrib/tomwer/widgets/stitching/test/test_zstitching.py +308 -0
- orangecontrib/tomwer/widgets/test/test_conditions.py +111 -0
- orangecontrib/tomwer/widgets/test/test_darkref.py +251 -0
- orangecontrib/tomwer/widgets/test/test_foldertransfert.py +131 -0
- orangecontrib/tomwer/widgets/visualization/test/test_dataviewerow.py +83 -0
- orangecontrib/tomwer/widgets/visualization/test/test_diffviewerow.py +65 -0
- orangecontrib/tomwer/widgets/visualization/test/test_live_sliceow.py +63 -0
- orangecontrib/tomwer/widgets/visualization/test/test_nxtomo_metadata_viewer.py +29 -0
- orangecontrib/tomwer/widgets/visualization/test/test_radio_stackow.py +56 -0
- orangecontrib/tomwer/widgets/visualization/test/test_sample_movedow.py +72 -0
- orangecontrib/tomwer/widgets/visualization/test/test_sinogram_viewerow.py +56 -0
- orangecontrib/tomwer/widgets/visualization/test/test_slice_stackow.py +57 -0
- orangecontrib/tomwer/widgets/visualization/test/test_volume_viewerow.py +57 -0
- tomwer/core/log/test/test_processlog.py +41 -0
- tomwer/core/process/control/datalistener/datalistener.py +11 -11
- tomwer/core/process/edit/test/test_darkflatpatch.py +269 -0
- tomwer/core/process/edit/test/test_imagekey_editor.py +125 -0
- tomwer/core/process/icat/test/test_create_screenshots.py +98 -0
- tomwer/core/process/icat/test/test_gallery.py +170 -0
- tomwer/core/process/reconstruction/axis/axis.py +3 -3
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +3 -2
- tomwer/core/process/reconstruction/nabu/nabucommon.py +3 -4
- tomwer/core/process/reconstruction/nabu/nabuslices.py +4 -4
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +2 -5
- tomwer/core/process/reconstruction/nabu/test/test_castvolume.py +143 -0
- tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +203 -0
- tomwer/core/process/reconstruction/nabu/test/test_nabunormalization.py +222 -0
- tomwer/core/process/script/test/test_script.py +68 -0
- tomwer/core/process/stitching/test/test_metadataholder.py +17 -0
- tomwer/core/process/task.py +3 -2
- tomwer/core/process/test/test_data_transfer.py +4 -3
- tomwer/core/process/visualization/test/test_data_viewer.py +39 -0
- tomwer/core/process/visualization/test/test_diff_viewer.py +39 -0
- tomwer/core/process/visualization/test/test_image_stack_viewer.py +41 -0
- tomwer/core/process/visualization/test/test_radio_stack.py +39 -0
- tomwer/core/process/visualization/test/test_sample_moved.py +41 -0
- tomwer/core/process/visualization/test/test_sinogram_viewer.py +39 -0
- tomwer/core/process/visualization/test/test_slice_stack.py +39 -0
- tomwer/core/process/visualization/test/test_volume_viewer.py +39 -0
- tomwer/core/scan/blissscan.py +3 -3
- tomwer/core/scan/nxtomoscan.py +2 -2
- tomwer/core/scan/scanbase.py +5 -6
- tomwer/core/utils/test/test_image.py +30 -0
- tomwer/core/utils/test/test_nxtomo.py +66 -0
- tomwer/core/utils/test/test_scan_utils.py +46 -0
- tomwer/core/utils/test/test_time.py +6 -0
- tomwer/core/volume/test/test_volumes.py +21 -0
- tomwer/gui/control/reducedarkflatselector.py +2 -2
- tomwer/gui/control/serie/test/test_creator.py +451 -0
- tomwer/gui/control/serie/test/test_nxtomo_concatenate.py +21 -0
- tomwer/gui/edit/dkrfpatch.py +4 -4
- tomwer/gui/edit/nxtomowarmer.py +3 -2
- tomwer/gui/icat/test/test_create_screenshots_gui.py +23 -0
- tomwer/gui/icat/test/test_gallery_gui.py +37 -0
- tomwer/gui/imagefromfile.py +2 -2
- tomwer/gui/reconstruction/nabu/test/test_check.py +92 -0
- tomwer/gui/reconstruction/nabu/test/test_ctf.py +46 -0
- tomwer/gui/reconstruction/nabu/test/test_helical.py +21 -0
- tomwer/gui/reconstruction/nabu/test/test_nabu_preprocessing.py +81 -0
- tomwer/gui/reconstruction/normalization/test/test_intensity.py +119 -0
- tomwer/gui/stitching/config/tests/test_axisparams.py +25 -0
- tomwer/gui/stitching/tests/test_axis_ordered_list.py +21 -0
- tomwer/gui/stitching/tests/test_normalization.py +27 -0
- tomwer/gui/stitching/tests/test_preview.py +85 -0
- tomwer/gui/stitching/tests/test_stitching_raw.py +110 -0
- tomwer/gui/stitching/tests/test_z_stitching.py +67 -0
- tomwer/gui/stitching/tests/utils.py +79 -0
- tomwer/gui/stitching/z_stitching/tests/test_fine_estimation.py +35 -0
- tomwer/gui/stitching/z_stitching/tests/test_raw_estimation.py +215 -0
- tomwer/gui/stitching/z_stitching/tests/test_stitching_window.py +51 -0
- tomwer/gui/utils/test/test_completer.py +67 -0
- tomwer/gui/utils/test/test_line_selector.py +21 -0
- tomwer/gui/utils/test/test_splashscreen.py +8 -0
- tomwer/gui/utils/test/test_vignettes.py +68 -0
- tomwer/io/utils/h5pyutils.py +3 -7
- tomwer/io/utils/test/test_raw_and_processed_data.py +10 -0
- tomwer/io/utils/test/test_utils.py +92 -0
- tomwer/io/utils/utils.py +3 -3
- tomwer/synctools/stacks/reconstruction/castvolume.py +20 -5
- tomwer/tests/test_ewoks/test_conversion.py +104 -0
- tomwer/tests/test_ewoks/test_single_node_execution.py +112 -0
- tomwer/tests/test_ewoks/test_workflows.py +160 -0
- tomwer/version.py +1 -1
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/METADATA +1 -1
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/RECORD +124 -27
- /tomwer-1.3.5-py3.11-nspkg.pth → /tomwer-1.3.7-py3.11-nspkg.pth +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/LICENSE +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/WHEEL +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/entry_points.txt +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.3.5.dist-info → tomwer-1.3.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,436 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
__authors__ = ["H. Payno"]
|
26
|
+
__license__ = "MIT"
|
27
|
+
__date__ = "17/01/2017"
|
28
|
+
|
29
|
+
import gc
|
30
|
+
import logging
|
31
|
+
import os
|
32
|
+
import shutil
|
33
|
+
import tempfile
|
34
|
+
import time
|
35
|
+
from time import sleep
|
36
|
+
|
37
|
+
from silx.gui import qt
|
38
|
+
from silx.gui.utils.testutils import SignalListener, TestCaseQt
|
39
|
+
|
40
|
+
from orangecontrib.tomwer.test.TestAcquisition import Simulation
|
41
|
+
from orangecontrib.tomwer.widgets.control.DataWatcherOW import DataWatcherOW
|
42
|
+
from tomwer.core.process.control.datawatcher import status as datawatcherstatus
|
43
|
+
from tomwer.core.utils.scanutils import MockBlissAcquisition, MockNXtomo
|
44
|
+
|
45
|
+
logging.disable(logging.INFO)
|
46
|
+
|
47
|
+
|
48
|
+
class DataWatcherWaiter(TestCaseQt):
|
49
|
+
"""Define a simple objecy able to wait for some state of the DataWatcher
|
50
|
+
arrive"""
|
51
|
+
|
52
|
+
def __init__(self, *args, **kwargs):
|
53
|
+
super().__init__(*args, **kwargs)
|
54
|
+
self.reset()
|
55
|
+
self.lastStatus = []
|
56
|
+
|
57
|
+
def tearDown(self):
|
58
|
+
pass
|
59
|
+
|
60
|
+
def reset(self):
|
61
|
+
self.lastStatus = []
|
62
|
+
|
63
|
+
def stateHasChanged(self, val):
|
64
|
+
"""Register all status"""
|
65
|
+
if val not in self.lastStatus:
|
66
|
+
self.lastStatus.append(val)
|
67
|
+
|
68
|
+
def waitForState(self, state, maxWaiting):
|
69
|
+
"""simple function wich wait until the DataWatcherWidget reach the given
|
70
|
+
state.
|
71
|
+
If the widget doesn't reach this state after maxWaiting second. Then fail.
|
72
|
+
|
73
|
+
:param str state: the state we are waiting for
|
74
|
+
:param int maxWaiting: the maximal number of second to wait until failling.
|
75
|
+
"""
|
76
|
+
while state not in self.lastStatus:
|
77
|
+
time.sleep(1.0)
|
78
|
+
self.qapp.processEvents()
|
79
|
+
maxWaiting -= 1
|
80
|
+
if maxWaiting <= 0:
|
81
|
+
return False
|
82
|
+
return state in self.lastStatus
|
83
|
+
|
84
|
+
|
85
|
+
class TestDataWatcherAcquisition(DataWatcherWaiter):
|
86
|
+
"""Functions testing the classical behavior of data watcher
|
87
|
+
- signal acquisition is over only when all files are copied
|
88
|
+
"""
|
89
|
+
|
90
|
+
def tearDown(self):
|
91
|
+
while self.qapp.hasPendingEvents():
|
92
|
+
self.qapp.processEvents()
|
93
|
+
self.dataWatcherWidget.setObservation(False)
|
94
|
+
self.dataWatcherWidget.close()
|
95
|
+
del self.dataWatcherWidget
|
96
|
+
self.dataWatcherWidget = None
|
97
|
+
self.s.wait()
|
98
|
+
del self.s
|
99
|
+
if os.path.isdir(self.inputdir):
|
100
|
+
shutil.rmtree(self.inputdir)
|
101
|
+
gc.collect()
|
102
|
+
super().tearDown()
|
103
|
+
|
104
|
+
def setUp(self):
|
105
|
+
self.manipulationId = "test10"
|
106
|
+
|
107
|
+
super().setUp()
|
108
|
+
self.inputdir = tempfile.mkdtemp()
|
109
|
+
DataWatcherWaiter.reset(self)
|
110
|
+
self.dataWatcherWidget = DataWatcherOW(displayAdvancement=False)
|
111
|
+
self.dataWatcherWidget.srcPattern = ""
|
112
|
+
self.dataWatcherWidget.sigTMStatusChanged.connect(self.stateHasChanged)
|
113
|
+
self.dataWatcherWidget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
114
|
+
|
115
|
+
self.s = Simulation(
|
116
|
+
self.inputdir,
|
117
|
+
self.manipulationId,
|
118
|
+
finalState=Simulation.advancement["acquisitionRunning"],
|
119
|
+
)
|
120
|
+
|
121
|
+
def testStartAcquisition(self):
|
122
|
+
"""Make sure the data watch detect the acquisition of started"""
|
123
|
+
observeDir = os.path.join(self.inputdir, self.manipulationId)
|
124
|
+
for folder in (self.inputdir, observeDir):
|
125
|
+
if not os.path.exists(folder):
|
126
|
+
os.makedirs(folder)
|
127
|
+
|
128
|
+
self.assertTrue(os.path.isdir(observeDir))
|
129
|
+
|
130
|
+
self.s.createFinalXML(True)
|
131
|
+
self.dataWatcherWidget.setFolderObserved(observeDir)
|
132
|
+
|
133
|
+
self.assertTrue(self.dataWatcherWidget.currentStatus == "not processing")
|
134
|
+
self.s.start()
|
135
|
+
self.s.advanceTo("acquisitionDone")
|
136
|
+
self.s.start()
|
137
|
+
self.s.wait()
|
138
|
+
self.dataWatcherWidget.startObservation()
|
139
|
+
self.dataWatcherWidget._widget.observationThread.wait()
|
140
|
+
self.dataWatcherWidget._widget.observationThread.observations.dict[
|
141
|
+
observeDir
|
142
|
+
].wait()
|
143
|
+
self.qapp.processEvents()
|
144
|
+
finishedAcqui = (
|
145
|
+
self.dataWatcherWidget._widget.observationThread.observations.ignoredFolders
|
146
|
+
)
|
147
|
+
self.qapp.processEvents()
|
148
|
+
self.assertTrue(observeDir in finishedAcqui)
|
149
|
+
|
150
|
+
|
151
|
+
class TestDataWatcherInteraction(TestCaseQt):
|
152
|
+
"""Simple unit test to test the start/stop observation button action"""
|
153
|
+
|
154
|
+
def setUp(self):
|
155
|
+
super().setUp()
|
156
|
+
self.inputdir = tempfile.mkdtemp()
|
157
|
+
self.dataWatcherWidget = DataWatcherOW(displayAdvancement=False)
|
158
|
+
self.dataWatcherWidget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
159
|
+
self.dataWatcherWidget.srcPattern = ""
|
160
|
+
|
161
|
+
def tearDown(self):
|
162
|
+
while self.qapp.hasPendingEvents():
|
163
|
+
self.qapp.processEvents()
|
164
|
+
self.dataWatcherWidget.close()
|
165
|
+
del self.dataWatcherWidget
|
166
|
+
if os.path.isdir(self.inputdir):
|
167
|
+
shutil.rmtree(self.inputdir)
|
168
|
+
gc.collect()
|
169
|
+
|
170
|
+
def testStartAndStopAcquisition(self):
|
171
|
+
"""test multiple start and stop action on the start observation to
|
172
|
+
make sure no crash are appearing
|
173
|
+
"""
|
174
|
+
try:
|
175
|
+
self.dataWatcherWidget.setFolderObserved(self.inputdir)
|
176
|
+
self.dataWatcherWidget.show()
|
177
|
+
self.dataWatcherWidget.setObservation(True)
|
178
|
+
for _ in range(5):
|
179
|
+
self.dataWatcherWidget._widget._qpbstartstop.pressed.emit()
|
180
|
+
self.assertTrue(True)
|
181
|
+
except Exception:
|
182
|
+
self.assertTrue(False)
|
183
|
+
|
184
|
+
|
185
|
+
class WaitForXMLOption(DataWatcherWaiter):
|
186
|
+
"""test the behavior of datawatcher when the option 'wait for xml copy'
|
187
|
+
Basically in this case DataWatcherDirObserver will wait until an .xml
|
188
|
+
arrived
|
189
|
+
"""
|
190
|
+
|
191
|
+
@classmethod
|
192
|
+
def setUpClass(cls):
|
193
|
+
cls.dataWatcherWidget = DataWatcherOW(displayAdvancement=False)
|
194
|
+
cls.dataWatcherWidget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
195
|
+
cls.dataWatcherWidget.obsMethod = datawatcherstatus.DET_END_XML
|
196
|
+
cls.dataWatcherWidget.srcPattern = ""
|
197
|
+
cls.manipulationId = "test10"
|
198
|
+
super().setUpClass()
|
199
|
+
|
200
|
+
def setUp(self):
|
201
|
+
self.inputdir = tempfile.mkdtemp()
|
202
|
+
self.reset()
|
203
|
+
self.dataWatcherWidget.setObservation(False)
|
204
|
+
self.dataWatcherWidget.resetStatus()
|
205
|
+
super().setUp()
|
206
|
+
|
207
|
+
def tearDown(self):
|
208
|
+
while self.qapp.hasPendingEvents():
|
209
|
+
self.qapp.processEvents()
|
210
|
+
if os.path.isdir(self.inputdir):
|
211
|
+
shutil.rmtree(self.inputdir)
|
212
|
+
gc.collect()
|
213
|
+
super().tearDown()
|
214
|
+
|
215
|
+
@classmethod
|
216
|
+
def tearDownClass(cls):
|
217
|
+
cls.dataWatcherWidget.close()
|
218
|
+
del cls.dataWatcherWidget
|
219
|
+
if hasattr(cls, "s"):
|
220
|
+
cls.s.quit()
|
221
|
+
del cls.s
|
222
|
+
super().tearDownClass()
|
223
|
+
|
224
|
+
def testAcquistionNotEnding(self):
|
225
|
+
"""Check behavior if an acquisition never end"""
|
226
|
+
observeDir = os.path.join(self.inputdir, self.manipulationId)
|
227
|
+
for folder in (self.inputdir, observeDir):
|
228
|
+
if not os.path.exists(folder):
|
229
|
+
os.makedirs(folder)
|
230
|
+
|
231
|
+
self.assertTrue(os.path.isdir(observeDir))
|
232
|
+
|
233
|
+
self.s = Simulation(
|
234
|
+
self.inputdir,
|
235
|
+
self.manipulationId,
|
236
|
+
finalState=Simulation.advancement["acquisitionRunning"],
|
237
|
+
)
|
238
|
+
self.dataWatcherWidget.setFolderObserved(observeDir)
|
239
|
+
self.dataWatcherWidget.show()
|
240
|
+
self.dataWatcherWidget.sigTMStatusChanged.connect(self.stateHasChanged)
|
241
|
+
|
242
|
+
self.assertTrue(self.dataWatcherWidget.currentStatus == "not processing")
|
243
|
+
self.s.start()
|
244
|
+
self.s.wait()
|
245
|
+
self.dataWatcherWidget.setObservation(True)
|
246
|
+
self.dataWatcherWidget._widget.observationThread.wait()
|
247
|
+
self.dataWatcherWidget._widget.observationThread.observations.dict[
|
248
|
+
observeDir
|
249
|
+
].wait()
|
250
|
+
finishedAcqui = (
|
251
|
+
self.dataWatcherWidget._widget.observationThread.observations.ignoredFolders
|
252
|
+
)
|
253
|
+
self.qapp.processEvents()
|
254
|
+
self.assertFalse(observeDir in finishedAcqui)
|
255
|
+
|
256
|
+
def testAcquistionEnded(self):
|
257
|
+
"""Check behavior if an acquisition is ending"""
|
258
|
+
manipulationId = "test10"
|
259
|
+
observeDir = os.path.join(self.inputdir, self.manipulationId)
|
260
|
+
for folder in (self.inputdir, observeDir):
|
261
|
+
if not os.path.exists(folder):
|
262
|
+
os.makedirs(folder)
|
263
|
+
|
264
|
+
self.assertTrue(os.path.isdir(observeDir))
|
265
|
+
|
266
|
+
self.s = Simulation(
|
267
|
+
self.inputdir,
|
268
|
+
manipulationId,
|
269
|
+
finalState=Simulation.advancement["acquisitionDone"],
|
270
|
+
)
|
271
|
+
self.s.createFinalXML(True)
|
272
|
+
self.dataWatcherWidget.setFolderObserved(observeDir)
|
273
|
+
self.dataWatcherWidget.show()
|
274
|
+
self.dataWatcherWidget.sigTMStatusChanged.connect(self.stateHasChanged)
|
275
|
+
|
276
|
+
self.assertTrue(self.dataWatcherWidget.currentStatus == "not processing")
|
277
|
+
self.s.start()
|
278
|
+
self.s.wait()
|
279
|
+
self.dataWatcherWidget.setObservation(True)
|
280
|
+
self.dataWatcherWidget._widget.observationThread.wait()
|
281
|
+
self.dataWatcherWidget._widget.observationThread.observations.dict[
|
282
|
+
observeDir
|
283
|
+
].wait()
|
284
|
+
finishedAcqui = (
|
285
|
+
self.dataWatcherWidget._widget.observationThread.observations.ignoredFolders
|
286
|
+
)
|
287
|
+
self.qapp.processEvents()
|
288
|
+
self.assertTrue(observeDir in finishedAcqui)
|
289
|
+
|
290
|
+
|
291
|
+
class TestRSync(DataWatcherWaiter):
|
292
|
+
"""test that the synchronization using RSyncManager is working"""
|
293
|
+
|
294
|
+
def setUp(self):
|
295
|
+
super().setUp()
|
296
|
+
self.inputdir = tempfile.mkdtemp()
|
297
|
+
self.outputdir = tempfile.mkdtemp()
|
298
|
+
DataWatcherWaiter.reset(self)
|
299
|
+
self.dataWatcherWidget = DataWatcherOW(displayAdvancement=False)
|
300
|
+
self.dataWatcherWidget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
301
|
+
self.dataWatcherWidget._widget.setSrcAndDestPattern(
|
302
|
+
self.inputdir, self.outputdir
|
303
|
+
)
|
304
|
+
|
305
|
+
def tearDown(self):
|
306
|
+
while self.qapp.hasPendingEvents():
|
307
|
+
self.qapp.processEvents()
|
308
|
+
self.dataWatcherWidget.close()
|
309
|
+
del self.dataWatcherWidget
|
310
|
+
if hasattr(self, "s"):
|
311
|
+
self.s.quit()
|
312
|
+
del self.s
|
313
|
+
super(TestRSync, self).tearDown()
|
314
|
+
for d in (self.inputdir, self.outputdir):
|
315
|
+
if os.path.isdir(d):
|
316
|
+
shutil.rmtree(d, ignore_errors=True)
|
317
|
+
gc.collect()
|
318
|
+
|
319
|
+
def testStartAcquisition(self):
|
320
|
+
"""Test that rsync is launched when an acquisition is discovered"""
|
321
|
+
manipulationId = "test10"
|
322
|
+
observeDir = os.path.join(self.inputdir, manipulationId)
|
323
|
+
for folder in (self.inputdir, observeDir):
|
324
|
+
if not os.path.exists(folder):
|
325
|
+
os.makedirs(folder)
|
326
|
+
|
327
|
+
self.assertTrue(os.path.isdir(observeDir))
|
328
|
+
|
329
|
+
self.s = Simulation(
|
330
|
+
self.inputdir,
|
331
|
+
manipulationId,
|
332
|
+
finalState=Simulation.advancement["acquisitionRunning"],
|
333
|
+
)
|
334
|
+
|
335
|
+
self.s.setSrcDestPatterns(self.inputdir, self.outputdir)
|
336
|
+
self.s.createFinalXML(True)
|
337
|
+
self.dataWatcherWidget.setFolderObserved(self.inputdir)
|
338
|
+
self.dataWatcherWidget.show()
|
339
|
+
self.dataWatcherWidget.sigTMStatusChanged.connect(self.stateHasChanged)
|
340
|
+
self.assertTrue(self.dataWatcherWidget.currentStatus == "not processing")
|
341
|
+
self.dataWatcherWidget.setObservation(True)
|
342
|
+
self.s.start()
|
343
|
+
# check state scanning
|
344
|
+
time.sleep(0.5)
|
345
|
+
|
346
|
+
self.dataWatcherWidget.stopObservation()
|
347
|
+
|
348
|
+
# in this case the .info should be in the output dir also
|
349
|
+
test10_output = os.path.join(self.outputdir, "test10")
|
350
|
+
test10_input = os.path.join(self.inputdir, "test10")
|
351
|
+
self.assertTrue(os.path.isfile(os.path.join(test10_output, "test10.info")))
|
352
|
+
|
353
|
+
# make sure file transfert have been started (using rsync)
|
354
|
+
# all file in outputdir should be in input dir
|
355
|
+
time.sleep(2)
|
356
|
+
# check that some .edf file have already been copied
|
357
|
+
self.assertTrue(len(test10_output) > 5)
|
358
|
+
|
359
|
+
# xml shouldn't be there because we are righting it at the end
|
360
|
+
self.assertFalse(os.path.isfile(os.path.join(test10_output, "test10.xml")))
|
361
|
+
self.assertFalse(os.path.isfile(os.path.join(test10_input, "test10.xml")))
|
362
|
+
|
363
|
+
|
364
|
+
class TestDataWatcherBlissScan(TestCaseQt):
|
365
|
+
def setUp(self):
|
366
|
+
self._widget = DataWatcherOW(self)
|
367
|
+
self.tempdir = tempfile.mkdtemp()
|
368
|
+
MockBlissAcquisition(
|
369
|
+
n_sample=1,
|
370
|
+
n_sequence=1,
|
371
|
+
n_scan_per_sequence=3,
|
372
|
+
n_darks=2,
|
373
|
+
n_flats=2,
|
374
|
+
output_dir=os.path.join(self.tempdir, "folder_1"),
|
375
|
+
)
|
376
|
+
|
377
|
+
MockBlissAcquisition(
|
378
|
+
n_sample=2,
|
379
|
+
n_sequence=1,
|
380
|
+
n_scan_per_sequence=3,
|
381
|
+
n_darks=2,
|
382
|
+
n_flats=2,
|
383
|
+
output_dir=os.path.join(self.tempdir, "test", "with", "some", "depth"),
|
384
|
+
)
|
385
|
+
self._listener = SignalListener()
|
386
|
+
self._widget._widget.sigScanReady.connect(self._listener)
|
387
|
+
|
388
|
+
def tearDown(self):
|
389
|
+
self._widget._widget.sigScanReady.disconnect(self._listener)
|
390
|
+
self._widget.stopObservation()
|
391
|
+
self._listener = None
|
392
|
+
shutil.rmtree(self.tempdir)
|
393
|
+
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
394
|
+
self._widget.close()
|
395
|
+
self._widget = None
|
396
|
+
gc.collect()
|
397
|
+
|
398
|
+
|
399
|
+
class TestDataWatcherNXtomo(TestCaseQt):
|
400
|
+
def setUp(self):
|
401
|
+
self._widget = DataWatcherOW(self)
|
402
|
+
self.tempdir = tempfile.mkdtemp()
|
403
|
+
MockNXtomo(
|
404
|
+
scan_path=os.path.join(self.tempdir, "folder_1"),
|
405
|
+
n_proj=10,
|
406
|
+
)
|
407
|
+
|
408
|
+
MockNXtomo(
|
409
|
+
scan_path=os.path.join(self.tempdir, "test", "with", "some", "depth"),
|
410
|
+
n_proj=10,
|
411
|
+
)
|
412
|
+
self._listener = SignalListener()
|
413
|
+
self._widget._widget.sigScanReady.connect(self._listener)
|
414
|
+
|
415
|
+
def tearDown(self):
|
416
|
+
self._widget._widget.sigScanReady.disconnect(self._listener)
|
417
|
+
self._widget.stopObservation()
|
418
|
+
self._listener = None
|
419
|
+
shutil.rmtree(self.tempdir)
|
420
|
+
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
421
|
+
self._widget.close()
|
422
|
+
self._widget = None
|
423
|
+
gc.collect()
|
424
|
+
|
425
|
+
def test(self):
|
426
|
+
self._widget.setFolderObserved(self.tempdir)
|
427
|
+
self._widget._widget.getConfigWindow().setMode((datawatcherstatus.NXtomo_END,))
|
428
|
+
self._widget.show()
|
429
|
+
self._widget.startObservation()
|
430
|
+
processing_time = 2
|
431
|
+
sleep_time = 0.005
|
432
|
+
while processing_time > 0:
|
433
|
+
self.qapp.processEvents()
|
434
|
+
sleep(sleep_time)
|
435
|
+
processing_time -= sleep_time
|
436
|
+
assert self._listener.callCount() == 2
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import gc
|
2
|
+
import pickle
|
3
|
+
|
4
|
+
from silx.gui import qt
|
5
|
+
from silx.gui.utils.testutils import TestCaseQt
|
6
|
+
|
7
|
+
from orangecontrib.tomwer.widgets.control.EmailOW import EmailOW
|
8
|
+
from orangecanvas.scheme.readwrite import literal_dumps
|
9
|
+
|
10
|
+
|
11
|
+
class TestEmailOW(TestCaseQt):
|
12
|
+
def setUp(self):
|
13
|
+
super().setUp()
|
14
|
+
self.widget = EmailOW()
|
15
|
+
|
16
|
+
def tearDown(self):
|
17
|
+
self.widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
18
|
+
self.widget.close()
|
19
|
+
self.widget = None
|
20
|
+
gc.collect()
|
21
|
+
|
22
|
+
def test(self):
|
23
|
+
self.widget.show()
|
24
|
+
|
25
|
+
def test_serializing(self):
|
26
|
+
pickle.dumps(self.widget.getConfiguration())
|
27
|
+
|
28
|
+
def test_literal_dumps(self):
|
29
|
+
literal_dumps(self.widget.getConfiguration())
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# /*##########################################################################
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2021 European Synchrotron Radiation Facility
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# ###########################################################################*/
|
25
|
+
|
26
|
+
__authors__ = ["H. Payno"]
|
27
|
+
__license__ = "MIT"
|
28
|
+
__date__ = "17/06/2021"
|
29
|
+
|
30
|
+
|
31
|
+
import gc
|
32
|
+
|
33
|
+
from silx.gui import qt
|
34
|
+
from silx.gui.utils.testutils import TestCaseQt
|
35
|
+
|
36
|
+
from orangecontrib.tomwer.widgets.control.NotifierOW import NotifierWidgetOW
|
37
|
+
|
38
|
+
|
39
|
+
class TestTimerOW(TestCaseQt):
|
40
|
+
def setUp(self):
|
41
|
+
super().setUp()
|
42
|
+
self.widget = NotifierWidgetOW()
|
43
|
+
|
44
|
+
def tearDown(self):
|
45
|
+
self.widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
46
|
+
self.widget.close()
|
47
|
+
self.widget = None
|
48
|
+
gc.collect()
|
49
|
+
|
50
|
+
def test(self):
|
51
|
+
self.widget.show()
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import os
|
2
|
+
from tomoscan.serie import Serie
|
3
|
+
import pickle
|
4
|
+
|
5
|
+
from ewoksorange.bindings.qtapp import QtEvent
|
6
|
+
|
7
|
+
from orangecanvas.scheme.readwrite import literal_dumps
|
8
|
+
|
9
|
+
from tomwer.tests.conftest import qtapp # noqa F401
|
10
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
11
|
+
|
12
|
+
from orangecontrib.tomwer.widgets.control.NXtomoConcatenate import NXtomoConcatenateOW
|
13
|
+
|
14
|
+
|
15
|
+
def test_NabuHelicalPrepareWeightsDoubleOW(
|
16
|
+
qtapp, # noqa F811
|
17
|
+
tmp_path,
|
18
|
+
):
|
19
|
+
"""simple test of the _DeltaBetaSelectorDialog"""
|
20
|
+
widget = NXtomoConcatenateOW()
|
21
|
+
widget._loadSettings()
|
22
|
+
# test settings serialization
|
23
|
+
pickle.dumps(widget._ewoks_default_inputs)
|
24
|
+
literal_dumps(widget._ewoks_default_inputs)
|
25
|
+
|
26
|
+
scan_1 = MockNXtomo(
|
27
|
+
scan_path=os.path.join(tmp_path, "scan1"),
|
28
|
+
n_proj=10,
|
29
|
+
n_ini_proj=10,
|
30
|
+
scan_range=180,
|
31
|
+
dim=20,
|
32
|
+
energy=12.3,
|
33
|
+
).scan
|
34
|
+
scan_2 = MockNXtomo(
|
35
|
+
scan_path=os.path.join(tmp_path, "scan2"),
|
36
|
+
n_proj=10,
|
37
|
+
n_ini_proj=10,
|
38
|
+
scan_range=180,
|
39
|
+
dim=20,
|
40
|
+
energy=12.3,
|
41
|
+
).scan
|
42
|
+
|
43
|
+
output_scan_file = os.path.join(tmp_path, "concatenation.nx")
|
44
|
+
assert not os.path.exists(output_scan_file)
|
45
|
+
|
46
|
+
widget.widget.setConfiguration(
|
47
|
+
{
|
48
|
+
"output_file": output_scan_file,
|
49
|
+
}
|
50
|
+
)
|
51
|
+
|
52
|
+
# process task
|
53
|
+
finished = QtEvent()
|
54
|
+
|
55
|
+
def finished_callback():
|
56
|
+
finished.set()
|
57
|
+
|
58
|
+
executor = widget.task_executor_queue
|
59
|
+
executor.sigComputationEnded.connect(finished_callback)
|
60
|
+
widget._process_serie(serie=Serie(iterable=[scan_1, scan_2]))
|
61
|
+
|
62
|
+
# wait until processing is finished
|
63
|
+
assert finished.wait(timeout=10)
|
64
|
+
assert os.path.exists(output_scan_file)
|