tomwer 1.4.0rc6__py3-none-any.whl → 1.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +2 -2
  2. orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +19 -47
  3. orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +8 -3
  4. orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +4 -6
  5. orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +8 -4
  6. orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +0 -4
  7. orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +1 -13
  8. tomwer/app/axis.py +0 -1
  9. tomwer/app/intensitynormalization.py +0 -14
  10. tomwer/app/multicor.py +1 -33
  11. tomwer/app/multipag.py +1 -31
  12. tomwer/app/nabuapp.py +0 -1
  13. tomwer/app/patchrawdarkflat.py +0 -3
  14. tomwer/app/reducedarkflat.py +0 -1
  15. tomwer/core/process/control/datalistener/datalistener.py +0 -232
  16. tomwer/core/process/control/datawatcher/datawatcher.py +0 -5
  17. tomwer/core/process/control/scantransfer.py +3 -60
  18. tomwer/core/process/edit/darkflatpatch.py +0 -8
  19. tomwer/core/process/edit/imagekeyeditor.py +2 -19
  20. tomwer/core/process/reconstruction/axis/axis.py +0 -13
  21. tomwer/core/process/reconstruction/darkref/darkrefs.py +0 -59
  22. tomwer/core/process/reconstruction/nabu/nabuslices.py +0 -88
  23. tomwer/core/process/reconstruction/nabu/nabuvolume.py +0 -10
  24. tomwer/core/process/reconstruction/params_cache.py +36 -0
  25. tomwer/core/process/reconstruction/saaxis/saaxis.py +80 -88
  26. tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +78 -86
  27. tomwer/core/process/reconstruction/tests/test_params_cache.py +37 -0
  28. tomwer/core/process/script/python.py +0 -19
  29. tomwer/core/process/task.py +0 -290
  30. tomwer/core/process/tests/test_dark_and_flat.py +0 -6
  31. tomwer/core/process/tests/test_data_transfer.py +0 -1
  32. tomwer/core/process/tests/test_data_watcher.py +6 -23
  33. tomwer/core/scan/edfscan.py +0 -11
  34. tomwer/core/scan/nxtomoscan.py +0 -12
  35. tomwer/core/scan/scanbase.py +0 -81
  36. tomwer/gui/reconstruction/axis/CalculationWidget.py +3 -5
  37. tomwer/gui/reconstruction/tests/test_saaxis.py +2 -2
  38. tomwer/gui/reconstruction/tests/test_sadeltabeta.py +2 -2
  39. tomwer/gui/stitching/config/axisparams.py +2 -0
  40. tomwer/synctools/stacks/reconstruction/axis.py +0 -18
  41. tomwer/synctools/tests/test_foldertransfer.py +2 -19
  42. tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_i_norm.py +0 -10
  43. tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_sa_delta_beta.py +103 -153
  44. tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_saaxis.py +117 -152
  45. tomwer/tests/orangecontrib/tomwer/widgets/{tests/test_darkref.py → test_darkref.py} +0 -9
  46. tomwer/tests/orangecontrib/tomwer/widgets/{tests/test_foldertransfert.py → test_foldertransfert.py} +1 -1
  47. tomwer/tests/test_ewoks/test_workflows.py +0 -4
  48. tomwer/version.py +3 -3
  49. {tomwer-1.4.0rc6.dist-info → tomwer-1.4.1.dist-info}/METADATA +1 -2
  50. {tomwer-1.4.0rc6.dist-info → tomwer-1.4.1.dist-info}/RECORD +55 -56
  51. tomwer/core/scan/tests/test_process_registration.py +0 -64
  52. tomwer/core/utils/Singleton.py +0 -36
  53. tomwer/core/utils/locker.py +0 -58
  54. /tomwer/tests/orangecontrib/tomwer/widgets/{tests/test_conditions.py → test_conditions.py} +0 -0
  55. {tomwer-1.4.0rc6.dist-info → tomwer-1.4.1.dist-info}/LICENSE +0 -0
  56. {tomwer-1.4.0rc6.dist-info → tomwer-1.4.1.dist-info}/WHEEL +0 -0
  57. {tomwer-1.4.0rc6.dist-info → tomwer-1.4.1.dist-info}/entry_points.txt +0 -0
  58. {tomwer-1.4.0rc6.dist-info → tomwer-1.4.1.dist-info}/top_level.txt +0 -0
@@ -1,28 +1,21 @@
1
1
  # coding: utf-8
2
2
  from __future__ import annotations
3
3
 
4
- import gc
5
- import logging
6
4
  import os
5
+ import logging
7
6
  import pickle
8
- import shutil
9
- import tempfile
10
7
  import time
11
- import uuid
12
8
 
13
- import h5py
14
9
  import numpy
15
10
  from orangecanvas.scheme.readwrite import literal_dumps
16
11
  from processview.core.manager import DatasetState, ProcessManager
17
- from silx.gui import qt
18
- from silx.gui.utils.testutils import TestCaseQt
19
12
  from silx.io.url import DataUrl
13
+ from silx.gui import qt
20
14
 
21
15
  from orangecontrib.tomwer.widgets.reconstruction.SAAxisOW import SAAxisOW as _SAAxisOW
22
- from tomwer.core import settings
23
- from tomwer.core.utils.lbsram import mock_low_memory
24
16
  from tomwer.core.process.reconstruction.scores import ComputedScore
25
17
  from tomwer.core.utils.scanutils import MockNXtomo
18
+ from tomwer.tests.conftest import qtapp # noqa F401
26
19
 
27
20
  logger = logging.getLogger(__name__)
28
21
 
@@ -33,7 +26,6 @@ class SAAxisOW(_SAAxisOW):
33
26
  super().__init__(parent)
34
27
 
35
28
  def processing_finished(self, scan):
36
- # TODO: add message processing finished
37
29
  self._scans_finished.append(scan)
38
30
 
39
31
  @property
@@ -45,150 +37,123 @@ class SAAxisOW(_SAAxisOW):
45
37
  super().close()
46
38
 
47
39
 
48
- class TestProcessing(TestCaseQt):
49
- DIM = 100
50
-
51
- def setUp(self):
52
- super().setUp()
53
- self._source_dir = tempfile.mkdtemp()
54
-
55
- def create_scan(folder_name):
56
- _dir = os.path.join(self._source_dir, folder_name)
57
- return MockNXtomo(
58
- scan_path=_dir,
59
- n_ini_proj=20,
60
- n_proj=20,
61
- n_alignement_proj=2,
62
- create_final_flat=False,
63
- create_ini_dark=True,
64
- create_ini_flat=True,
65
- n_refs=1,
66
- dim=self.DIM,
67
- ).scan
68
-
69
- # create scans
70
- self.scan_1 = create_scan("scan_1")
71
- self.scan_2 = create_scan("scan_2")
72
- self.scan_3 = create_scan("scan_3")
73
- self._process_manager = ProcessManager()
74
-
75
- self.widget = SAAxisOW()
76
- self.widget.show()
77
-
78
- def patch_score(*args, **kwargs):
79
- data = numpy.random.random(TestProcessing.DIM * TestProcessing.DIM)
80
- data = data.reshape(TestProcessing.DIM, TestProcessing.DIM)
81
- slice_file_path = os.path.join(
82
- self._source_dir, str(uuid.uuid1()) + ".hdf5"
83
- )
84
- data_url = DataUrl(
85
- file_path=slice_file_path, data_path="data", scheme="silx"
86
- )
87
- with h5py.File(slice_file_path, mode="a") as h5f:
88
- h5f["data"] = data
89
- return data_url, ComputedScore(
90
- tv=numpy.random.random(),
91
- std=numpy.random.random(),
92
- )
93
-
94
- self.widget._widget._processing_stack.patch_processing(patch_score)
95
-
96
- def tearDown(self):
97
- mock_low_memory(False)
98
- settings.mock_lsbram(False)
99
- self.widget.setAttribute(qt.Qt.WA_DeleteOnClose)
100
- self.widget.close()
101
- self.widget = None
102
- self.qapp.processEvents()
103
- shutil.rmtree(self._source_dir)
104
- gc.collect()
105
-
106
- def test_serializing(self):
107
- pickle.dumps(self.widget.getConfiguration())
108
-
109
- def test_literal_dumps(self):
110
- literal_dumps(self.widget.getConfiguration())
111
-
112
- def testAutoFocusUnlock(self):
113
- self.widget.lockAutofocus(False)
114
-
115
- def manual_processing():
116
- self.widget.load_sinogram()
117
- self.widget.compute()
118
- self.qapp.processEvents()
119
- self.widget.wait_processing(5000)
120
- self.qapp.processEvents()
121
-
122
- self.widget.process(self.scan_1)
123
- manual_processing()
124
- self.assertEqual(
125
- self._process_manager.get_dataset_state(
126
- dataset_id=self.scan_1.get_identifier(),
127
- process=self.widget,
128
- ),
129
- DatasetState.WAIT_USER_VALIDATION,
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_SAAxisOW(
70
+ qtapp, # noqa F811
71
+ tmp_path,
72
+ ):
73
+ source_dir = tmp_path / "source"
74
+ source_dir.mkdir()
75
+
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
+ process_manager = ProcessManager()
81
+
82
+ widget = SAAxisOW()
83
+ widget.show()
84
+
85
+ widget._widget._processing_stack.patch_processing(patch_score)
86
+
87
+ # test configuration serialization
88
+ pickle.dumps(widget.getConfiguration())
89
+
90
+ # test configuration is compatible with 'litteral dumps'
91
+ literal_dumps(widget.getConfiguration())
92
+
93
+ # test behavior when 'auto focus' is lock (so widget is automated, should take the value with the higher score)
94
+ widget.lockAutofocus(False)
95
+
96
+ def manual_processing():
97
+ widget.load_sinogram()
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,
130
109
  )
131
-
132
- self.widget.process(self.scan_2)
133
- manual_processing()
134
- self.assertEqual(len(self.widget.scans_finished), 0)
135
- self.assertEqual(
136
- self._process_manager.get_dataset_state(
137
- dataset_id=self.scan_1.get_identifier(),
138
- process=self.widget,
139
- ),
140
- DatasetState.SKIPPED,
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,
141
120
  )
142
- self.assertEqual(
143
- self._process_manager.get_dataset_state(
144
- dataset_id=self.scan_2.get_identifier(),
145
- process=self.widget,
146
- ),
147
- DatasetState.WAIT_USER_VALIDATION,
121
+ == DatasetState.SKIPPED
122
+ )
123
+ assert (
124
+ process_manager.get_dataset_state(
125
+ dataset_id=scan_2.get_identifier(),
126
+ process=widget,
148
127
  )
149
- self.widget.process(self.scan_3)
150
- manual_processing()
151
- self.widget.validateCurrentScan()
152
- self.assertEqual(
153
- self._process_manager.get_dataset_state(
154
- dataset_id=self.scan_3.get_identifier(),
155
- process=self.widget,
156
- ),
157
- DatasetState.SUCCEED,
128
+ == DatasetState.WAIT_USER_VALIDATION
129
+ )
130
+
131
+ widget.process(scan_3)
132
+ manual_processing()
133
+ widget.validateCurrentScan()
134
+ assert (
135
+ process_manager.get_dataset_state(
136
+ dataset_id=scan_3.get_identifier(),
137
+ process=widget,
158
138
  )
159
- # insure a cor has been registered
160
- self.assertNotEqual(self.scan_3.axis_params.relative_cor_value, None)
161
-
162
- def testTestLbsram(self):
163
- mock_low_memory(True)
164
- settings.mock_lsbram(True)
165
- for scan in (self.scan_1, self.scan_2, self.scan_3):
166
- self.widget.process(scan)
167
- self.widget.wait_processing(5000)
168
- self.qapp.processEvents()
169
-
170
- for scan in (self.scan_1, self.scan_2, self.scan_3):
171
- with self.subTest(scan=str(scan)):
172
- self.assertEqual(
173
- self._process_manager.get_dataset_state(
174
- dataset_id=scan.get_identifier(),
175
- process=self.widget,
176
- ),
177
- DatasetState.SKIPPED,
178
- )
179
-
180
- def testAutoFocusLock(self):
181
- self.widget.lockAutofocus(True)
182
- for scan in (self.scan_1, self.scan_2, self.scan_3):
183
- self.widget.process(scan)
184
- self.widget.wait_processing(10000)
185
- self.qapp.processEvents()
139
+ == DatasetState.SUCCEED
140
+ )
141
+
142
+ # insure a cor has been registered
143
+ assert scan_3.axis_params.relative_cor_value is not None
144
+
145
+ # test autofocus is unlocked
146
+ widget.lockAutofocus(True)
147
+ for scan in (scan_1, scan_2, scan_3):
148
+ widget.process(scan)
149
+ widget.wait_processing(10000)
150
+ while qt.QApplication.hasPendingEvents():
186
151
  time.sleep(0.1)
187
- self.qapp.processEvents()
188
- self.assertEqual(
189
- self._process_manager.get_dataset_state(
190
- dataset_id=scan.get_identifier(),
191
- process=self.widget,
192
- ),
193
- DatasetState.SUCCEED,
152
+ qt.QApplication.processEvents()
153
+ assert (
154
+ process_manager.get_dataset_state(
155
+ dataset_id=scan.get_identifier(),
156
+ process=widget,
194
157
  )
158
+ == DatasetState.SUCCEED
159
+ )
@@ -170,7 +170,6 @@ class TestDarkRefCopyWithEDFAndHDF5(TestCaseQt):
170
170
  self.widget.setCopyActive(False)
171
171
 
172
172
  self.widget.process(self.hdf5_acquisition_with_refs)
173
- self.assertTrue(os.path.exists(self.hdf5_acquisition_with_refs.process_file))
174
173
 
175
174
  # make sure no dark or flats exists for the hdf5 without refs
176
175
  for scan in (
@@ -178,7 +177,6 @@ class TestDarkRefCopyWithEDFAndHDF5(TestCaseQt):
178
177
  self.hdf5_acquisition_without_refs,
179
178
  ):
180
179
  self.widget.process(scan)
181
- self.assertFalse(os.path.exists(scan.process_file))
182
180
 
183
181
  # make sure no dark or flats exists for the edf one
184
182
  self.widget.process(self.edf_acquisition_without_ref)
@@ -188,14 +186,12 @@ class TestDarkRefCopyWithEDFAndHDF5(TestCaseQt):
188
186
  self.widget.setModeAuto(True)
189
187
 
190
188
  self.widget.process(self.hdf5_acquisition_with_refs)
191
- self.assertTrue(os.path.exists(self.hdf5_acquisition_with_refs.process_file))
192
189
  # 1. make sure dark has been processed for the one with ref
193
190
  self.assertTrue(self.widget.hasDarkStored())
194
191
  self.assertTrue(self.widget.hasFlatStored())
195
192
 
196
193
  # 2. make sure copy has been processed for the the 'compatible hdf5'
197
194
  self.widget.process(self.hdf5_acquisition_without_refs)
198
- self.assertTrue(os.path.exists(self.hdf5_acquisition_without_refs.process_file))
199
195
 
200
196
  # 3. make sure copy has been processed for the the 'compatible edf'
201
197
  self.widget.process(self.edf_acquisition_without_ref)
@@ -218,8 +214,3 @@ class TestDarkRefCopyWithEDFAndHDF5(TestCaseQt):
218
214
 
219
215
  # 4. make sure process but no copy made if incompatible size
220
216
  self.widget.process(self.hdf5_acquisition_without_refs_incoherent_dim)
221
- self.assertFalse(
222
- os.path.exists(
223
- self.hdf5_acquisition_without_refs_incoherent_dim.process_file
224
- )
225
- )
@@ -100,6 +100,6 @@ class TestEDFFolderTransfertWidget(TestCaseQt):
100
100
 
101
101
  return (
102
102
  (len(inputFile) == 0)
103
- and (len(outputFiles) == (self.n_file + 3))
103
+ and (len(outputFiles) == (self.n_file + 2))
104
104
  and (not os.path.isdir(self.sourcedir))
105
105
  )
@@ -40,9 +40,6 @@ def test_simple_workflow_nabu():
40
40
  ) as scan:
41
41
  # insure no cfg yet
42
42
  assert len(glob(os.path.join(scan.path, "*.cfg"))) == 0
43
- assert not os.path.exists(
44
- scan.process_file
45
- ), "check tomwer should not have been processed yet"
46
43
 
47
44
  graph = load_graph(
48
45
  source={
@@ -130,7 +127,6 @@ def test_simple_workflow_nabu():
130
127
  "nabu volume"
131
128
  }, "should only have one result nodes"
132
129
  assert "data" in result, f"cannot find `nabu volume` in {result}"
133
- assert os.path.exists(scan.process_file), "check tomwer has been processed"
134
130
  assert os.path.exists(
135
131
  os.path.join(
136
132
  scan.path, PROCESS_FOLDER_RECONSTRUCTED_VOLUMES, "nabu_cfg_files"
tomwer/version.py CHANGED
@@ -77,9 +77,9 @@ RELEASE_LEVEL_VALUE = {
77
77
 
78
78
  MAJOR = 1
79
79
  MINOR = 4
80
- MICRO = 0
81
- RELEV = "rc" # <16
82
- SERIAL = 6 # <16
80
+ MICRO = 1
81
+ RELEV = "final" # <16
82
+ SERIAL = 0 # <16
83
83
 
84
84
  date = __date__
85
85
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tomwer
3
- Version: 1.4.0rc6
3
+ Version: 1.4.1
4
4
  Summary: "tomography workflow tools"
5
5
  Home-page: https://gitlab.esrf.fr/tomotools/tomwer
6
6
  Author: Henri Payno, Pierre Paleo, Pierre-Olivier Autran, Jérôme Lesaint, Alessandro Mirone
@@ -32,7 +32,6 @@ Requires-Dist: processview>=1.4.3
32
32
  Requires-Dist: ewoks>=0.1.1
33
33
  Requires-Dist: sluurp>=0.4.1
34
34
  Requires-Dist: packaging
35
- Requires-Dist: flufl-lock
36
35
  Requires-Dist: pyunitsystem>=2.0.0a
37
36
  Requires-Dist: tqdm
38
37
  Provides-Extra: full-base