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
@@ -21,8 +21,8 @@
21
21
  <link id="5" source_node_id="8" sink_node_id="6" source_channel="data" sink_channel="data" enabled="true" source_channel_id="data" sink_channel_id="data" />
22
22
  <link id="6" source_node_id="7" sink_node_id="3" source_channel="cluster_config" sink_channel="cluster_config" enabled="true" source_channel_id="config_out" sink_channel_id="cluster_in" />
23
23
  <link id="7" source_node_id="3" sink_node_id="9" source_channel="future_tomo_obj" sink_channel="future_tomo_obj" enabled="true" source_channel_id="future_out" sink_channel_id="future_tomo_obj" />
24
- <link id="8" source_node_id="9" sink_node_id="5" source_channel="volume" sink_channel="data" enabled="true" source_channel_id="volume" sink_channel_id="data" />
25
- <link id="9" source_node_id="9" sink_node_id="4" source_channel="data" sink_channel="data" enabled="true" source_channel_id="data" sink_channel_id="data" />
24
+ <link id="8" source_node_id="9" sink_node_id="4" source_channel="data" sink_channel="data" enabled="true" source_channel_id="data" sink_channel_id="data" />
25
+ <link id="9" source_node_id="9" sink_node_id="5" source_channel="data" sink_channel="data" enabled="true" source_channel_id="data" sink_channel_id="data" />
26
26
  </links>
27
27
  <annotations>
28
28
  <arrow id="0" start="(267.0, 56.0)" end="(194.0, 105.0)" fill="#C1272D" />
@@ -22,7 +22,9 @@ from tomwer.core import settings
22
22
  from tomwer.core.utils.lbsram import is_low_on_memory
23
23
  from tomwer.core.process.reconstruction.axis import AxisTask
24
24
  from tomwer.core.process.reconstruction.axis.mode import AxisMode
25
- from tomwer.core.scan.nxtomoscan import NXtomoScan
25
+ from tomwer.core.process.reconstruction.params_cache import (
26
+ save_reconstruction_parameters_to_cache,
27
+ )
26
28
  from tomwer.core.scan.scanbase import TomwerScanBase, _TomwerBaseDock
27
29
  from tomwer.gui.reconstruction.axis import AxisMainWindow
28
30
  from tomwer.synctools.axis import QAxisRP
@@ -296,11 +298,12 @@ class AxisOW(SuperviseOW, WidgetLongProcessing):
296
298
  self.__scan._axis_params.set_relative_value(
297
299
  self._axis_params.relative_cor_value
298
300
  )
299
- _cor_value = self.__scan.axis_params.relative_cor_value
301
+ relative_cor_value = self.__scan.axis_params.relative_cor_value
302
+ save_reconstruction_parameters_to_cache(scan=self.__scan)
300
303
  pv_helpers.notify_succeed(
301
304
  process=self,
302
305
  dataset=self.__scan,
303
- details=f"axis calculation defined for {self.__scan.path}: {_cor_value} (using manual)",
306
+ details=f"axis calculation defined for {self.__scan.path}: {relative_cor_value} (using manual)",
304
307
  )
305
308
  # validate the center of rotation
306
309
  pm = ProcessManager()
@@ -415,36 +418,18 @@ class AxisOW(SuperviseOW, WidgetLongProcessing):
415
418
  self._axis_params.relative_cor_value
416
419
  )
417
420
  cor = scan._axis_params.relative_cor_value
418
- if isinstance(scan, NXtomoScan):
419
- entry = scan.entry
420
- else:
421
- entry = "entry"
422
- with scan.acquire_process_file_lock():
423
- ap = AxisTask(
424
- process_id=self.process_id,
425
- inputs={
426
- "data": None,
427
- },
428
- )
429
- try:
430
- AxisTask._register_process(
431
- process_file=scan.process_file,
432
- entry=entry,
433
- process=ap,
434
- results={
435
- "center_of_rotation": cor if cor is not None else "-"
436
- },
437
- configuration=self._axis_params.to_dict(),
438
- process_index=scan.pop_process_index(),
439
- overwrite=True,
440
- )
441
- except Exception as e:
442
- logger.warning(f"Fail to register Axis process. Error is {e}")
443
- ProcessManager().notify_dataset_state(
444
- dataset=scan,
445
- process=ap,
446
- state=DatasetState.SUCCEED,
447
- )
421
+ save_reconstruction_parameters_to_cache(scan=scan)
422
+ ap = AxisTask(
423
+ process_id=self.process_id,
424
+ inputs={
425
+ "data": None,
426
+ },
427
+ )
428
+ ProcessManager().notify_dataset_state(
429
+ dataset=scan,
430
+ process=ap,
431
+ state=DatasetState.SUCCEED,
432
+ )
448
433
  else:
449
434
  processing_class = AxisTask(
450
435
  inputs={
@@ -459,23 +444,10 @@ class AxisOW(SuperviseOW, WidgetLongProcessing):
459
444
  self.scan_ready(scan=scan)
460
445
 
461
446
  elif self.isValueLock():
462
- entry = scan.entry if isinstance(scan, NXtomoScan) else "entry"
463
447
  cor = self._axis_params.relative_cor_value
464
448
  scan.axis_params.set_relative_value(cor)
449
+ save_reconstruction_parameters_to_cache(scan=scan)
465
450
  scan._axis_params.mode = "manual"
466
- with scan.acquire_process_file_lock():
467
- try:
468
- AxisTask._register_process(
469
- process_file=scan.process_file,
470
- entry=entry,
471
- process=AxisTask,
472
- results={"center_of_rotation": cor if cor is not None else "-"},
473
- configuration=self._axis_params.to_dict(),
474
- process_index=scan.pop_process_index(),
475
- overwrite=True,
476
- )
477
- except Exception as e:
478
- logger.warning(f"Fail to register Axis process. Error is {e}")
479
451
  ProcessManager().notify_dataset_state(
480
452
  dataset=scan,
481
453
  process=AxisTask(
@@ -11,10 +11,13 @@ from orangewidget.settings import Setting
11
11
  from orangewidget.widget import Input, Output
12
12
  from silx.gui import qt
13
13
 
14
+ from tomwer.core.process.reconstruction.params_cache import (
15
+ load_reconstruction_parameters_from_cache,
16
+ save_reconstruction_parameters_to_cache,
17
+ )
14
18
  import tomwer.core.process.reconstruction.nabu.nabuslices
15
19
  from tomwer.core.cluster import SlurmClusterConfiguration
16
20
  from tomwer.core.futureobject import FutureTomwerObject
17
- from tomwer.core.process.reconstruction.nabu.nabuslices import NabuSlicesTask
18
21
  from tomwer.core.scan.scanbase import TomwerScanBase, _TomwerBaseDock
19
22
  from tomwer.core.volume.volumefactory import VolumeFactory
20
23
 
@@ -165,14 +168,15 @@ class NabuOW(WidgetLongProcessing, SuperviseOW):
165
168
  if scan is None:
166
169
  return
167
170
 
171
+ self._nabuWidget.setScan(scan)
172
+
168
173
  if scan.axis_params is None or scan.axis_params.relative_cor_value is None:
169
174
  # try to retrieve last computed cor value from nabu process
170
- r_cor = NabuSlicesTask.retrieve_last_relative_cor(scan)
171
175
  if scan.axis_params is None:
172
176
  from tomwer.synctools.axis import QAxisRP
173
177
 
174
178
  scan.axis_params = QAxisRP()
175
- scan.axis_params.set_relative_value(float(r_cor))
179
+ load_reconstruction_parameters_from_cache(scan=scan)
176
180
 
177
181
  self.show()
178
182
  with NabuOW.DialogCM(self._buttons):
@@ -211,6 +215,7 @@ class NabuOW(WidgetLongProcessing, SuperviseOW):
211
215
  def _endProcessing(self, scan, future_tomo_obj):
212
216
  WidgetLongProcessing._endProcessing(self, scan)
213
217
  if scan is not None:
218
+ save_reconstruction_parameters_to_cache(scan=scan)
214
219
  # send scan
215
220
  self.Outputs.data.send(scan)
216
221
  # send slice urls
@@ -15,6 +15,9 @@ from tomoscan.identifier import VolumeIdentifier
15
15
 
16
16
  import tomwer.core.process.reconstruction.nabu.nabuvolume
17
17
  from orangecontrib.tomwer.widgets.utils import WidgetLongProcessing
18
+ from tomwer.core.process.reconstruction.params_cache import (
19
+ load_reconstruction_parameters_from_cache,
20
+ )
18
21
  from tomwer.core import settings
19
22
  from tomwer.core.cluster import SlurmClusterConfiguration
20
23
  from tomwer.core.futureobject import FutureTomwerObject
@@ -22,7 +25,6 @@ from tomwer.core.process.drac.processeddataset import (
22
25
  DracReconstructedVolumeDataset,
23
26
  )
24
27
  from tomwer.core.process.reconstruction.nabu import utils as nabu_utils
25
- from tomwer.core.process.reconstruction.nabu.nabuvolume import NabuVolumeTask
26
28
  from tomwer.core.scan.scanbase import TomwerScanBase
27
29
  from tomwer.core.utils.char import BETA_CHAR, DELTA_CHAR
28
30
  from tomwer.core.utils.scanutils import format_output_location
@@ -231,15 +233,11 @@ class NabuVolumeOW(WidgetLongProcessing, SuperviseOW):
231
233
  or dataset.axis_params.relative_cor_value is None
232
234
  ):
233
235
  # try to retrieve last computed cor value from nabu process
234
- r_cor = NabuVolumeTask.retrieve_last_relative_cor(dataset)
235
236
  if dataset.axis_params is None:
236
237
  from tomwer.synctools.axis import QAxisRP
237
238
 
238
239
  dataset.axis_params = QAxisRP()
239
- try:
240
- dataset.axis_params.set_relative_value(float(r_cor))
241
- except Exception:
242
- pass
240
+ load_reconstruction_parameters_from_cache(scan=dataset)
243
241
 
244
242
  self.process(dataset)
245
243
 
@@ -18,7 +18,9 @@ from tomwer.core import settings
18
18
  from tomwer.core.utils.lbsram import is_low_on_memory
19
19
  from tomwer.core.cluster import SlurmClusterConfiguration
20
20
  from tomwer.core.process.reconstruction.axis import AxisTask
21
- from tomwer.core.process.reconstruction.saaxis.saaxis import SAAxisTask
21
+ from tomwer.core.process.reconstruction.params_cache import (
22
+ save_reconstruction_parameters_to_cache,
23
+ )
22
24
  from tomwer.core.scan.scanbase import TomwerScanBase, _TomwerBaseDock
23
25
  from tomwer.gui.reconstruction.saaxis.saaxis import SAAxisWindow as _SAAxisWindow
24
26
  from tomwer.synctools.axis import QAxisRP
@@ -41,6 +43,8 @@ class SAAxisWindow(_SAAxisWindow):
41
43
  self._processing_stack = SAAxisProcessStack(
42
44
  saaxis_params=self._saaxis_params, process_id=process_id
43
45
  )
46
+ if process_id is not None:
47
+ assert self._processing_stack.process_id == process_id
44
48
 
45
49
  # connect signal / slot
46
50
  self.sigValidated.connect(self.validateCurrentScan)
@@ -187,6 +191,8 @@ class SAAxisWindow(_SAAxisWindow):
187
191
  )
188
192
  else:
189
193
  scan.axis_params.set_relative_value(selected_cor_value)
194
+ save_reconstruction_parameters_to_cache(scan=scan)
195
+
190
196
  if scan.nabu_recons_params is not None:
191
197
  if "reconstruction" not in scan.nabu_recons_params:
192
198
  scan.nabu_recons_params["reconstruction"] = {}
@@ -200,9 +206,7 @@ class SAAxisWindow(_SAAxisWindow):
200
206
  pv_helpers.notify_succeed(
201
207
  process=self._processing_stack, dataset=scan, details=infos
202
208
  )
203
- SAAxisTask.process_to_tomwer_processes(
204
- scan=scan,
205
- )
209
+
206
210
  self.Outputs.data.send(scan)
207
211
 
208
212
  def getConfiguration(self) -> dict:
@@ -18,7 +18,6 @@ from orangecontrib.tomwer.orange.settings import CallbackSettingsHandler
18
18
  from tomwer.core import settings
19
19
  from tomwer.core.utils.lbsram import is_low_on_memory
20
20
  from tomwer.core.cluster import SlurmClusterConfiguration
21
- from tomwer.core.process.reconstruction.sadeltabeta import SADeltaBetaTask
22
21
  from tomwer.core.scan.scanbase import TomwerScanBase, _TomwerBaseDock
23
22
  from tomwer.gui.reconstruction.sadeltabeta import (
24
23
  SADeltaBetaWindow as _SADeltaBetaWindow,
@@ -136,9 +135,6 @@ class SADeltaBetaWindow(_SADeltaBetaWindow):
136
135
  pv_helpers.notify_succeed(
137
136
  process=self._processing_stack, dataset=scan, details=infos
138
137
  )
139
- SADeltaBetaTask.process_to_tomwer_processes(
140
- scan=scan,
141
- )
142
138
  self.Outputs.data.send(scan)
143
139
 
144
140
  def getConfiguration(self) -> dict:
@@ -15,7 +15,6 @@ from orangecontrib.tomwer.widgets.utils import WidgetLongProcessing
15
15
 
16
16
  from tomwer.core import settings
17
17
  from tomwer.core.utils.lbsram import is_low_on_memory
18
- from tomwer.core.process.reconstruction.normalization import SinoNormalizationTask
19
18
  from tomwer.core.process.reconstruction.normalization.params import _ValueSource
20
19
  from tomwer.core.scan.scanbase import TomwerScanBase
21
20
  from tomwer.gui.reconstruction.normalization.intensity import (
@@ -189,18 +188,7 @@ class SinoNormOW(WidgetLongProcessing, SuperviseOW):
189
188
  tomwer_processing_res_code = extra_infos.pop(
190
189
  "tomwer_processing_res_code", "unprocessed"
191
190
  )
192
- with scan.acquire_process_file_lock():
193
- SinoNormalizationTask._register_process(
194
- process_file=scan.process_file,
195
- process=SinoNormalizationTask,
196
- entry=scan.entry,
197
- configuration=self.getConfiguration(),
198
- results={
199
- "method": scan.intensity_normalization.method.value,
200
- "extra_infos": extra_infos,
201
- },
202
- process_index=scan.pop_process_index(),
203
- )
191
+
204
192
  if tomwer_processing_res_code is True:
205
193
  # if defined by manual scalar we need to set the value
206
194
  if extra_infos.get("source", None) == _ValueSource.MANUAL_SCALAR.value:
tomwer/app/axis.py CHANGED
@@ -161,7 +161,6 @@ def main(argv):
161
161
 
162
162
  requires_reduced_dark_and_flat(scan=scan, logger_=_logger)
163
163
  # define the process_index is any tomwer_processes_existing
164
- scan.set_process_index_frm_tomwer_process_file()
165
164
  if scan.axis_params is None:
166
165
  scan.axis_params = QAxisRP()
167
166
 
@@ -70,20 +70,6 @@ class NormIntensityWindow(_SinoNormWindow):
70
70
  self._processingThread.finished.connect(self._threadedProcessEnded)
71
71
 
72
72
  def _validated(self):
73
- scan = self.getScan()
74
- if scan is not None:
75
- with scan.acquire_process_file_lock():
76
- SinoNormalizationTask._register_process(
77
- process_file=scan.process_file,
78
- process=SinoNormalizationTask,
79
- entry=scan.entry,
80
- configuration=self.getConfiguration(),
81
- results={
82
- "method": scan.intensity_normalization.method.value,
83
- "extra_infos": scan.intensity_normalization.get_extra_infos(),
84
- },
85
- process_index=scan.pop_process_index(),
86
- )
87
73
  self.close()
88
74
 
89
75
  def _launchProcessing(self):
tomwer/app/multicor.py CHANGED
@@ -13,21 +13,17 @@ import time
13
13
 
14
14
  import silx
15
15
  from silx.gui import qt
16
- from silx.io.utils import h5py_read_dataset
17
16
 
18
- from tomwer.core.process import utils as core_utils
19
17
  from tomwer.core.process.reconstruction.axis.axis import AxisTask, NoAxisUrl
20
18
  from tomwer.core.process.reconstruction.darkref.darkrefs import (
21
19
  requires_reduced_dark_and_flat,
22
20
  )
23
21
  from tomwer.core.process.reconstruction.saaxis.saaxis import SAAxisTask
24
- from tomwer.core.process.task import Task
25
22
  from tomwer.core.scan.scanfactory import ScanFactory
26
23
  from tomwer.core.utils.resource import increase_max_number_file
27
24
  from tomwer.gui import icons
28
25
  from tomwer.gui.reconstruction.saaxis.saaxis import SAAxisWindow as _SAAxisWindow
29
26
  from tomwer.gui.utils.splashscreen import getMainSplashScreen
30
- from tomwer.io.utils.h5pyutils import EntryReader
31
27
  from tomwer.synctools.axis import QAxisRP
32
28
  from tomwer.synctools.saaxis import QSAAxisParams
33
29
 
@@ -254,7 +250,7 @@ def main(argv):
254
250
  window.setScan(scan)
255
251
  window.setDumpScoreROI(options.dump_roi)
256
252
  if options.read_existing is True:
257
- scores, selected = _load_latest_scores(scan)
253
+ scores, selected = SAAxisTask.load_results_from_disk(scan)
258
254
  if scores is not None:
259
255
  window.setCorScores(scores, score_method="standard deviation")
260
256
  if selected not in (None, "-"):
@@ -267,34 +263,6 @@ def main(argv):
267
263
  exit(app.exec_())
268
264
 
269
265
 
270
- def _load_latest_scores(scan) -> tuple:
271
- """
272
-
273
- :param scan:
274
- :return: loaded score as (scores, selected). Scores is None or a dict.
275
- selected is None or a float
276
- """
277
- scores = None
278
- selected = None
279
- if scan.process_file is None:
280
- _logger.warning(
281
- "Unable to find process file. Unable to read " "existing processing"
282
- )
283
- return scores, selected
284
-
285
- with EntryReader(scan.process_file_url) as h5f:
286
- latest_saaxis_node = Task.get_most_recent_process(h5f, SAAxisTask)
287
- if latest_saaxis_node and "results" in latest_saaxis_node:
288
- scores = core_utils.get_scores(latest_saaxis_node)
289
- if "center_of_rotation" in latest_saaxis_node["results"]:
290
- selected = h5py_read_dataset(
291
- latest_saaxis_node["results"]["center_of_rotation"]
292
- )
293
- else:
294
- _logger.warning(f"no results found for {scan}")
295
- return scores, selected
296
-
297
-
298
266
  def getinputinfo():
299
267
  return "tomwer saaxis [scanDir]"
300
268
 
tomwer/app/multipag.py CHANGED
@@ -13,9 +13,7 @@ import time
13
13
 
14
14
  import silx
15
15
  from silx.gui import qt
16
- from silx.io.utils import h5py_read_dataset
17
16
 
18
- from tomwer.core.process import utils as core_utils
19
17
  from tomwer.core.process.reconstruction.axis.axis import AxisTask, NoAxisUrl
20
18
  from tomwer.core.process.reconstruction.darkref.darkrefs import (
21
19
  requires_reduced_dark_and_flat,
@@ -27,7 +25,6 @@ from tomwer.core.process.reconstruction.utils.cor import (
27
25
  relative_pos_to_absolute,
28
26
  absolute_pos_to_relative,
29
27
  )
30
- from tomwer.core.process.task import Task
31
28
  from tomwer.core.scan.scanfactory import ScanFactory
32
29
  from tomwer.core.utils.resource import increase_max_number_file
33
30
  from tomwer.gui import icons
@@ -36,7 +33,6 @@ from tomwer.gui.reconstruction.sadeltabeta.saadeltabeta import (
36
33
  SADeltaBetaWindow as _SADeltaBetaWindow,
37
34
  )
38
35
  from tomwer.gui.utils.splashscreen import getMainSplashScreen
39
- from tomwer.io.utils.h5pyutils import EntryReader
40
36
  from tomwer.synctools.axis import QAxisRP
41
37
  from tomwer.synctools.sadeltabeta import QSADeltaBetaParams
42
38
 
@@ -328,7 +324,7 @@ def main(argv):
328
324
  scan.sa_delta_beta_params = QSADeltaBetaParams()
329
325
  window.setScan(scan)
330
326
  if options.read_existing is True:
331
- scores, selected = _load_latest_scores(scan)
327
+ scores, selected = SADeltaBetaTask.load_results_from_disk(scan)
332
328
  if scores is not None:
333
329
  window.setDBScores(scores, score_method="standard deviation")
334
330
  if selected not in (None, "-"):
@@ -350,31 +346,5 @@ def sigintHandler(*args):
350
346
  qt.QApplication.quit()
351
347
 
352
348
 
353
- def _load_latest_scores(scan) -> tuple:
354
- """
355
-
356
- :param scan:
357
- :return: loaded scores and selected score as (scores, selected).
358
- "scores" can be None or a dict. "selected" can be None or a float
359
- """
360
- scores = None
361
- selected = None
362
- if scan.process_file is None:
363
- _logger.warning(
364
- "Unable to find process file. Unable to read " "existing processing"
365
- )
366
- return scores, selected
367
-
368
- with EntryReader(scan.process_file_url) as h5f:
369
- latest_sa_db_node = Task.get_most_recent_process(h5f, SADeltaBetaTask)
370
- if latest_sa_db_node and "results" in latest_sa_db_node:
371
- scores = core_utils.get_scores(latest_sa_db_node)
372
- if "delta_beta" in latest_sa_db_node["results"]:
373
- selected = h5py_read_dataset(latest_sa_db_node["results"]["delta_beta"])
374
- else:
375
- _logger.warning(f"no results found for {scan}")
376
- return scores, selected
377
-
378
-
379
349
  if __name__ == "__main__":
380
350
  main(sys.argv)
tomwer/app/nabuapp.py CHANGED
@@ -229,7 +229,6 @@ def main(argv):
229
229
  scan = ScanFactory.create_scan_object(options.scan_path, entry=options.entry)
230
230
  widget = NabuWindow(parent=None)
231
231
  widget.setScan(scan)
232
- scan.set_process_index_frm_tomwer_process_file()
233
232
  if options.output_dir is not None:
234
233
  widget.setOutputDir(options.output_dir)
235
234
  # for the application we run for the reconstruction to be finished
@@ -103,9 +103,6 @@ def main(argv):
103
103
  scan_path=options.scan_path, entry=options.entry
104
104
  )
105
105
 
106
- # define the process_index is any tomwer_processes_existing
107
- scan.set_process_index_frm_tomwer_process_file()
108
-
109
106
  if options.debug:
110
107
  _logger.setLevel(logging.DEBUG)
111
108
 
@@ -179,7 +179,6 @@ def main(argv):
179
179
  increase_max_number_file()
180
180
 
181
181
  scan = ScanFactory.create_scan_object(options.scan_path, entry=options.entry)
182
- scan.set_process_index_frm_tomwer_process_file()
183
182
 
184
183
  dark_method = ReduceMethod.from_value(options.dark_method)
185
184
  flat_method = ReduceMethod.from_value(options.flat_method)