tomwer 1.4.0rc6__py3-none-any.whl → 1.4.2__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/orange/managedprocess.py +7 -0
- orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +2 -2
- orangecontrib/tomwer/widgets/edit/ImageKeyUpgraderOW.py +5 -4
- orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +19 -47
- orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +0 -2
- orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +8 -3
- orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +4 -6
- orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +8 -4
- orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +0 -4
- orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +1 -13
- tomwer/app/axis.py +0 -1
- tomwer/app/intensitynormalization.py +0 -14
- tomwer/app/multicor.py +1 -33
- tomwer/app/multipag.py +1 -31
- tomwer/app/nabuapp.py +0 -1
- tomwer/app/patchrawdarkflat.py +0 -3
- tomwer/app/reducedarkflat.py +0 -1
- tomwer/core/process/control/datalistener/datalistener.py +0 -232
- tomwer/core/process/control/datawatcher/datawatcher.py +0 -5
- tomwer/core/process/control/scantransfer.py +3 -60
- tomwer/core/process/edit/darkflatpatch.py +0 -8
- tomwer/core/process/edit/imagekeyeditor.py +2 -19
- tomwer/core/process/reconstruction/axis/axis.py +7 -18
- tomwer/core/process/reconstruction/darkref/darkrefs.py +0 -59
- tomwer/core/process/reconstruction/nabu/nabuslices.py +0 -88
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +0 -10
- tomwer/core/process/reconstruction/params_cache.py +36 -0
- tomwer/core/process/reconstruction/saaxis/saaxis.py +80 -88
- tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +78 -86
- tomwer/core/process/reconstruction/tests/test_params_cache.py +37 -0
- tomwer/core/process/script/python.py +0 -19
- tomwer/core/process/task.py +0 -290
- tomwer/core/process/tests/test_dark_and_flat.py +0 -6
- tomwer/core/process/tests/test_data_transfer.py +0 -1
- tomwer/core/process/tests/test_data_watcher.py +6 -23
- tomwer/core/scan/edfscan.py +0 -11
- tomwer/core/scan/nxtomoscan.py +0 -12
- tomwer/core/scan/scanbase.py +0 -81
- tomwer/gui/reconstruction/axis/CalculationWidget.py +3 -5
- tomwer/gui/reconstruction/tests/test_saaxis.py +2 -2
- tomwer/gui/reconstruction/tests/test_sadeltabeta.py +2 -2
- tomwer/gui/stitching/config/axisparams.py +2 -0
- tomwer/synctools/stacks/reconstruction/axis.py +0 -18
- tomwer/synctools/tests/test_foldertransfer.py +2 -19
- tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_i_norm.py +110 -153
- tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_sa_delta_beta.py +103 -153
- tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_saaxis.py +117 -152
- tomwer/tests/orangecontrib/tomwer/widgets/{tests/test_darkref.py → test_darkref.py} +0 -9
- tomwer/tests/orangecontrib/tomwer/widgets/{tests/test_foldertransfert.py → test_foldertransfert.py} +1 -1
- tomwer/tests/test_ewoks/test_workflows.py +0 -4
- tomwer/version.py +3 -3
- {tomwer-1.4.0rc6.dist-info → tomwer-1.4.2.dist-info}/METADATA +2 -3
- {tomwer-1.4.0rc6.dist-info → tomwer-1.4.2.dist-info}/RECORD +58 -59
- tomwer/core/scan/tests/test_process_registration.py +0 -64
- tomwer/core/utils/Singleton.py +0 -36
- tomwer/core/utils/locker.py +0 -58
- /tomwer/tests/orangecontrib/tomwer/widgets/{tests/test_conditions.py → test_conditions.py} +0 -0
- {tomwer-1.4.0rc6.dist-info → tomwer-1.4.2.dist-info}/LICENSE +0 -0
- {tomwer-1.4.0rc6.dist-info → tomwer-1.4.2.dist-info}/WHEEL +0 -0
- {tomwer-1.4.0rc6.dist-info → tomwer-1.4.2.dist-info}/entry_points.txt +0 -0
- {tomwer-1.4.0rc6.dist-info → tomwer-1.4.2.dist-info}/top_level.txt +0 -0
@@ -11,7 +11,6 @@ from silx.gui import qt
|
|
11
11
|
from tomwer.core.process.reconstruction.axis import AxisTask
|
12
12
|
from tomwer.core.process.reconstruction.axis.axis import NoAxisUrl
|
13
13
|
from tomwer.core.process.reconstruction.axis.mode import AxisMode
|
14
|
-
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
15
14
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
16
15
|
from tomwer.core.settings import get_lbsram_path, isOnLbsram
|
17
16
|
from tomwer.core.utils.lbsram import is_low_on_memory
|
@@ -63,23 +62,6 @@ class AxisProcessStack(FIFO, qt.QObject):
|
|
63
62
|
cor = 0
|
64
63
|
data._axis_params.set_relative_value(cor)
|
65
64
|
cor = data._axis_params.relative_cor_value
|
66
|
-
if isinstance(data, NXtomoScan):
|
67
|
-
entry = data.entry
|
68
|
-
else:
|
69
|
-
entry = "entry"
|
70
|
-
try:
|
71
|
-
with data.acquire_process_file_lock():
|
72
|
-
AxisTask._register_process(
|
73
|
-
process_file=data.process_file,
|
74
|
-
entry=entry,
|
75
|
-
process=AxisTask,
|
76
|
-
results={"center_of_rotation": cor if cor is not None else "-"},
|
77
|
-
configuration=self._axis_params.to_dict(),
|
78
|
-
process_index=data.pop_process_index(),
|
79
|
-
overwrite=True,
|
80
|
-
)
|
81
|
-
except Exception as e:
|
82
|
-
_logger.warning(f"Fail to register Axis process. Reason is {e}")
|
83
65
|
# If mode is read or manual the position_value is not computed and
|
84
66
|
# we will keep the actual one (should have been defined previously)
|
85
67
|
self._end_computation(data=data, future_tomo_obj=None, callback=callback)
|
@@ -195,10 +195,10 @@ class TestEDFDataTransfert(TestCaseQt):
|
|
195
195
|
def checkDataCopied(self):
|
196
196
|
outputFiles = os.listdir(self.outputdir)
|
197
197
|
inputFile = glob(self.sourcedir)
|
198
|
-
# + 3 because .info and .xml are count
|
198
|
+
# + 3 because .info and .xml are count
|
199
199
|
return (
|
200
200
|
(len(inputFile) == 0)
|
201
|
-
and (len(outputFiles) == (self.n_file +
|
201
|
+
and (len(outputFiles) == (self.n_file + 2))
|
202
202
|
and (not os.path.isdir(self.sourcedir))
|
203
203
|
)
|
204
204
|
|
@@ -247,23 +247,6 @@ class TestHDFDataTransfert(TestCaseQt):
|
|
247
247
|
assert os.path.isfile(output_file_path)
|
248
248
|
self.scan = NXtomoScan(scan=output_file_path, entry=entry)
|
249
249
|
|
250
|
-
# register information regarding origin of the file
|
251
|
-
from tomwer.core.process.control.datalistener import DataListener
|
252
|
-
|
253
|
-
DataListener._register_process(
|
254
|
-
process_file=self.scan.process_file,
|
255
|
-
process=DataListener,
|
256
|
-
entry=self.scan.entry,
|
257
|
-
results={"output_file": self.scan.master_file, "entry": self.scan.entry},
|
258
|
-
configuration={
|
259
|
-
"sample_file": self._sample_file,
|
260
|
-
"entry": self._sample_file_entry,
|
261
|
-
"file_proposal": self._proposal_file,
|
262
|
-
},
|
263
|
-
process_index=self.scan.pop_process_index(),
|
264
|
-
overwrite=True,
|
265
|
-
)
|
266
|
-
|
267
250
|
def tearDown(self):
|
268
251
|
for dir_ in (self.input_dir, self.output_dir):
|
269
252
|
shutil.rmtree(dir_)
|
@@ -1,32 +1,24 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
from __future__ import annotations
|
3
3
|
|
4
|
-
import gc
|
5
4
|
import logging
|
6
5
|
import os
|
7
6
|
import pickle
|
8
|
-
import shutil
|
9
|
-
import tempfile
|
10
7
|
|
11
8
|
from orangecanvas.scheme.readwrite import literal_dumps
|
12
9
|
from processview.core.manager import DatasetState, ProcessManager
|
13
10
|
from silx.gui import qt
|
14
|
-
from silx.gui.utils.testutils import TestCaseQt
|
15
|
-
from silx.io.utils import h5py_read_dataset
|
16
11
|
|
17
12
|
from orangecontrib.tomwer.widgets.reconstruction.SinoNormOW import (
|
18
|
-
SinoNormOW as
|
13
|
+
SinoNormOW as _SinoNormOW,
|
19
14
|
)
|
20
|
-
from tomwer.core import settings
|
21
|
-
from tomwer.core.utils.lbsram import mock_low_memory
|
22
|
-
from tomwer.core.process.reconstruction.normalization import SinoNormalizationTask
|
23
15
|
from tomwer.core.utils.scanutils import MockNXtomo
|
24
|
-
from tomwer.
|
16
|
+
from tomwer.tests.conftest import qtapp # noqa F401
|
25
17
|
|
26
18
|
logger = logging.getLogger(__name__)
|
27
19
|
|
28
20
|
|
29
|
-
class
|
21
|
+
class SinoNormOW(_SinoNormOW):
|
30
22
|
def __init__(self, parent=None):
|
31
23
|
self._scans_finished = []
|
32
24
|
super().__init__(parent)
|
@@ -52,149 +44,114 @@ class NormIOW(_NormIOW):
|
|
52
44
|
super().close()
|
53
45
|
|
54
46
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
self.widget.process(self.scan_1)
|
118
|
-
process_scalar_manually()
|
119
|
-
self.assertEqual(
|
120
|
-
self._process_manager.get_dataset_state(
|
121
|
-
dataset_id=self.scan_1.get_identifier(),
|
122
|
-
process=self.widget,
|
123
|
-
),
|
124
|
-
DatasetState.WAIT_USER_VALIDATION,
|
47
|
+
FRAME_DIM = 100
|
48
|
+
|
49
|
+
|
50
|
+
def create_scan(folder_name):
|
51
|
+
return MockNXtomo(
|
52
|
+
scan_path=folder_name,
|
53
|
+
n_ini_proj=20,
|
54
|
+
n_proj=20,
|
55
|
+
n_alignement_proj=2,
|
56
|
+
create_final_flat=False,
|
57
|
+
create_ini_dark=True,
|
58
|
+
create_ini_flat=True,
|
59
|
+
n_refs=1,
|
60
|
+
dim=FRAME_DIM,
|
61
|
+
).scan
|
62
|
+
|
63
|
+
|
64
|
+
def test_SinoNormOW(
|
65
|
+
qtapp, # noqa F811
|
66
|
+
tmp_path,
|
67
|
+
):
|
68
|
+
source_dir = tmp_path / "source"
|
69
|
+
source_dir.mkdir()
|
70
|
+
|
71
|
+
# create scans
|
72
|
+
scan_1 = create_scan(os.path.join(source_dir, "scan_1"))
|
73
|
+
scan_2 = create_scan(os.path.join(source_dir, "scan_2"))
|
74
|
+
scan_3 = create_scan(os.path.join(source_dir, "scan_3"))
|
75
|
+
process_manager = ProcessManager()
|
76
|
+
|
77
|
+
widget = SinoNormOW()
|
78
|
+
widget.show()
|
79
|
+
|
80
|
+
# test serialization
|
81
|
+
pickle.dumps(widget.getConfiguration())
|
82
|
+
|
83
|
+
# test literal dumps
|
84
|
+
widget._updateSettings()
|
85
|
+
literal_dumps(widget._ewoks_default_inputs)
|
86
|
+
|
87
|
+
# test behavior when the widget is unlocked
|
88
|
+
"""Test result when used with some interaction"""
|
89
|
+
widget.setLocked(False)
|
90
|
+
|
91
|
+
def process_scalar_manually():
|
92
|
+
widget.setCurrentMethod("division")
|
93
|
+
widget.setCurrentSource("manual ROI")
|
94
|
+
|
95
|
+
qt.QApplication.processEvents()
|
96
|
+
widget.setROI(start_x=0, end_x=10, start_y=0, end_y=10)
|
97
|
+
qt.QApplication.processEvents()
|
98
|
+
widget.compute()
|
99
|
+
widget.wait_processing(5000)
|
100
|
+
qt.QApplication.processEvents()
|
101
|
+
|
102
|
+
widget.process(scan_1)
|
103
|
+
process_scalar_manually()
|
104
|
+
assert (
|
105
|
+
process_manager.get_dataset_state(
|
106
|
+
dataset_id=scan_1.get_identifier(),
|
107
|
+
process=widget,
|
125
108
|
)
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
),
|
135
|
-
|
109
|
+
== DatasetState.WAIT_USER_VALIDATION
|
110
|
+
)
|
111
|
+
|
112
|
+
widget.process(scan_2)
|
113
|
+
process_scalar_manually()
|
114
|
+
assert len(widget.scans_finished) == 0
|
115
|
+
assert (
|
116
|
+
process_manager.get_dataset_state(
|
117
|
+
dataset_id=scan_1.get_identifier(),
|
118
|
+
process=widget,
|
136
119
|
)
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
),
|
142
|
-
|
120
|
+
== DatasetState.SKIPPED
|
121
|
+
)
|
122
|
+
assert (
|
123
|
+
process_manager.get_dataset_state(
|
124
|
+
dataset_id=scan_2.get_identifier(),
|
125
|
+
process=widget,
|
143
126
|
)
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
),
|
153
|
-
|
127
|
+
== DatasetState.WAIT_USER_VALIDATION
|
128
|
+
)
|
129
|
+
|
130
|
+
widget.process(scan_3)
|
131
|
+
process_scalar_manually()
|
132
|
+
widget.validateCurrentScan()
|
133
|
+
assert (
|
134
|
+
process_manager.get_dataset_state(
|
135
|
+
dataset_id=scan_3.get_identifier(),
|
136
|
+
process=widget,
|
137
|
+
)
|
138
|
+
== DatasetState.SUCCEED
|
139
|
+
)
|
140
|
+
|
141
|
+
# test behavior when the widget is locked
|
142
|
+
|
143
|
+
widget.setLocked(True)
|
144
|
+
for scan in (scan_1, scan_2, scan_3):
|
145
|
+
widget.process(scan)
|
146
|
+
widget.wait_processing(5000)
|
147
|
+
qt.QApplication.processEvents()
|
148
|
+
|
149
|
+
for scan in (scan_1, scan_2, scan_3):
|
150
|
+
# test status is SUCCEED
|
151
|
+
assert (
|
152
|
+
process_manager.get_dataset_state(
|
153
|
+
dataset_id=scan.get_identifier(),
|
154
|
+
process=widget,
|
155
|
+
)
|
156
|
+
== DatasetState.SUCCEED
|
154
157
|
)
|
155
|
-
|
156
|
-
def testTestLbsram(self):
|
157
|
-
"""Test scan are all validated if 'low memory on lbsram' scenario is
|
158
|
-
activated"""
|
159
|
-
mock_low_memory(True)
|
160
|
-
settings.mock_lsbram(True)
|
161
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
162
|
-
self.widget.process(scan)
|
163
|
-
self.widget.wait_processing(5000)
|
164
|
-
self.qapp.processEvents()
|
165
|
-
|
166
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
167
|
-
with self.subTest(scan=str(scan)):
|
168
|
-
self.assertEqual(
|
169
|
-
self._process_manager.get_dataset_state(
|
170
|
-
dataset_id=scan.get_identifier(),
|
171
|
-
process=self.widget,
|
172
|
-
),
|
173
|
-
DatasetState.SKIPPED,
|
174
|
-
)
|
175
|
-
|
176
|
-
def testLocked(self):
|
177
|
-
"""Test scan are all validated if the widget is lock"""
|
178
|
-
self.widget.setLocked(True)
|
179
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
180
|
-
self.widget.process(scan)
|
181
|
-
self.widget.wait_processing(5000)
|
182
|
-
self.qapp.processEvents()
|
183
|
-
|
184
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
185
|
-
# test status is SUCCEED
|
186
|
-
with self.subTest(scan=str(scan)):
|
187
|
-
self.assertEqual(
|
188
|
-
self._process_manager.get_dataset_state(
|
189
|
-
dataset_id=scan.get_identifier(),
|
190
|
-
process=self.widget,
|
191
|
-
),
|
192
|
-
DatasetState.SUCCEED,
|
193
|
-
)
|
194
|
-
# test process file has been updated
|
195
|
-
with EntryReader(scan.process_file_url) as entry:
|
196
|
-
self.assertTrue("tomwer_process_0" in entry)
|
197
|
-
self.assertEqual(
|
198
|
-
h5py_read_dataset(entry["tomwer_process_0"]["program"]),
|
199
|
-
SinoNormalizationTask.program_name(),
|
200
|
-
)
|
@@ -1,37 +1,31 @@
|
|
1
|
-
import gc
|
2
1
|
import logging
|
3
2
|
import os
|
4
3
|
import pickle
|
5
|
-
import shutil
|
6
|
-
import tempfile
|
7
|
-
import uuid
|
8
4
|
|
9
|
-
import h5py
|
10
5
|
import numpy
|
11
6
|
from orangecanvas.scheme.readwrite import literal_dumps
|
12
7
|
from processview.core.manager import DatasetState, ProcessManager
|
13
|
-
from silx.gui import qt
|
14
|
-
from silx.gui.utils.testutils import TestCaseQt
|
15
8
|
from silx.io.url import DataUrl
|
9
|
+
from silx.gui import qt
|
16
10
|
|
17
11
|
from orangecontrib.tomwer.widgets.reconstruction.SADeltaBetaOW import (
|
18
12
|
SADeltaBetaOW as _SADeltaBetaOW,
|
19
13
|
)
|
20
|
-
from tomwer.core import settings
|
21
|
-
from tomwer.core.utils.lbsram import mock_low_memory
|
22
14
|
from tomwer.core.process.reconstruction.scores import ComputedScore
|
23
15
|
from tomwer.core.utils.scanutils import MockNXtomo
|
16
|
+
from tomwer.tests.conftest import qtapp # noqa F401
|
24
17
|
|
25
18
|
logger = logging.getLogger(__name__)
|
26
19
|
|
27
20
|
|
28
21
|
class SADeltaBetaOW(_SADeltaBetaOW):
|
22
|
+
"""class saving scan finished to keep a trace on those."""
|
23
|
+
|
29
24
|
def __init__(self, parent=None):
|
30
25
|
self._scans_finished = []
|
31
26
|
super().__init__(parent)
|
32
27
|
|
33
28
|
def processing_finished(self, scan):
|
34
|
-
# TODO: add message processing finished
|
35
29
|
self._scans_finished.append(scan)
|
36
30
|
|
37
31
|
@property
|
@@ -43,152 +37,108 @@ class SADeltaBetaOW(_SADeltaBetaOW):
|
|
43
37
|
super().close()
|
44
38
|
|
45
39
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
)
|
82
|
-
data_url = DataUrl(
|
83
|
-
file_path=slice_file_path, data_path="data", scheme="silx"
|
84
|
-
)
|
85
|
-
with h5py.File(slice_file_path, mode="a") as h5f:
|
86
|
-
h5f["data"] = data
|
87
|
-
return data_url, ComputedScore(
|
88
|
-
tv=numpy.random.random(),
|
89
|
-
std=numpy.random.random(),
|
90
|
-
)
|
91
|
-
|
92
|
-
self.widget._widget._processing_stack.patch_processing(patch_score)
|
93
|
-
|
94
|
-
def tearDown(self):
|
95
|
-
mock_low_memory(False)
|
96
|
-
settings.mock_lsbram(False)
|
97
|
-
self.widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
98
|
-
self.widget.close()
|
99
|
-
self.widget = None
|
100
|
-
self.qapp.processEvents()
|
101
|
-
shutil.rmtree(self._source_dir)
|
102
|
-
gc.collect()
|
103
|
-
|
104
|
-
def test_serializing(self):
|
105
|
-
pickle.dumps(self.widget.getConfiguration())
|
106
|
-
|
107
|
-
def test_literal_dumps(self):
|
108
|
-
literal_dumps(self.widget.getConfiguration())
|
109
|
-
|
110
|
-
def testAutoFocusUnlock(self):
|
111
|
-
self.widget.lockAutofocus(False)
|
112
|
-
|
113
|
-
def manual_processing():
|
114
|
-
self.widget.compute()
|
115
|
-
self.qapp.processEvents()
|
116
|
-
self.widget.wait_processing(5000)
|
117
|
-
self.qapp.processEvents()
|
118
|
-
|
119
|
-
self.widget.process(self.scan_1)
|
120
|
-
manual_processing()
|
121
|
-
self.assertEqual(
|
122
|
-
self._process_manager.get_dataset_state(
|
123
|
-
dataset_id=self.scan_1.get_identifier(),
|
124
|
-
process=self.widget,
|
125
|
-
),
|
126
|
-
DatasetState.WAIT_USER_VALIDATION,
|
127
|
-
)
|
40
|
+
FRAME_DIM = 100
|
41
|
+
|
42
|
+
|
43
|
+
def create_scan(output_dir):
|
44
|
+
return MockNXtomo(
|
45
|
+
scan_path=output_dir,
|
46
|
+
n_ini_proj=20,
|
47
|
+
n_proj=20,
|
48
|
+
n_alignement_proj=2,
|
49
|
+
create_final_flat=False,
|
50
|
+
create_ini_dark=True,
|
51
|
+
create_ini_flat=True,
|
52
|
+
n_refs=1,
|
53
|
+
dim=FRAME_DIM,
|
54
|
+
).scan
|
55
|
+
|
56
|
+
|
57
|
+
def patch_score(*args, **kwargs):
|
58
|
+
"""Function to save some result"""
|
59
|
+
return DataUrl(
|
60
|
+
file_path="/no_existing/path.hdf5",
|
61
|
+
data_path="/no_existing_data_path",
|
62
|
+
scheme="silx",
|
63
|
+
), ComputedScore(
|
64
|
+
tv=numpy.random.random(),
|
65
|
+
std=numpy.random.random(),
|
66
|
+
)
|
67
|
+
|
68
|
+
|
69
|
+
def test_SADeltaBetaOW(
|
70
|
+
qtapp, # noqa F811
|
71
|
+
tmp_path,
|
72
|
+
):
|
73
|
+
source_dir = tmp_path / "source"
|
74
|
+
source_dir.mkdir()
|
128
75
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
76
|
+
# create scans
|
77
|
+
scan_1 = create_scan(os.path.join(source_dir, "scan_1"))
|
78
|
+
scan_2 = create_scan(os.path.join(source_dir, "scan_2"))
|
79
|
+
scan_3 = create_scan(os.path.join(source_dir, "scan_3"))
|
80
|
+
|
81
|
+
process_manager = ProcessManager()
|
82
|
+
|
83
|
+
widget = SADeltaBetaOW()
|
84
|
+
widget.show()
|
85
|
+
|
86
|
+
widget._widget._processing_stack.patch_processing(patch_score)
|
87
|
+
|
88
|
+
# make sure the configuration is serializable
|
89
|
+
pickle.dumps(widget.getConfiguration())
|
90
|
+
|
91
|
+
# make sure this is compatible with 'literal dumps'
|
92
|
+
literal_dumps(widget.getConfiguration())
|
93
|
+
|
94
|
+
# test behavior when 'autofocus' is lock. (in this case we expect to take the dataset with the higher score) and continue
|
95
|
+
widget.lockAutofocus(False)
|
96
|
+
|
97
|
+
def manual_processing():
|
98
|
+
widget.compute()
|
99
|
+
qt.QApplication.processEvents()
|
100
|
+
widget.wait_processing(5000)
|
101
|
+
qt.QApplication.processEvents()
|
102
|
+
|
103
|
+
widget.process(scan_1)
|
104
|
+
manual_processing()
|
105
|
+
assert (
|
106
|
+
process_manager.get_dataset_state(
|
107
|
+
dataset_id=scan_1.get_identifier(),
|
108
|
+
process=widget,
|
138
109
|
)
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
110
|
+
== DatasetState.WAIT_USER_VALIDATION
|
111
|
+
)
|
112
|
+
|
113
|
+
widget.process(scan_2)
|
114
|
+
manual_processing()
|
115
|
+
assert len(widget.scans_finished) == 0
|
116
|
+
assert (
|
117
|
+
process_manager.get_dataset_state(
|
118
|
+
dataset_id=scan_1.get_identifier(),
|
119
|
+
process=widget,
|
145
120
|
)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
),
|
154
|
-
DatasetState.SUCCEED,
|
121
|
+
== DatasetState.SKIPPED
|
122
|
+
)
|
123
|
+
|
124
|
+
assert (
|
125
|
+
process_manager.get_dataset_state(
|
126
|
+
dataset_id=scan_2.get_identifier(),
|
127
|
+
process=widget,
|
155
128
|
)
|
156
|
-
|
157
|
-
|
158
|
-
|
129
|
+
== DatasetState.WAIT_USER_VALIDATION
|
130
|
+
)
|
131
|
+
|
132
|
+
widget.process(scan_3)
|
133
|
+
manual_processing()
|
134
|
+
widget.validateCurrentScan()
|
135
|
+
assert (
|
136
|
+
process_manager.get_dataset_state(
|
137
|
+
dataset_id=scan_3.get_identifier(),
|
138
|
+
process=widget,
|
159
139
|
)
|
140
|
+
== DatasetState.SUCCEED
|
141
|
+
)
|
160
142
|
|
161
|
-
|
162
|
-
|
163
|
-
settings.mock_lsbram(True)
|
164
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
165
|
-
self.widget.process(scan)
|
166
|
-
self.widget.wait_processing(5000)
|
167
|
-
self.qapp.processEvents()
|
168
|
-
|
169
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
170
|
-
with self.subTest(scan=str(scan)):
|
171
|
-
self.assertEqual(
|
172
|
-
self._process_manager.get_dataset_state(
|
173
|
-
dataset_id=scan.get_identifier(),
|
174
|
-
process=self.widget,
|
175
|
-
),
|
176
|
-
DatasetState.SKIPPED,
|
177
|
-
)
|
178
|
-
|
179
|
-
def testAutoFocusLock(self):
|
180
|
-
self.widget.lockAutofocus(True)
|
181
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
182
|
-
self.widget.process(scan)
|
183
|
-
self.widget.wait_processing(5000)
|
184
|
-
self.qapp.processEvents()
|
185
|
-
|
186
|
-
for scan in (self.scan_1, self.scan_2, self.scan_3):
|
187
|
-
with self.subTest(scan=str(scan)):
|
188
|
-
self.assertEqual(
|
189
|
-
self._process_manager.get_dataset_state(
|
190
|
-
dataset_id=scan.get_identifier(),
|
191
|
-
process=self.widget,
|
192
|
-
),
|
193
|
-
DatasetState.SUCCEED,
|
194
|
-
)
|
143
|
+
# ensure a cor has been registered
|
144
|
+
assert scan_3.sa_delta_beta_params.selected_delta_beta_value is not None
|