tomwer 1.2.8__py3-none-any.whl → 1.3.0a0__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/tutorials/icat_publication.ows +58 -0
- orangecontrib/tomwer/widgets/__init__.py +1 -0
- orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +2 -2
- orangecontrib/tomwer/widgets/control/DataListOW.py +9 -7
- orangecontrib/tomwer/widgets/control/DataSelectorOW.py +21 -10
- orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +11 -5
- orangecontrib/tomwer/widgets/control/EmailOW.py +4 -4
- orangecontrib/tomwer/widgets/control/NXTomomillOW.py +31 -18
- orangecontrib/tomwer/widgets/control/NXtomoConcatenate.py +14 -7
- orangecontrib/tomwer/widgets/control/NotifierOW.py +1 -0
- orangecontrib/tomwer/widgets/control/VolumeSelector.py +7 -4
- orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +182 -182
- orangecontrib/tomwer/widgets/debugtools/DatasetGeneratorOW.py +4 -4
- orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +4 -4
- orangecontrib/tomwer/widgets/edit/ImageKeyEditorOW.py +3 -3
- orangecontrib/tomwer/widgets/edit/ImageKeyUpgraderOW.py +2 -0
- orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +3 -3
- orangecontrib/tomwer/widgets/edit/test/test_nxtomo_editor.py +3 -3
- orangecontrib/tomwer/widgets/icat/PublishProcessedDataOW.py +115 -0
- orangecontrib/tomwer/widgets/icat/RawDataScreenshotCreatorOW.py +98 -0
- orangecontrib/tomwer/widgets/icat/SaveToGalleryAndPublishOW.py +129 -0
- orangecontrib/tomwer/widgets/icat/__init__.py +13 -0
- orangecontrib/tomwer/widgets/icat/icons/add_gallery.png +0 -0
- orangecontrib/tomwer/widgets/icat/icons/add_gallery.svg +82 -0
- orangecontrib/tomwer/widgets/icat/icons/publish_processed_data.png +0 -0
- orangecontrib/tomwer/widgets/icat/icons/publish_processed_data.svg +95 -0
- orangecontrib/tomwer/widgets/icat/icons/raw_screenshots.png +0 -0
- orangecontrib/tomwer/widgets/icat/icons/raw_screenshots.svg +143 -0
- orangecontrib/tomwer/widgets/icons/tomwer_data_portal.png +0 -0
- orangecontrib/tomwer/widgets/icons/tomwer_data_portal.svg +76 -0
- orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +9 -8
- orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +3 -3
- orangecontrib/tomwer/widgets/reconstruction/NabuHelicalPrepareWeightsDoubleOW.py +179 -169
- orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +23 -0
- orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +39 -5
- orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +7 -13
- orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +7 -17
- orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +3 -4
- orangecontrib/tomwer/widgets/visualization/LivesliceOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +3 -3
- orangecontrib/tomwer/widgets/visualization/VolumeViewerOW.py +3 -29
- tomwer/__main__.py +11 -58
- tomwer/app/canvas.py +8 -0
- tomwer/app/canvas_launcher/config.py +13 -11
- tomwer/app/darkref.py +1 -1
- tomwer/app/darkrefpatch.py +1 -1
- tomwer/app/imagekeyeditor.py +5 -5
- tomwer/app/imagekeyupgrader.py +5 -5
- tomwer/app/intensitynormalization.py +2 -2
- tomwer/app/radiostack.py +2 -2
- tomwer/app/zstitching.py +74 -3
- tomwer/core/cluster/cluster.py +26 -0
- tomwer/core/log/logger.py +7 -5
- tomwer/core/process/conditions/filters.py +1 -1
- tomwer/core/process/control/datalistener/datalistener.py +3 -3
- tomwer/core/process/control/nxtomoconcatenate.py +13 -13
- tomwer/core/process/control/nxtomomill.py +83 -25
- tomwer/core/process/control/scantransfer.py +11 -10
- tomwer/core/process/control/scanvalidator.py +3 -2
- tomwer/core/process/control/test/test_concatenate_nxtomos.py +9 -9
- tomwer/core/process/control/test/test_email.py +4 -4
- tomwer/core/process/control/test/test_h52nx_process.py +59 -7
- tomwer/core/process/control/test/test_volume_link.py +64 -64
- tomwer/core/process/control/timer.py +1 -1
- tomwer/core/process/control/volumesymlink.py +200 -200
- tomwer/core/process/edit/darkflatpatch.py +6 -6
- tomwer/core/process/edit/imagekeyeditor.py +17 -18
- tomwer/core/process/icat/__init__.py +0 -0
- tomwer/core/process/icat/createscreenshots.py +100 -0
- tomwer/core/process/icat/gallery.py +377 -0
- tomwer/core/process/icat/icatbase.py +36 -0
- tomwer/core/process/icat/publish.py +228 -0
- tomwer/core/process/icat/screenshots.py +26 -0
- tomwer/core/process/output.py +52 -0
- tomwer/core/process/reconstruction/axis/axis.py +17 -10
- tomwer/core/process/reconstruction/axis/mode.py +4 -0
- tomwer/core/process/reconstruction/axis/params.py +9 -4
- tomwer/core/process/reconstruction/darkref/darkrefs.py +8 -6
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +1 -1
- tomwer/core/process/reconstruction/darkref/params.py +1 -1
- tomwer/core/process/reconstruction/lamino/tofu.py +4 -4
- tomwer/core/process/reconstruction/nabu/castvolume.py +1 -1
- tomwer/core/process/reconstruction/nabu/helical.py +9 -5
- tomwer/core/process/reconstruction/nabu/nabucommon.py +32 -62
- tomwer/core/process/reconstruction/nabu/nabuscores.py +387 -61
- tomwer/core/process/reconstruction/nabu/nabuslices.py +33 -21
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +37 -14
- tomwer/core/process/reconstruction/nabu/settings.py +2 -2
- tomwer/core/process/reconstruction/nabu/utils.py +129 -24
- tomwer/core/process/reconstruction/output.py +108 -0
- tomwer/core/process/reconstruction/saaxis/saaxis.py +233 -263
- tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +140 -86
- tomwer/core/process/reconstruction/scores/params.py +4 -1
- tomwer/core/process/reconstruction/scores/scores.py +13 -0
- tomwer/core/process/reconstruction/test/test_axis_params.py +2 -2
- tomwer/core/process/reconstruction/test/test_darkref.py +3 -3
- tomwer/core/process/reconstruction/test/test_darkref_copy.py +3 -3
- tomwer/core/process/reconstruction/test/test_saaxis.py +3 -4
- tomwer/core/process/reconstruction/test/test_sadeltabeta.py +2 -2
- tomwer/core/process/stitching/nabustitcher.py +2 -2
- tomwer/core/process/test/test_axis.py +6 -6
- tomwer/core/process/test/test_dark_and_flat.py +10 -7
- tomwer/core/process/test/test_data_transfer.py +7 -6
- tomwer/core/process/test/test_nabu.py +4 -4
- tomwer/core/process/test/test_normalization.py +2 -2
- tomwer/core/scan/edfscan.py +4 -1
- tomwer/core/scan/hdf5scan.py +19 -500
- tomwer/core/scan/nxtomoscan.py +532 -0
- tomwer/core/scan/scanbase.py +42 -20
- tomwer/core/scan/scanfactory.py +13 -13
- tomwer/core/scan/test/test_future_scan.py +2 -2
- tomwer/core/scan/test/test_h5.py +12 -10
- tomwer/core/scan/test/test_process_registration.py +2 -2
- tomwer/core/scan/test/test_scan.py +4 -3
- tomwer/core/settings.py +20 -0
- tomwer/core/test/test_scanutils.py +8 -7
- tomwer/core/test/test_utils.py +33 -26
- tomwer/core/utils/__init__.py +0 -466
- tomwer/core/utils/deprecation.py +1 -1
- tomwer/core/utils/dictutils.py +14 -0
- tomwer/core/utils/lbsram.py +35 -0
- tomwer/core/utils/nxtomoutils.py +1 -1
- tomwer/core/utils/scanutils.py +6 -6
- tomwer/core/utils/spec.py +263 -0
- tomwer/core/volume/volumefactory.py +2 -2
- tomwer/gui/cluster/slurm.py +260 -60
- tomwer/gui/cluster/test/test_cluster.py +13 -0
- tomwer/gui/cluster/test/test_supervisor.py +2 -2
- tomwer/gui/configuration/__init__.py +0 -0
- tomwer/gui/{reconstruction/nabu → configuration}/action.py +1 -32
- tomwer/gui/configuration/level.py +22 -0
- tomwer/gui/control/actions.py +54 -0
- tomwer/gui/control/datalist.py +78 -16
- tomwer/gui/control/datalistener.py +4 -16
- tomwer/gui/control/{email.py → emailnotifier.py} +9 -18
- tomwer/gui/control/history.py +2 -2
- tomwer/gui/control/observations.py +2 -2
- tomwer/gui/control/reducedarkflatselector.py +1 -1
- tomwer/gui/control/selectorwidgetbase.py +36 -9
- tomwer/gui/control/serie/seriecreator.py +5 -22
- tomwer/gui/control/test/test_email.py +1 -1
- tomwer/gui/control/test/test_scanvalidator.py +6 -5
- tomwer/gui/control/test/test_single_tomo_obj.py +2 -2
- tomwer/gui/control/tomoobjdisplaymode.py +8 -0
- tomwer/gui/debugtools/datasetgenerator.py +3 -3
- tomwer/gui/edit/dkrfpatch.py +16 -22
- tomwer/gui/edit/imagekeyeditor.py +8 -11
- tomwer/gui/edit/nxtomoeditor.py +111 -44
- tomwer/gui/edit/nxtomowarmer.py +4 -4
- tomwer/gui/edit/test/test_dkrf_patch.py +7 -7
- tomwer/gui/edit/test/test_image_key_editor.py +3 -3
- tomwer/gui/edit/test/test_nx_editor.py +40 -16
- tomwer/gui/icat/__init__.py +0 -0
- tomwer/gui/icat/createscreenshots.py +80 -0
- tomwer/gui/icat/gallery.py +214 -0
- tomwer/gui/icat/publish.py +187 -0
- tomwer/gui/reconstruction/axis/axis.py +171 -57
- tomwer/gui/reconstruction/axis/radioaxis.py +80 -95
- tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +3 -2
- tomwer/gui/reconstruction/lamino/tofu/projections.py +1 -1
- tomwer/gui/reconstruction/lamino/tofu/tofuoutput.py +3 -6
- tomwer/gui/reconstruction/nabu/castvolume.py +1 -1
- tomwer/gui/reconstruction/nabu/check.py +9 -9
- tomwer/gui/reconstruction/nabu/helical.py +29 -12
- tomwer/gui/reconstruction/nabu/nabuconfig/base.py +2 -4
- tomwer/gui/reconstruction/nabu/nabuconfig/output.py +110 -33
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +9 -12
- tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +219 -29
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +3 -6
- tomwer/gui/reconstruction/nabu/nabuflow.py +12 -20
- tomwer/gui/reconstruction/nabu/slices.py +6 -7
- tomwer/gui/reconstruction/nabu/volume.py +22 -10
- tomwer/gui/reconstruction/normalization/intensity.py +15 -23
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +7 -23
- tomwer/gui/reconstruction/saaxis/dimensionwidget.py +1 -1
- tomwer/gui/reconstruction/saaxis/saaxis.py +7 -9
- tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +2 -1
- tomwer/gui/reconstruction/scores/control.py +2 -9
- tomwer/gui/reconstruction/scores/scoreplot.py +11 -5
- tomwer/gui/reconstruction/test/test_axis.py +23 -12
- tomwer/gui/reconstruction/test/test_lamino.py +8 -3
- tomwer/gui/reconstruction/test/test_nabu.py +28 -9
- tomwer/gui/reconstruction/test/test_saaxis.py +3 -3
- tomwer/gui/reconstruction/test/test_sadeltabeta.py +2 -2
- tomwer/gui/settings.py +5 -28
- tomwer/gui/stackplot.py +2 -5
- tomwer/gui/stitching/action.py +49 -0
- tomwer/gui/stitching/config/axisparams.py +7 -24
- tomwer/gui/stitching/config/output.py +10 -8
- tomwer/gui/stitching/config/positionoveraxis.py +22 -23
- tomwer/gui/stitching/normalization.py +117 -0
- tomwer/gui/stitching/stitchandbackground.py +4 -6
- tomwer/gui/stitching/stitching.py +265 -43
- tomwer/gui/stitching/stitching_preview.py +62 -5
- tomwer/gui/stitching/stitching_raw.py +2 -5
- tomwer/gui/stitching/z_stitching/fineestimation.py +0 -60
- tomwer/gui/utils/buttons.py +112 -29
- tomwer/gui/utils/inputwidget.py +33 -25
- tomwer/gui/utils/scandescription.py +4 -0
- tomwer/gui/utils/step.py +144 -0
- tomwer/gui/utils/unitsystem.py +2 -5
- tomwer/gui/utils/vignettes.py +176 -15
- tomwer/gui/visualization/dataviewer.py +1 -18
- tomwer/gui/visualization/diffviewer/diffviewer.py +7 -16
- tomwer/gui/visualization/diffviewer/shiftwidget.py +2 -5
- tomwer/gui/visualization/scanoverview.py +1 -1
- tomwer/gui/visualization/sinogramviewer.py +1 -10
- tomwer/gui/visualization/test/test_diffviewer.py +3 -3
- tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +4 -4
- tomwer/gui/visualization/test/test_sinogramviewer.py +2 -2
- tomwer/gui/visualization/test/test_stacks.py +3 -3
- tomwer/gui/visualization/test/test_volumeviewer.py +2 -2
- tomwer/io/utils/raw_and_processed_data.py +84 -0
- tomwer/io/utils/tomoobj.py +4 -6
- tomwer/resources/gui/icons/ruler.png +0 -0
- tomwer/resources/gui/icons/ruler.svg +273 -0
- tomwer/resources/gui/icons/short_description.png +0 -0
- tomwer/resources/gui/icons/short_description.svg +58 -0
- tomwer/resources/gui/icons/url.png +0 -0
- tomwer/resources/gui/icons/url.svg +58 -0
- tomwer/synctools/stacks/edit/darkflatpatch.py +2 -2
- tomwer/synctools/stacks/edit/imagekeyeditor.py +2 -2
- tomwer/synctools/stacks/reconstruction/axis.py +4 -4
- tomwer/synctools/stacks/reconstruction/castvolume.py +2 -2
- tomwer/synctools/stacks/reconstruction/dkrefcopy.py +4 -10
- tomwer/synctools/stacks/reconstruction/nabu.py +2 -2
- tomwer/synctools/stacks/reconstruction/normalization.py +2 -2
- tomwer/synctools/stacks/reconstruction/saaxis.py +2 -2
- tomwer/synctools/stacks/reconstruction/sadeltabeta.py +2 -2
- tomwer/synctools/test/test_darkRefs.py +7 -58
- tomwer/synctools/test/test_foldertransfer.py +6 -6
- tomwer/synctools/utils/scanstages.py +6 -6
- tomwer/tests/conftest.py +34 -0
- tomwer/tests/datasets.py +13 -0
- tomwer/tests/test_scripts.py +92 -39
- tomwer/tests/utils.py +5 -0
- tomwer/version.py +3 -3
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/METADATA +39 -44
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/RECORD +248 -209
- tomwer/resources/gui/icons/esrf_1.svg +0 -307
- tomwer/resources/gui/icons/triangle.svg +0 -80
- tomwer/synctools/test/test_scanstages.py +0 -162
- tomwer/tests/utils/__init__.py +0 -247
- tomwer/tests/utils/utilstest.py +0 -220
- /tomwer/app/{saaxis.py → multicor.py} +0 -0
- /tomwer/app/{sadeltabeta.py → multipag.py} +0 -0
- /tomwer/core/process/control/{email.py → emailnotifier.py} +0 -0
- /tomwer-1.2.8-py3.11-nspkg.pth → /tomwer-1.3.0a0-py3.11-nspkg.pth +0 -0
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/LICENSE +0 -0
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/WHEEL +0 -0
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/entry_points.txt +0 -0
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.2.8.dist-info → tomwer-1.3.0a0.dist-info}/top_level.txt +0 -0
@@ -39,6 +39,7 @@ from typing import Optional, Union
|
|
39
39
|
|
40
40
|
import h5py
|
41
41
|
import numpy
|
42
|
+
from multiprocessing import Pool
|
42
43
|
from nabu.pipeline.config import get_default_nabu_config
|
43
44
|
from nabu.pipeline.fullfield.nabu_config import (
|
44
45
|
nabu_config as nabu_fullfield_default_config,
|
@@ -65,7 +66,7 @@ from tomwer.core.process.reconstruction.scores import (
|
|
65
66
|
from tomwer.core.utils.locker import FileLockerManager
|
66
67
|
from tomwer.core.process.task import Task
|
67
68
|
from tomwer.core.progress import Progress
|
68
|
-
from tomwer.core.scan.
|
69
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
69
70
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
70
71
|
from tomwer.core.scan.scanfactory import ScanFactory
|
71
72
|
from tomwer.core.utils import logconfig
|
@@ -135,6 +136,8 @@ class SADeltaBetaTask(
|
|
135
136
|
"dump_roi",
|
136
137
|
"dump_process",
|
137
138
|
"serialize_output_data",
|
139
|
+
"compute_scores", # for GUI we want to post pone the score calculation
|
140
|
+
"pool_size",
|
138
141
|
),
|
139
142
|
):
|
140
143
|
"""
|
@@ -142,6 +145,8 @@ class SADeltaBetaTask(
|
|
142
145
|
several Center Of Rotation (cor) values
|
143
146
|
"""
|
144
147
|
|
148
|
+
DEFAULT_POOL_SIZE = 10
|
149
|
+
|
145
150
|
def __init__(
|
146
151
|
self,
|
147
152
|
process_id=None,
|
@@ -221,6 +226,17 @@ class SADeltaBetaTask(
|
|
221
226
|
scan.sa_delta_beta_params.value = best_db
|
222
227
|
return best_db
|
223
228
|
|
229
|
+
def get_output_dir(self, params: SADeltaBetaParams, scan: TomwerScanBase):
|
230
|
+
output_dir = params.output_dir or None
|
231
|
+
|
232
|
+
if params.output_dir is None:
|
233
|
+
output_dir = (
|
234
|
+
params.nabu_params.get("output", {}).get("location", None) or None
|
235
|
+
)
|
236
|
+
if output_dir is None:
|
237
|
+
output_dir = os.path.join(scan.path, DEFAULT_RECONS_FOLDER)
|
238
|
+
return output_dir
|
239
|
+
|
224
240
|
def run(self):
|
225
241
|
scan = data_identifier_to_scan(self.inputs.data)
|
226
242
|
if scan is None:
|
@@ -247,14 +263,12 @@ class SADeltaBetaTask(
|
|
247
263
|
scan.axis_params = AxisRP()
|
248
264
|
|
249
265
|
# create dir if does not exists
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
os.makedirs(params.output_dir)
|
266
|
+
params.output_dir = self.get_output_dir(params=params, scan=scan)
|
267
|
+
if not os.path.exists(params.output_dir):
|
268
|
+
os.makedirs(params.output_dir)
|
254
269
|
|
255
270
|
slice_index = self._preprocess_slice_index(params.slice_indexes)
|
256
271
|
delta_beta_s = params.delta_beta_values
|
257
|
-
output_dir = params.output_dir
|
258
272
|
# TODO: check: dry run should only be settable at one location
|
259
273
|
dry_run = self._dry_run or params.dry_run
|
260
274
|
cluster_config = params.cluster_config
|
@@ -265,7 +279,7 @@ class SADeltaBetaTask(
|
|
265
279
|
scan=scan,
|
266
280
|
config=nabu_config,
|
267
281
|
delta_beta_s=delta_beta_s,
|
268
|
-
output_dir=output_dir,
|
282
|
+
output_dir=params.output_dir,
|
269
283
|
)
|
270
284
|
# step 2: run reconstructions
|
271
285
|
advancement = Progress(
|
@@ -307,20 +321,23 @@ class SADeltaBetaTask(
|
|
307
321
|
)
|
308
322
|
|
309
323
|
# step 4: run post processing (compute score for each slice)
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
324
|
+
if self.get_input_value("compute_scores", True):
|
325
|
+
try:
|
326
|
+
dbs_res, rois = self._post_processing(
|
327
|
+
scan=scan,
|
328
|
+
db_reconstructions=dbs_res,
|
329
|
+
)
|
330
|
+
except Exception as e:
|
331
|
+
_logger.error(e)
|
332
|
+
mess = f"sa-delta-beta -post-processing- computation for {str(scan)} failed."
|
333
|
+
state = DatasetState.FAILED
|
334
|
+
dbs_res = {}
|
335
|
+
else:
|
336
|
+
state = DatasetState.WAIT_USER_VALIDATION
|
337
|
+
self.delta_beta_s = scan.sa_delta_beta_params.autofocus
|
338
|
+
mess = "sa-delta-beta computation succeeded"
|
320
339
|
else:
|
321
|
-
|
322
|
-
self.delta_beta_s = scan.sa_delta_beta_params.autofocus
|
323
|
-
mess = "sa-delta-beta computation succeeded"
|
340
|
+
dbs_res = {}
|
324
341
|
|
325
342
|
if self._cancelled:
|
326
343
|
state = DatasetState.CANCELLED
|
@@ -407,7 +424,7 @@ class SADeltaBetaTask(
|
|
407
424
|
slice_index,
|
408
425
|
advancement,
|
409
426
|
dry_run,
|
410
|
-
cluster_config,
|
427
|
+
cluster_config: Optional[dict],
|
411
428
|
):
|
412
429
|
future_tomo_objs = {}
|
413
430
|
success = True
|
@@ -415,6 +432,11 @@ class SADeltaBetaTask(
|
|
415
432
|
std_outs = []
|
416
433
|
std_errs = []
|
417
434
|
|
435
|
+
if not isinstance(cluster_config, (dict, type(None))):
|
436
|
+
raise TypeError(
|
437
|
+
f"'cluster_config' is expected to be a dict or None. Get {type(cluster_config)} instead."
|
438
|
+
)
|
439
|
+
|
418
440
|
runners = run_nabu_one_slice_several_config(
|
419
441
|
nabu_configs=configs,
|
420
442
|
scan=scan,
|
@@ -422,9 +444,7 @@ class SADeltaBetaTask(
|
|
422
444
|
dry_run=dry_run,
|
423
445
|
file_format="hdf5",
|
424
446
|
advancement=advancement,
|
425
|
-
cluster_config=cluster_config
|
426
|
-
if cluster_config is not None
|
427
|
-
else None,
|
447
|
+
cluster_config=cluster_config,
|
428
448
|
process_id=self.process_id,
|
429
449
|
instanciate_classes_only=True,
|
430
450
|
output_file_prefix_pattern=None,
|
@@ -449,9 +469,14 @@ class SADeltaBetaTask(
|
|
449
469
|
if isinstance(res, ResultsWithStd):
|
450
470
|
std_outs.append(res.std_out)
|
451
471
|
std_errs.append(res.std_err)
|
452
|
-
if
|
453
|
-
|
454
|
-
|
472
|
+
if (
|
473
|
+
isinstance(res, ResultsLocalRun)
|
474
|
+
and len(res.results_identifiers) > 0
|
475
|
+
):
|
476
|
+
assert (
|
477
|
+
len(res.results_identifiers) == 1
|
478
|
+
), "only one slice expected"
|
479
|
+
recons_urls[db] = res.results_identifiers[0]
|
455
480
|
if isinstance(res, ResultSlurmRun):
|
456
481
|
future_tomo_obj = FutureTomwerObject(
|
457
482
|
tomo_obj=scan,
|
@@ -473,6 +498,7 @@ class SADeltaBetaTask(
|
|
473
498
|
post_processing = _PostProcessing(
|
474
499
|
scan=scan,
|
475
500
|
db_reconstructions=db_reconstructions,
|
501
|
+
pool_size=self.get_input_value("pool_size", self.DEFAULT_POOL_SIZE),
|
476
502
|
)
|
477
503
|
post_processing._cancelled = self._cancelled
|
478
504
|
self._current_processing = post_processing
|
@@ -518,9 +544,6 @@ class SADeltaBetaTask(
|
|
518
544
|
file_format=nabu_config.get("file_format", "hdf5"),
|
519
545
|
scan=scan,
|
520
546
|
slice_index=None,
|
521
|
-
start_z=None,
|
522
|
-
end_z=None,
|
523
|
-
expects_single_slice=True,
|
524
547
|
)
|
525
548
|
|
526
549
|
assert len(volume_identifier) <= 1, "only one slice expected"
|
@@ -635,7 +658,7 @@ class SADeltaBetaTask(
|
|
635
658
|
def process_to_tomwer_processes(scan):
|
636
659
|
if scan.process_file is not None:
|
637
660
|
entry = "entry"
|
638
|
-
if isinstance(scan,
|
661
|
+
if isinstance(scan, NXtomoScan):
|
639
662
|
entry = scan.entry
|
640
663
|
|
641
664
|
db = None
|
@@ -712,76 +735,107 @@ class SADeltaBetaTask(
|
|
712
735
|
class _PostProcessing:
|
713
736
|
"""class used to run SA-delta-beta post-processing on reconstructed slices"""
|
714
737
|
|
715
|
-
|
738
|
+
DEFAULT_POOL_SIZE = 10
|
739
|
+
|
740
|
+
def __init__(self, db_reconstructions, scan, pool_size) -> None:
|
716
741
|
self._db_reconstructions = db_reconstructions
|
717
742
|
self._scan = scan
|
718
743
|
self._cancelled = False
|
744
|
+
self.pool_size = pool_size
|
745
|
+
|
746
|
+
@staticmethod
|
747
|
+
def compute_score(item: tuple):
|
748
|
+
db, (url, data), mask_disk_radius, cancelled = item
|
749
|
+
if data is None:
|
750
|
+
score = None
|
751
|
+
data_roi = None
|
752
|
+
else:
|
753
|
+
assert data.ndim == 2
|
754
|
+
data_roi = apply_roi(data=data, radius=mask_disk_radius, url=url)
|
755
|
+
|
756
|
+
# move data_roi to [0-1] range
|
757
|
+
# preprocessing: get percentile 0 and 99 from image and
|
758
|
+
# "clean" highest and lowest pixels from it
|
759
|
+
min_p, max_p = numpy.percentile(data_roi, (1, 99))
|
760
|
+
data_roi_int = data_roi[...]
|
761
|
+
data_roi_int[data_roi_int < min_p] = min_p
|
762
|
+
data_roi_int[data_roi_int > max_p] = max_p
|
763
|
+
data_roi_int = (data_roi_int - min_p) / (max_p - min_p)
|
764
|
+
|
765
|
+
score = ComputedScore(
|
766
|
+
tv=compute_score(data=data_roi_int, method=ScoreMethod.TV),
|
767
|
+
std=compute_score(data=data_roi_int, method=ScoreMethod.STD),
|
768
|
+
)
|
769
|
+
return {db: (url, score)}, {db: data_roi}
|
719
770
|
|
720
771
|
def run(self):
|
721
772
|
datasets = self.load_datasets()
|
722
|
-
|
773
|
+
assert isinstance(datasets, dict)
|
723
774
|
mask_disk_radius = get_disk_mask_radius(datasets)
|
775
|
+
with Pool(self.pool_size) as pool:
|
776
|
+
res = pool.map(
|
777
|
+
self.compute_score,
|
778
|
+
[
|
779
|
+
(
|
780
|
+
*item,
|
781
|
+
mask_disk_radius,
|
782
|
+
self._cancelled,
|
783
|
+
)
|
784
|
+
for item in datasets.items()
|
785
|
+
],
|
786
|
+
)
|
724
787
|
scores = {}
|
725
788
|
rois = {}
|
726
|
-
for
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
assert data.ndim == 2
|
731
|
-
data_roi = apply_roi(data=data, radius=mask_disk_radius, url=url)
|
732
|
-
rois[db] = data_roi
|
733
|
-
|
734
|
-
# move data_roi to [0-1] range
|
735
|
-
# preprocessing: get percentile 0 and 99 from image and
|
736
|
-
# "clean" highest and lowest pixels from it
|
737
|
-
min_p, max_p = numpy.percentile(data_roi, (1, 99))
|
738
|
-
data_roi_int = data_roi[...]
|
739
|
-
data_roi_int[data_roi_int < min_p] = min_p
|
740
|
-
data_roi_int[data_roi_int > max_p] = max_p
|
741
|
-
data_roi_int = (data_roi_int - min_p) / (max_p - min_p)
|
742
|
-
|
743
|
-
score = ComputedScore(
|
744
|
-
tv=compute_score(data=data_roi_int, method=ScoreMethod.TV),
|
745
|
-
std=compute_score(data=data_roi_int, method=ScoreMethod.STD),
|
746
|
-
)
|
747
|
-
scores[db] = (url, score)
|
789
|
+
for mydict in res:
|
790
|
+
myscores, myrois = mydict
|
791
|
+
scores.update(myscores)
|
792
|
+
rois.update(myrois)
|
748
793
|
return scores, rois
|
749
794
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
_logger.warning(
|
762
|
-
f"found a volume with mode that one url ({volumes_urls})"
|
763
|
-
)
|
764
|
-
slice_url = volumes_urls[0]
|
765
|
-
data = get_data(slice_url)
|
766
|
-
except Exception as e:
|
767
|
-
_logger.error(
|
768
|
-
f"Fail to compute a score for {volume_identifier}. Reason is {e}"
|
795
|
+
@staticmethod
|
796
|
+
def _load_dataset(item: tuple):
|
797
|
+
db, volume_identifier = item
|
798
|
+
slice_url = None
|
799
|
+
# in case the try processing fails
|
800
|
+
try:
|
801
|
+
volume = VolumeFactory.create_tomo_object_from_identifier(volume_identifier)
|
802
|
+
volumes_urls = tuple(volume.browse_data_urls())
|
803
|
+
if len(volumes_urls) > 1:
|
804
|
+
_logger.warning(
|
805
|
+
f"found a volume with mode that one url ({volumes_urls})"
|
769
806
|
)
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
807
|
+
slice_url = volumes_urls[0]
|
808
|
+
data = get_data(slice_url)
|
809
|
+
except Exception as e:
|
810
|
+
_logger.error(
|
811
|
+
f"Fail to compute a score for {volume_identifier}. Reason is {e}"
|
812
|
+
)
|
813
|
+
return {db: (slice_url, None)}
|
814
|
+
else:
|
815
|
+
if data.ndim == 3:
|
816
|
+
if data.shape[0] == 1:
|
817
|
+
data = data.reshape(data.shape[1], data.shape[2])
|
818
|
+
elif data.shape[2] == 1:
|
819
|
+
data = data.reshape(data.shape[0], data.shape[1])
|
781
820
|
else:
|
782
821
|
raise ValueError(f"Data is expected to be 2D. Not {data.ndim}D")
|
822
|
+
elif data.ndim == 2:
|
823
|
+
pass
|
824
|
+
else:
|
825
|
+
raise ValueError(f"Data is expected to be 2D. Not {data.ndim}D")
|
826
|
+
|
827
|
+
return {db: (slice_url, data)}
|
828
|
+
|
829
|
+
def load_datasets(self):
|
830
|
+
with Pool(self.pool_size) as pool:
|
831
|
+
res = pool.map(
|
832
|
+
self._load_dataset,
|
833
|
+
self._db_reconstructions.items(),
|
834
|
+
)
|
835
|
+
datasets_ = {}
|
836
|
+
for mydict in res:
|
837
|
+
datasets_.update(mydict)
|
783
838
|
|
784
|
-
datasets_[db] = (slice_url, data)
|
785
839
|
return datasets_
|
786
840
|
|
787
841
|
def cancel(self):
|
@@ -117,6 +117,7 @@ class SABaseParams:
|
|
117
117
|
|
118
118
|
@property
|
119
119
|
def output_dir(self) -> Union[str, None]:
|
120
|
+
"""nabu cfg_files output dir. If not provided will use nabu slice output with saaxis/cfg_files as postfix"""
|
120
121
|
return self._output_dir
|
121
122
|
|
122
123
|
@output_dir.setter
|
@@ -163,7 +164,9 @@ class SABaseParams:
|
|
163
164
|
|
164
165
|
@cluster_config.setter
|
165
166
|
def cluster_config(self, config: Optional[dict]):
|
166
|
-
if
|
167
|
+
if isinstance(config, SlurmClusterConfiguration):
|
168
|
+
config = config.to_dict()
|
169
|
+
if not isinstance(config, (dict, type(None))):
|
167
170
|
raise TypeError(
|
168
171
|
"config is expected to be None, a dict or SlurmClusterConfiguration"
|
169
172
|
)
|
@@ -79,6 +79,19 @@ class ComputedScore:
|
|
79
79
|
else:
|
80
80
|
raise ValueError(f"{method} is an unrecognized method")
|
81
81
|
|
82
|
+
def __eq__(self, __value: object) -> bool:
|
83
|
+
if not isinstance(__value, ComputedScore):
|
84
|
+
return False
|
85
|
+
else:
|
86
|
+
return (
|
87
|
+
self.total_variation == __value.total_variation
|
88
|
+
and self.std == __value.std
|
89
|
+
and self.tomo_consistency == __value.tomo_consistency
|
90
|
+
)
|
91
|
+
|
92
|
+
def __str__(self) -> str:
|
93
|
+
return f"std: {self.std} - tv: {self.total_variation} - tomo-consistency: {self.tomo_consistency}"
|
94
|
+
|
82
95
|
|
83
96
|
def compute_tomo_consistency(
|
84
97
|
data: numpy.ndarray,
|
@@ -7,7 +7,7 @@ from tomwer.core.process.reconstruction.axis.params import (
|
|
7
7
|
AxisCalculationInput,
|
8
8
|
AxisResource,
|
9
9
|
)
|
10
|
-
from tomwer.core.utils.scanutils import
|
10
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
11
11
|
|
12
12
|
|
13
13
|
def test_axis_resource(tmp_path):
|
@@ -15,7 +15,7 @@ def test_axis_resource(tmp_path):
|
|
15
15
|
Test AxisResource class
|
16
16
|
"""
|
17
17
|
|
18
|
-
mock =
|
18
|
+
mock = MockNXtomo(
|
19
19
|
scan_path=os.path.join(tmp_path, "scan1"),
|
20
20
|
n_proj=10,
|
21
21
|
n_ini_proj=10,
|
@@ -31,7 +31,7 @@ __date__ = "24/11/2021"
|
|
31
31
|
from tomwer.core.process.reconstruction.darkref.darkrefs import (
|
32
32
|
requires_reduced_dark_and_flat,
|
33
33
|
)
|
34
|
-
from tomwer.core.utils.scanutils import MockEDF,
|
34
|
+
from tomwer.core.utils.scanutils import MockEDF, MockNXtomo
|
35
35
|
|
36
36
|
|
37
37
|
def test_quick_run_necessary_edf(tmpdir):
|
@@ -45,8 +45,8 @@ def test_quick_run_necessary_edf(tmpdir):
|
|
45
45
|
|
46
46
|
|
47
47
|
def test_quick_run_necessary_hdf5(tmpdir):
|
48
|
-
"""test the `quick_run_necessary` function for
|
49
|
-
scan =
|
48
|
+
"""test the `quick_run_necessary` function for NXtomoScan"""
|
49
|
+
scan = MockNXtomo(
|
50
50
|
scan_path=tmpdir,
|
51
51
|
n_proj=20,
|
52
52
|
n_ini_proj=20,
|
@@ -5,7 +5,7 @@ import pytest
|
|
5
5
|
from silx.io.dictdump import dicttoh5
|
6
6
|
|
7
7
|
from tomwer.core.process.reconstruction.darkref.darkrefscopy import DarkRefsCopy
|
8
|
-
from tomwer.core.utils.scanutils import
|
8
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
9
9
|
|
10
10
|
|
11
11
|
@pytest.mark.parametrize(
|
@@ -32,7 +32,7 @@ def test_register_and_copy_darks_and_flats(
|
|
32
32
|
for my_dir in (save_dir, scan_folder_with_raw, scan_folder_without_raw):
|
33
33
|
os.makedirs(my_dir)
|
34
34
|
|
35
|
-
scan_with_raw =
|
35
|
+
scan_with_raw = MockNXtomo(
|
36
36
|
scan_path=scan_folder_with_raw,
|
37
37
|
create_ini_dark=True,
|
38
38
|
create_ini_ref=True,
|
@@ -41,7 +41,7 @@ def test_register_and_copy_darks_and_flats(
|
|
41
41
|
n_ini_proj=10,
|
42
42
|
dim=12,
|
43
43
|
).scan
|
44
|
-
scan_without_raw =
|
44
|
+
scan_without_raw = MockNXtomo(
|
45
45
|
scan_path=scan_folder_without_raw,
|
46
46
|
create_ini_dark=False,
|
47
47
|
create_ini_ref=False,
|
@@ -41,7 +41,7 @@ from tomwer.core.process.reconstruction.scores.scores import (
|
|
41
41
|
_METHOD_TO_FCT,
|
42
42
|
compute_score_contrast_std,
|
43
43
|
)
|
44
|
-
from tomwer.core.utils.scanutils import
|
44
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
45
45
|
|
46
46
|
|
47
47
|
class TestScoreFunctions(unittest.TestCase):
|
@@ -69,7 +69,7 @@ class TestSAAxisProcess(unittest.TestCase):
|
|
69
69
|
def setUp(self) -> None:
|
70
70
|
self.tempdir = tempfile.mkdtemp()
|
71
71
|
dim = 10
|
72
|
-
mock =
|
72
|
+
mock = MockNXtomo(
|
73
73
|
scan_path=self.tempdir, n_proj=10, n_ini_proj=10, scan_range=180, dim=dim
|
74
74
|
)
|
75
75
|
mock.add_alignment_radio(index=10, angle=90)
|
@@ -96,8 +96,7 @@ class TestSAAxisProcess(unittest.TestCase):
|
|
96
96
|
"serialize_output_data": False,
|
97
97
|
}
|
98
98
|
)
|
99
|
-
|
100
|
-
process.run()
|
99
|
+
|
101
100
|
self._default_saaxis_params.estimated_cor = 11
|
102
101
|
self._default_saaxis_params.research_width = 2
|
103
102
|
process = SAAxisTask(
|
@@ -37,7 +37,7 @@ from tomwer.core.process.reconstruction.sadeltabeta.sadeltabeta import (
|
|
37
37
|
SADeltaBetaParams,
|
38
38
|
SADeltaBetaTask,
|
39
39
|
)
|
40
|
-
from tomwer.core.utils.scanutils import
|
40
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
41
41
|
|
42
42
|
|
43
43
|
class TestSADeltaBetaProcess(unittest.TestCase):
|
@@ -47,7 +47,7 @@ class TestSADeltaBetaProcess(unittest.TestCase):
|
|
47
47
|
super().setUp()
|
48
48
|
self.tempdir = tempfile.mkdtemp()
|
49
49
|
dim = 10
|
50
|
-
mock =
|
50
|
+
mock = MockNXtomo(
|
51
51
|
scan_path=self.tempdir, n_proj=10, n_ini_proj=10, scan_range=180, dim=dim
|
52
52
|
)
|
53
53
|
self.scan = mock.scan
|
@@ -21,7 +21,7 @@ from nabu.stitching.slurm_utils import split_stitching_configuration_to_slurm_jo
|
|
21
21
|
from processview.core.superviseprocess import SuperviseProcess
|
22
22
|
|
23
23
|
from tomwer.core.process.task import Task
|
24
|
-
from tomwer.core.scan.
|
24
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
25
25
|
from tomwer.core.scan.scanfactory import ScanFactory
|
26
26
|
from tomwer.core.futureobject import FutureTomwerObject
|
27
27
|
from tomwer.core.volume.volumefactory import VolumeFactory
|
@@ -112,7 +112,7 @@ class StitcherTask(
|
|
112
112
|
if config.stitching_type is StitchingType.Z_PREPROC:
|
113
113
|
output_nx_tomo_file = config.output_file_path
|
114
114
|
output_nx_tomo_entry = config.output_data_path
|
115
|
-
tomwer_scan =
|
115
|
+
tomwer_scan = NXtomoScan(
|
116
116
|
scan=output_nx_tomo_file, entry=output_nx_tomo_entry
|
117
117
|
)
|
118
118
|
self.outputs.future_tomo_obj = FutureTomwerObject(
|
@@ -42,8 +42,8 @@ from tomwer.core.process.reconstruction.axis.params import AxisRP
|
|
42
42
|
from tomwer.core.process.task import Task
|
43
43
|
from tomwer.core.scan.edfscan import EDFTomoScan
|
44
44
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
45
|
-
from tomwer.core.utils.scanutils import MockEDF,
|
46
|
-
from tomwer.tests.
|
45
|
+
from tomwer.core.utils.scanutils import MockEDF, MockNXtomo
|
46
|
+
from tomwer.tests.datasets import TomwerCIDatasets
|
47
47
|
|
48
48
|
from ..reconstruction.axis.axis import AxisTask
|
49
49
|
|
@@ -163,7 +163,7 @@ class TestAxis(unittest.TestCase):
|
|
163
163
|
"""
|
164
164
|
self.tempdir = tempfile.mkdtemp()
|
165
165
|
dim = 10
|
166
|
-
mock =
|
166
|
+
mock = MockNXtomo(
|
167
167
|
scan_path=self.tempdir, n_proj=10, n_ini_proj=10, scan_range=180, dim=dim
|
168
168
|
)
|
169
169
|
mock.add_alignment_radio(index=10, angle=90)
|
@@ -234,8 +234,8 @@ class TestAxisRP(unittest.TestCase):
|
|
234
234
|
self.axis_rp.set_position_frm_par_file(existing_empty_file, force=False)
|
235
235
|
self.assertEqual(self.axis_rp.value_ref_tomwer, old_value)
|
236
236
|
|
237
|
-
valid_par_file =
|
238
|
-
|
237
|
+
valid_par_file = TomwerCIDatasets.get_dataset(
|
238
|
+
"edf_datasets/scan_3_/scan_3_slice.par"
|
239
239
|
)
|
240
240
|
assert os.path.isfile(valid_par_file)
|
241
241
|
self.axis_rp.set_position_frm_par_file(valid_par_file, force=False)
|
@@ -255,7 +255,7 @@ class TestSinogramAlgorithm(unittest.TestCase):
|
|
255
255
|
def setUp(self) -> None:
|
256
256
|
self.tmp_folder = tempfile.mkdtemp()
|
257
257
|
dim = 512
|
258
|
-
self.scan =
|
258
|
+
self.scan = MockNXtomo(
|
259
259
|
scan_path=self.tmp_folder,
|
260
260
|
n_proj=10,
|
261
261
|
n_ini_proj=10,
|
@@ -38,10 +38,10 @@ from tomoscan.esrf.scan.utils import get_data
|
|
38
38
|
|
39
39
|
from tomwer.core.process.reconstruction.darkref.params import DKRFRP
|
40
40
|
from tomwer.core.process.reconstruction.darkref.params import ReduceMethod as cMethod
|
41
|
-
from tomwer.core.scan.
|
41
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
42
42
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
43
|
-
from tomwer.core.utils.scanutils import MockEDF,
|
44
|
-
from tomwer.tests.
|
43
|
+
from tomwer.core.utils.scanutils import MockEDF, MockNXtomo
|
44
|
+
from tomwer.tests.datasets import TomwerCIDatasets
|
45
45
|
|
46
46
|
from ..reconstruction.darkref.darkrefs import DarkRefsTask
|
47
47
|
from ..reconstruction.darkref.darkrefscopy import DarkRefsCopy
|
@@ -56,7 +56,9 @@ class TestDarkRefIO(unittest.TestCase):
|
|
56
56
|
self.scan_edf = MockEDF.mockScan(
|
57
57
|
scanID=self.scan_folder, nRadio=10, nRecons=1, nPagRecons=4, dim=10
|
58
58
|
)
|
59
|
-
self.mock_hdf5 =
|
59
|
+
self.mock_hdf5 = MockNXtomo(
|
60
|
+
scan_path=self.scan_folder, n_proj=10, n_pag_recons=0
|
61
|
+
)
|
60
62
|
self.scan_hdf5 = self.mock_hdf5.scan
|
61
63
|
|
62
64
|
self.recons_params = DKRFRP()
|
@@ -102,7 +104,7 @@ class TestDarkRefCopyIO(unittest.TestCase):
|
|
102
104
|
self.scan_edf = MockEDF.mockScan(
|
103
105
|
scanID=self.scan_folder, nRadio=10, nRecons=1, nPagRecons=4, dim=10
|
104
106
|
)
|
105
|
-
self.scan_hdf5 =
|
107
|
+
self.scan_hdf5 = MockNXtomo(
|
106
108
|
scan_path=self.scan_folder, n_proj=10, n_pag_recons=0
|
107
109
|
).scan
|
108
110
|
self.recons_params = DKRFRP()
|
@@ -256,9 +258,10 @@ class TestDarkRefNx(unittest.TestCase):
|
|
256
258
|
self.scan_folder = tempfile.mkdtemp()
|
257
259
|
self._file_path = os.path.join(self.scan_folder, dataset_name)
|
258
260
|
shutil.copyfile(
|
259
|
-
src=
|
261
|
+
src=TomwerCIDatasets.get_dataset(f"h5_datasets/{dataset_name}"),
|
262
|
+
dst=self._file_path,
|
260
263
|
)
|
261
|
-
self.scan =
|
264
|
+
self.scan = NXtomoScan(scan=self._file_path, entry="entry0000")
|
262
265
|
self.assertFalse(os.path.exists(self.scan.process_file))
|
263
266
|
self.recons_params = DKRFRP()
|
264
267
|
self.recons_params.overwrite_dark = True
|
@@ -40,17 +40,18 @@ import numpy
|
|
40
40
|
import pytest
|
41
41
|
from nxtomomill.converter import from_h5_to_nx
|
42
42
|
from nxtomomill.io.config.hdf5config import TomoHDF5Config
|
43
|
-
from
|
43
|
+
from nxtomo.nxobject.nxdetector import ImageKey
|
44
|
+
|
44
45
|
from tomoscan.io import HDF5File
|
45
46
|
from tomoscan.validator import is_valid_for_reconstruction
|
46
47
|
|
47
48
|
from tomwer.core.process.control.datalistener import DataListener
|
48
49
|
from tomwer.core.process.control.scantransfer import ScanTransferTask
|
49
|
-
from tomwer.core.scan.
|
50
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
50
51
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
51
52
|
from tomwer.core.utils.scanutils import MockEDF
|
52
53
|
from tomwer.synctools.rsyncmanager import RSyncManager
|
53
|
-
from tomwer.tests.
|
54
|
+
from tomwer.tests.datasets import TomwerCIDatasets
|
54
55
|
|
55
56
|
|
56
57
|
class TestDataTransferIO(unittest.TestCase):
|
@@ -119,7 +120,7 @@ class TestBlissDataTransfer(unittest.TestCase):
|
|
119
120
|
self.input_dir = tempfile.mkdtemp()
|
120
121
|
self.output_dir = tempfile.mkdtemp()
|
121
122
|
shutil.copytree(
|
122
|
-
|
123
|
+
TomwerCIDatasets.get_dataset("bliss/sample"),
|
123
124
|
os.path.join(self.input_dir, "sample"),
|
124
125
|
)
|
125
126
|
|
@@ -204,7 +205,7 @@ class TestBlissDataTransfer(unittest.TestCase):
|
|
204
205
|
configuration.file_extension = ".nx"
|
205
206
|
from_h5_to_nx(configuration, input_callback=lambda *arg: 0)
|
206
207
|
assert os.path.exists(output_file)
|
207
|
-
assert is_valid_for_reconstruction(
|
208
|
+
assert is_valid_for_reconstruction(NXtomoScan(output_file, entry="entry0000"))
|
208
209
|
|
209
210
|
|
210
211
|
@pytest.mark.skipif(not RSyncManager().has_rsync(), reason="requires rsync")
|
@@ -319,7 +320,7 @@ class NXTomoDataTransferBase(unittest.TestCase):
|
|
319
320
|
return super().tearDown()
|
320
321
|
|
321
322
|
def _test(self):
|
322
|
-
src_scan =
|
323
|
+
src_scan = NXtomoScan(self.nexus_file_path, entry="entry0000")
|
323
324
|
assert is_valid_for_reconstruction(src_scan)
|
324
325
|
process = ScanTransferTask(
|
325
326
|
inputs={
|