tomwer 1.2.1__py3-none-any.whl → 1.3.12__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 +11 -11
- orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +2 -2
- orangecontrib/tomwer/widgets/control/DataListOW.py +9 -7
- orangecontrib/tomwer/widgets/control/DataListenerOW.py +6 -6
- orangecontrib/tomwer/widgets/control/DataSelectorOW.py +21 -10
- orangecontrib/tomwer/widgets/control/DataValidatorOW.py +6 -6
- orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +24 -7
- orangecontrib/tomwer/widgets/control/EmailOW.py +4 -4
- orangecontrib/tomwer/widgets/control/NXTomomillMixIn.py +3 -3
- orangecontrib/tomwer/widgets/control/NXTomomillOW.py +64 -23
- orangecontrib/tomwer/widgets/control/NXtomoConcatenate.py +20 -8
- orangecontrib/tomwer/widgets/control/NotifierOW.py +1 -0
- orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +6 -6
- orangecontrib/tomwer/widgets/control/VolumeSelector.py +7 -4
- orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +182 -182
- orangecontrib/tomwer/widgets/debugtools/DatasetGeneratorOW.py +5 -5
- orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +4 -4
- orangecontrib/tomwer/widgets/edit/ImageKeyEditorOW.py +3 -3
- orangecontrib/tomwer/widgets/edit/ImageKeyUpgraderOW.py +8 -1
- 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 +22 -20
- orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +19 -3
- orangecontrib/tomwer/widgets/reconstruction/NabuHelicalPrepareWeightsDoubleOW.py +184 -169
- orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +23 -0
- orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +39 -5
- orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +18 -22
- orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +18 -26
- orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +15 -19
- orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +9 -9
- orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/LivesliceOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +3 -3
- orangecontrib/tomwer/widgets/visualization/SinogramViewerOW.py +0 -1
- orangecontrib/tomwer/widgets/visualization/VolumeViewerOW.py +3 -29
- tomwer/__main__.py +7 -64
- tomwer/app/axis.py +3 -3
- tomwer/app/canvas.py +8 -0
- tomwer/app/canvas_launcher/config.py +16 -14
- tomwer/app/canvas_launcher/environ.py +1 -0
- tomwer/app/canvas_launcher/mainwindow.py +4 -1
- tomwer/app/darkref.py +1 -1
- tomwer/app/darkrefpatch.py +1 -1
- tomwer/app/diffframe.py +3 -3
- tomwer/app/imagekeyeditor.py +5 -5
- tomwer/app/imagekeyupgrader.py +5 -5
- tomwer/app/intensitynormalization.py +14 -13
- tomwer/app/{saaxis.py → multicor.py} +3 -3
- tomwer/app/{sadeltabeta.py → multipag.py} +3 -3
- tomwer/app/nabuapp.py +0 -11
- tomwer/app/radiostack.py +6 -4
- tomwer/app/samplemoved.py +3 -2
- tomwer/app/scanviewer.py +4 -2
- tomwer/app/sinogramviewer.py +3 -2
- tomwer/app/slicestack.py +3 -2
- tomwer/app/zstitching.py +88 -6
- 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 +19 -14
- tomwer/core/process/control/datawatcher/edfdwprocess.py +0 -9
- tomwer/core/process/control/nxtomoconcatenate.py +13 -13
- tomwer/core/process/control/nxtomomill.py +92 -34
- tomwer/core/process/control/scantransfer.py +20 -43
- 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 +14 -15
- tomwer/core/process/edit/imagekeyeditor.py +41 -39
- 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 +27 -0
- tomwer/core/process/output.py +52 -0
- tomwer/core/process/reconstruction/axis/axis.py +280 -69
- tomwer/core/process/reconstruction/axis/mode.py +163 -48
- tomwer/core/process/reconstruction/axis/params.py +29 -21
- tomwer/core/process/reconstruction/darkref/darkrefs.py +41 -127
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +4 -3
- tomwer/core/process/reconstruction/darkref/params.py +1 -1
- tomwer/core/process/reconstruction/nabu/castvolume.py +4 -4
- tomwer/core/process/reconstruction/nabu/helical.py +9 -5
- tomwer/core/process/reconstruction/nabu/nabucommon.py +71 -78
- tomwer/core/process/reconstruction/nabu/nabuscores.py +425 -53
- tomwer/core/process/reconstruction/nabu/nabuslices.py +114 -93
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +54 -27
- tomwer/core/process/reconstruction/nabu/plane.py +9 -0
- tomwer/core/process/reconstruction/nabu/settings.py +2 -2
- tomwer/core/process/reconstruction/nabu/utils.py +164 -26
- tomwer/core/process/reconstruction/output.py +108 -0
- tomwer/core/process/reconstruction/saaxis/saaxis.py +238 -264
- tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +151 -87
- tomwer/core/process/reconstruction/scores/params.py +7 -4
- 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 +7 -7
- 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 +13 -12
- tomwer/core/process/task.py +34 -26
- tomwer/core/process/test/test_axis.py +13 -12
- tomwer/core/process/test/test_dark_and_flat.py +10 -7
- tomwer/core/process/test/test_data_transfer.py +10 -8
- tomwer/core/process/test/test_nabu.py +14 -6
- tomwer/core/process/test/test_normalization.py +4 -4
- tomwer/core/scan/blissscan.py +3 -3
- tomwer/core/scan/edfscan.py +13 -10
- tomwer/core/scan/hdf5scan.py +19 -530
- tomwer/core/scan/nxtomoscan.py +534 -0
- tomwer/core/scan/scanbase.py +72 -44
- tomwer/core/scan/scanfactory.py +13 -13
- tomwer/core/scan/test/test_edf.py +2 -2
- tomwer/core/scan/test/test_future_scan.py +3 -3
- tomwer/core/scan/test/test_h5.py +18 -16
- tomwer/core/scan/test/test_process_registration.py +4 -40
- tomwer/core/scan/test/test_scan.py +5 -78
- tomwer/core/settings.py +22 -2
- tomwer/core/test/test_scanutils.py +8 -7
- tomwer/core/test/test_utils.py +35 -28
- tomwer/core/tomwer_object.py +1 -1
- 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/edfvolume.py +6 -6
- tomwer/core/volume/hdf5volume.py +6 -6
- tomwer/core/volume/jp2kvolume.py +6 -6
- tomwer/core/volume/rawvolume.py +6 -6
- tomwer/core/volume/tiffvolume.py +12 -12
- tomwer/core/volume/volumefactory.py +2 -2
- tomwer/gui/cluster/slurm.py +274 -65
- tomwer/gui/cluster/supervisor.py +12 -0
- tomwer/gui/cluster/test/test_cluster.py +14 -2
- tomwer/gui/cluster/test/test_supervisor.py +3 -3
- 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 +83 -16
- tomwer/gui/control/datalistener.py +4 -16
- tomwer/gui/control/datawatcher/controlwidget.py +2 -4
- tomwer/gui/control/datawatcher/datawatcher.py +1 -24
- 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 +9 -9
- 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 +3 -3
- tomwer/gui/control/tomoobjdisplaymode.py +8 -0
- tomwer/gui/debugtools/datasetgenerator.py +3 -3
- tomwer/gui/edit/dkrfpatch.py +20 -26
- tomwer/gui/edit/imagekeyeditor.py +11 -12
- tomwer/gui/edit/nxtomoeditor.py +111 -44
- tomwer/gui/edit/nxtomowarmer.py +7 -6
- tomwer/gui/edit/test/test_dkrf_patch.py +13 -13
- 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/imagefromfile.py +2 -2
- tomwer/gui/qfolderdialog.py +24 -1
- tomwer/gui/reconstruction/axis/CompareImages.py +88 -168
- tomwer/gui/reconstruction/axis/axis.py +171 -57
- tomwer/gui/reconstruction/axis/radioaxis.py +122 -257
- tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +3 -2
- tomwer/gui/reconstruction/darkref/darkrefwidget.py +2 -1
- tomwer/gui/reconstruction/nabu/castvolume.py +14 -3
- 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/nabuconfig.py +2 -1
- tomwer/gui/reconstruction/nabu/nabuconfig/output.py +126 -35
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +39 -32
- tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +222 -31
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +57 -27
- tomwer/gui/reconstruction/nabu/nabuflow.py +12 -20
- tomwer/gui/reconstruction/nabu/slices.py +10 -11
- tomwer/gui/reconstruction/nabu/volume.py +22 -10
- tomwer/gui/reconstruction/normalization/intensity.py +18 -48
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +8 -24
- tomwer/gui/reconstruction/saaxis/dimensionwidget.py +1 -1
- tomwer/gui/reconstruction/saaxis/saaxis.py +9 -21
- tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +45 -12
- tomwer/gui/reconstruction/scores/control.py +2 -9
- tomwer/gui/reconstruction/scores/scoreplot.py +13 -11
- tomwer/gui/reconstruction/test/test_axis.py +41 -16
- tomwer/gui/reconstruction/test/test_nabu.py +31 -9
- tomwer/gui/reconstruction/test/test_saaxis.py +3 -3
- tomwer/gui/reconstruction/test/test_sadeltabeta.py +12 -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 +267 -45
- tomwer/gui/stitching/stitching_preview.py +62 -55
- tomwer/gui/stitching/stitching_raw.py +13 -12
- tomwer/gui/stitching/z_stitching/fineestimation.py +0 -60
- tomwer/gui/utils/buttons.py +112 -29
- tomwer/gui/utils/inputwidget.py +43 -25
- tomwer/gui/utils/lineselector/lineselector.py +1 -1
- 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 +48 -35
- 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 +20 -36
- 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 +65 -67
- tomwer/gui/visualization/volumeviewer.py +114 -113
- tomwer/io/utils/h5pyutils.py +3 -3
- tomwer/io/utils/raw_and_processed_data.py +84 -0
- tomwer/io/utils/tomoobj.py +4 -6
- tomwer/io/utils/utils.py +7 -7
- tomwer/resources/gui/icons/parameters.svg +1 -1
- 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/resources/gui/illustrations/no_rot.svg +1 -1
- tomwer/synctools/stacks/edit/darkflatpatch.py +19 -14
- tomwer/synctools/stacks/edit/imagekeyeditor.py +2 -2
- tomwer/synctools/stacks/reconstruction/axis.py +4 -4
- tomwer/synctools/stacks/reconstruction/castvolume.py +22 -7
- tomwer/synctools/stacks/reconstruction/dkrefcopy.py +25 -20
- 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 +91 -41
- tomwer/tests/utils.py +5 -0
- tomwer/third_part/WaitingOverlay.py +110 -0
- tomwer/third_part/__init__.py +0 -0
- tomwer/version.py +2 -2
- tomwer-1.3.12-py3.11-nspkg.pth +1 -0
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.dist-info}/METADATA +73 -58
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.dist-info}/RECORD +287 -286
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.dist-info}/WHEEL +1 -1
- orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +0 -197
- orangecontrib/tomwer/widgets/reconstruction/icons/XY_lamino.svg +0 -168
- orangecontrib/tomwer/widgets/reconstruction/icons/XZ_lamino.svg +0 -275
- orangecontrib/tomwer/widgets/reconstruction/icons/YZ_lamino.svg +0 -182
- tomwer/app/lamino.py +0 -143
- tomwer/core/process/reconstruction/lamino/__init__.py +0 -1
- tomwer/core/process/reconstruction/lamino/tofu.py +0 -1000
- tomwer/core/process/test/test_lamino.py +0 -76
- tomwer/core/test/test_lamino.py +0 -92
- tomwer/gui/reconstruction/lamino/__init__.py +0 -31
- tomwer/gui/reconstruction/lamino/tofu/TofuOptionLoader.py +0 -107
- tomwer/gui/reconstruction/lamino/tofu/__init__.py +0 -1
- tomwer/gui/reconstruction/lamino/tofu/misc.py +0 -148
- tomwer/gui/reconstruction/lamino/tofu/projections.py +0 -896
- tomwer/gui/reconstruction/lamino/tofu/settings.py +0 -75
- tomwer/gui/reconstruction/lamino/tofu/tofu.py +0 -432
- tomwer/gui/reconstruction/lamino/tofu/tofuexpert.py +0 -567
- tomwer/gui/reconstruction/lamino/tofu/tofuoutput.py +0 -760
- tomwer/gui/reconstruction/test/test_lamino.py +0 -189
- tomwer/resources/gui/icons/esrf_1.svg +0 -307
- tomwer/resources/gui/icons/lamino_parameters.svg +0 -70
- tomwer/resources/gui/icons/triangle.svg +0 -80
- tomwer/resources/gui/illustrations/lamino_angle.png +0 -0
- tomwer/resources/gui/illustrations/lamino_angle.svg +0 -509
- tomwer/resources/gui/illustrations/lamino_beta_angle.png +0 -0
- tomwer/resources/gui/illustrations/lamino_beta_angle.svg +0 -97
- tomwer/resources/gui/illustrations/lamino_theta_angle.png +0 -0
- tomwer/resources/gui/illustrations/lamino_theta_angle.svg +0 -368
- tomwer/resources/gui/illustrations/manual_slice.png +0 -0
- tomwer/resources/gui/illustrations/manual_slice.svg +0 -221
- tomwer/resources/gui/illustrations/psi_angle.png +0 -0
- tomwer/resources/gui/illustrations/psi_angle.svg +0 -479
- tomwer/resources/gui/illustrations/rotation_center.png +0 -0
- tomwer/resources/gui/illustrations/rotation_center.svg +0 -276
- tomwer/resources/gui/illustrations/slice_stack.png +0 -0
- tomwer/resources/gui/illustrations/slice_stack.svg +0 -266
- tomwer/resources/gui/illustrations/xy_slice.png +0 -0
- tomwer/resources/gui/illustrations/xy_slice.svg +0 -269
- tomwer/resources/gui/illustrations/xz_slice.png +0 -0
- tomwer/resources/gui/illustrations/xz_slice.svg +0 -270
- tomwer/resources/gui/illustrations/yz_slice.png +0 -0
- tomwer/resources/gui/illustrations/yz_slice.svg +0 -270
- tomwer/synctools/stacks/reconstruction/lamino.py +0 -233
- tomwer/synctools/test/test_scanstages.py +0 -162
- tomwer/tests/utils/__init__.py +0 -247
- tomwer/tests/utils/utilstest.py +0 -220
- tomwer-1.2.1-py3.11-nspkg.pth +0 -1
- /tomwer/core/process/control/{email.py → emailnotifier.py} +0 -0
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.dist-info}/LICENSE +0 -0
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.dist-info}/entry_points.txt +0 -0
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.2.1.dist-info → tomwer-1.3.12.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
|
@@ -86,7 +87,7 @@ from .params import SADeltaBetaParams
|
|
86
87
|
_logger = logging.getLogger(__name__)
|
87
88
|
|
88
89
|
|
89
|
-
DEFAULT_RECONS_FOLDER = "
|
90
|
+
DEFAULT_RECONS_FOLDER = "multi_delta_beta_results"
|
90
91
|
|
91
92
|
|
92
93
|
def one_slice_several_db(
|
@@ -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:
|
@@ -234,6 +250,7 @@ class SADeltaBetaTask(
|
|
234
250
|
raise ValueError(f"input type of {scan}: {type(scan)} is not managed")
|
235
251
|
|
236
252
|
config = copy(self.inputs.sa_delta_beta_params)
|
253
|
+
axis = config.get("reconstruction", {}).get("slice_plane", "XY")
|
237
254
|
params = SADeltaBetaParams.from_dict(config)
|
238
255
|
|
239
256
|
# insure scan contains some parameter regarding sa delta / beta
|
@@ -247,14 +264,12 @@ class SADeltaBetaTask(
|
|
247
264
|
scan.axis_params = AxisRP()
|
248
265
|
|
249
266
|
# create dir if does not exists
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
os.makedirs(params.output_dir)
|
267
|
+
params.output_dir = self.get_output_dir(params=params, scan=scan)
|
268
|
+
if not os.path.exists(params.output_dir):
|
269
|
+
os.makedirs(params.output_dir)
|
254
270
|
|
255
271
|
slice_index = self._preprocess_slice_index(params.slice_indexes)
|
256
272
|
delta_beta_s = params.delta_beta_values
|
257
|
-
output_dir = params.output_dir
|
258
273
|
# TODO: check: dry run should only be settable at one location
|
259
274
|
dry_run = self._dry_run or params.dry_run
|
260
275
|
cluster_config = params.cluster_config
|
@@ -265,7 +280,7 @@ class SADeltaBetaTask(
|
|
265
280
|
scan=scan,
|
266
281
|
config=nabu_config,
|
267
282
|
delta_beta_s=delta_beta_s,
|
268
|
-
output_dir=output_dir,
|
283
|
+
output_dir=params.output_dir,
|
269
284
|
)
|
270
285
|
# step 2: run reconstructions
|
271
286
|
advancement = Progress(
|
@@ -289,6 +304,7 @@ class SADeltaBetaTask(
|
|
289
304
|
slice_index=slice_index,
|
290
305
|
dry_run=dry_run,
|
291
306
|
cluster_config=cluster_config,
|
307
|
+
axis=axis,
|
292
308
|
)
|
293
309
|
except Exception as e:
|
294
310
|
_logger.error(e)
|
@@ -304,23 +320,29 @@ class SADeltaBetaTask(
|
|
304
320
|
slice_index=slice_index,
|
305
321
|
db_reconstructions=dbs_res,
|
306
322
|
future_tomo_objs=future_tomo_objs,
|
323
|
+
axis=axis,
|
307
324
|
)
|
308
325
|
|
309
326
|
# step 4: run post processing (compute score for each slice)
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
327
|
+
if self.get_input_value("compute_scores", True):
|
328
|
+
try:
|
329
|
+
dbs_res, rois = self._post_processing(
|
330
|
+
scan=scan,
|
331
|
+
db_reconstructions=dbs_res,
|
332
|
+
)
|
333
|
+
except Exception as e:
|
334
|
+
_logger.error(e)
|
335
|
+
mess = f"sa-delta-beta -post-processing- computation for {str(scan)} failed."
|
336
|
+
state = DatasetState.FAILED
|
337
|
+
dbs_res = {}
|
338
|
+
else:
|
339
|
+
state = DatasetState.WAIT_USER_VALIDATION
|
340
|
+
self.delta_beta_s = scan.sa_delta_beta_params.autofocus
|
341
|
+
mess = "sa-delta-beta computation succeeded"
|
320
342
|
else:
|
321
|
-
|
322
|
-
|
323
|
-
mess = "
|
343
|
+
dbs_res = {}
|
344
|
+
state = DatasetState.FAILED
|
345
|
+
mess = "couldn't find 'compute_scores'"
|
324
346
|
|
325
347
|
if self._cancelled:
|
326
348
|
state = DatasetState.CANCELLED
|
@@ -407,7 +429,8 @@ class SADeltaBetaTask(
|
|
407
429
|
slice_index,
|
408
430
|
advancement,
|
409
431
|
dry_run,
|
410
|
-
|
432
|
+
axis,
|
433
|
+
cluster_config: Optional[dict],
|
411
434
|
):
|
412
435
|
future_tomo_objs = {}
|
413
436
|
success = True
|
@@ -415,6 +438,11 @@ class SADeltaBetaTask(
|
|
415
438
|
std_outs = []
|
416
439
|
std_errs = []
|
417
440
|
|
441
|
+
if not isinstance(cluster_config, (dict, type(None))):
|
442
|
+
raise TypeError(
|
443
|
+
f"'cluster_config' is expected to be a dict or None. Get {type(cluster_config)} instead."
|
444
|
+
)
|
445
|
+
|
418
446
|
runners = run_nabu_one_slice_several_config(
|
419
447
|
nabu_configs=configs,
|
420
448
|
scan=scan,
|
@@ -422,12 +450,11 @@ class SADeltaBetaTask(
|
|
422
450
|
dry_run=dry_run,
|
423
451
|
file_format="hdf5",
|
424
452
|
advancement=advancement,
|
425
|
-
cluster_config=cluster_config
|
426
|
-
if cluster_config is not None
|
427
|
-
else None,
|
453
|
+
cluster_config=cluster_config,
|
428
454
|
process_id=self.process_id,
|
429
455
|
instanciate_classes_only=True,
|
430
456
|
output_file_prefix_pattern=None,
|
457
|
+
axis=axis,
|
431
458
|
)
|
432
459
|
|
433
460
|
for runner in runners:
|
@@ -449,9 +476,14 @@ class SADeltaBetaTask(
|
|
449
476
|
if isinstance(res, ResultsWithStd):
|
450
477
|
std_outs.append(res.std_out)
|
451
478
|
std_errs.append(res.std_err)
|
452
|
-
if
|
453
|
-
|
454
|
-
|
479
|
+
if (
|
480
|
+
isinstance(res, ResultsLocalRun)
|
481
|
+
and len(res.results_identifiers) > 0
|
482
|
+
):
|
483
|
+
assert (
|
484
|
+
len(res.results_identifiers) == 1
|
485
|
+
), "only one slice expected"
|
486
|
+
recons_urls[db] = res.results_identifiers[0]
|
455
487
|
if isinstance(res, ResultSlurmRun):
|
456
488
|
future_tomo_obj = FutureTomwerObject(
|
457
489
|
tomo_obj=scan,
|
@@ -473,6 +505,7 @@ class SADeltaBetaTask(
|
|
473
505
|
post_processing = _PostProcessing(
|
474
506
|
scan=scan,
|
475
507
|
db_reconstructions=db_reconstructions,
|
508
|
+
pool_size=self.get_input_value("pool_size", self.DEFAULT_POOL_SIZE),
|
476
509
|
)
|
477
510
|
post_processing._cancelled = self._cancelled
|
478
511
|
self._current_processing = post_processing
|
@@ -484,6 +517,7 @@ class SADeltaBetaTask(
|
|
484
517
|
nabu_config: dict,
|
485
518
|
db_reconstructions,
|
486
519
|
slice_index,
|
520
|
+
axis,
|
487
521
|
future_tomo_objs: dict,
|
488
522
|
):
|
489
523
|
assert isinstance(nabu_config, dict)
|
@@ -510,6 +544,7 @@ class SADeltaBetaTask(
|
|
510
544
|
pag=pag,
|
511
545
|
db=int(db) if db is not None else None,
|
512
546
|
ctf=ctf,
|
547
|
+
axis=axis,
|
513
548
|
)
|
514
549
|
# retrieve url
|
515
550
|
volume_identifier = nabu_utils.get_recons_volume_identifier(
|
@@ -518,9 +553,7 @@ class SADeltaBetaTask(
|
|
518
553
|
file_format=nabu_config.get("file_format", "hdf5"),
|
519
554
|
scan=scan,
|
520
555
|
slice_index=None,
|
521
|
-
|
522
|
-
end_z=None,
|
523
|
-
expects_single_slice=True,
|
556
|
+
axis=axis,
|
524
557
|
)
|
525
558
|
|
526
559
|
assert len(volume_identifier) <= 1, "only one slice expected"
|
@@ -635,7 +668,7 @@ class SADeltaBetaTask(
|
|
635
668
|
def process_to_tomwer_processes(scan):
|
636
669
|
if scan.process_file is not None:
|
637
670
|
entry = "entry"
|
638
|
-
if isinstance(scan,
|
671
|
+
if isinstance(scan, NXtomoScan):
|
639
672
|
entry = scan.entry
|
640
673
|
|
641
674
|
db = None
|
@@ -712,76 +745,107 @@ class SADeltaBetaTask(
|
|
712
745
|
class _PostProcessing:
|
713
746
|
"""class used to run SA-delta-beta post-processing on reconstructed slices"""
|
714
747
|
|
715
|
-
|
748
|
+
DEFAULT_POOL_SIZE = 10
|
749
|
+
|
750
|
+
def __init__(self, db_reconstructions, scan, pool_size) -> None:
|
716
751
|
self._db_reconstructions = db_reconstructions
|
717
752
|
self._scan = scan
|
718
753
|
self._cancelled = False
|
754
|
+
self.pool_size = pool_size
|
755
|
+
|
756
|
+
@staticmethod
|
757
|
+
def compute_score(item: tuple):
|
758
|
+
db, (url, data), mask_disk_radius, cancelled = item
|
759
|
+
if data is None:
|
760
|
+
score = None
|
761
|
+
data_roi = None
|
762
|
+
else:
|
763
|
+
assert data.ndim == 2
|
764
|
+
data_roi = apply_roi(data=data, radius=mask_disk_radius, url=url)
|
765
|
+
|
766
|
+
# move data_roi to [0-1] range
|
767
|
+
# preprocessing: get percentile 0 and 99 from image and
|
768
|
+
# "clean" highest and lowest pixels from it
|
769
|
+
min_p, max_p = numpy.percentile(data_roi, (1, 99))
|
770
|
+
data_roi_int = data_roi[...]
|
771
|
+
data_roi_int[data_roi_int < min_p] = min_p
|
772
|
+
data_roi_int[data_roi_int > max_p] = max_p
|
773
|
+
data_roi_int = (data_roi_int - min_p) / (max_p - min_p)
|
774
|
+
|
775
|
+
score = ComputedScore(
|
776
|
+
tv=compute_score(data=data_roi_int, method=ScoreMethod.TV),
|
777
|
+
std=compute_score(data=data_roi_int, method=ScoreMethod.STD),
|
778
|
+
)
|
779
|
+
return {db: (url, score)}, {db: data_roi}
|
719
780
|
|
720
781
|
def run(self):
|
721
782
|
datasets = self.load_datasets()
|
722
|
-
|
783
|
+
assert isinstance(datasets, dict)
|
723
784
|
mask_disk_radius = get_disk_mask_radius(datasets)
|
785
|
+
with Pool(self.pool_size) as pool:
|
786
|
+
res = pool.map(
|
787
|
+
self.compute_score,
|
788
|
+
[
|
789
|
+
(
|
790
|
+
*item,
|
791
|
+
mask_disk_radius,
|
792
|
+
self._cancelled,
|
793
|
+
)
|
794
|
+
for item in datasets.items()
|
795
|
+
],
|
796
|
+
)
|
724
797
|
scores = {}
|
725
798
|
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)
|
799
|
+
for mydict in res:
|
800
|
+
myscores, myrois = mydict
|
801
|
+
scores.update(myscores)
|
802
|
+
rois.update(myrois)
|
748
803
|
return scores, rois
|
749
804
|
|
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}"
|
805
|
+
@staticmethod
|
806
|
+
def _load_dataset(item: tuple):
|
807
|
+
db, volume_identifier = item
|
808
|
+
slice_url = None
|
809
|
+
# in case the try processing fails
|
810
|
+
try:
|
811
|
+
volume = VolumeFactory.create_tomo_object_from_identifier(volume_identifier)
|
812
|
+
volumes_urls = tuple(volume.browse_data_urls())
|
813
|
+
if len(volumes_urls) > 1:
|
814
|
+
_logger.warning(
|
815
|
+
f"found a volume with mode that one url ({volumes_urls})"
|
769
816
|
)
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
817
|
+
slice_url = volumes_urls[0]
|
818
|
+
data = get_data(slice_url)
|
819
|
+
except Exception as e:
|
820
|
+
_logger.error(
|
821
|
+
f"Fail to compute a score for {volume_identifier}. Reason is {e}"
|
822
|
+
)
|
823
|
+
return {db: (slice_url, None)}
|
824
|
+
else:
|
825
|
+
if data.ndim == 3:
|
826
|
+
if data.shape[0] == 1:
|
827
|
+
data = data.reshape(data.shape[1], data.shape[2])
|
828
|
+
elif data.shape[2] == 1:
|
829
|
+
data = data.reshape(data.shape[0], data.shape[1])
|
781
830
|
else:
|
782
831
|
raise ValueError(f"Data is expected to be 2D. Not {data.ndim}D")
|
832
|
+
elif data.ndim == 2:
|
833
|
+
pass
|
834
|
+
else:
|
835
|
+
raise ValueError(f"Data is expected to be 2D. Not {data.ndim}D")
|
836
|
+
|
837
|
+
return {db: (slice_url, data)}
|
838
|
+
|
839
|
+
def load_datasets(self):
|
840
|
+
with Pool(self.pool_size) as pool:
|
841
|
+
res = pool.map(
|
842
|
+
self._load_dataset,
|
843
|
+
self._db_reconstructions.items(),
|
844
|
+
)
|
845
|
+
datasets_ = {}
|
846
|
+
for mydict in res:
|
847
|
+
datasets_.update(mydict)
|
783
848
|
|
784
|
-
datasets_[db] = (slice_url, data)
|
785
849
|
return datasets_
|
786
850
|
|
787
851
|
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
|
)
|
@@ -176,9 +179,9 @@ class SABaseParams:
|
|
176
179
|
"dry_run": self.dry_run,
|
177
180
|
"output_dir": self.output_dir or "",
|
178
181
|
"score_method": self.score_method.value,
|
179
|
-
"cluster_config":
|
180
|
-
|
181
|
-
|
182
|
+
"cluster_config": (
|
183
|
+
self.cluster_config if self.cluster_config is not None else ""
|
184
|
+
),
|
182
185
|
}
|
183
186
|
|
184
187
|
def load_from_dict(self, dict_: dict):
|
@@ -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,20 +32,20 @@ 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
|
-
|
39
|
-
|
38
|
+
create_ini_flat=True,
|
39
|
+
create_final_flat=False,
|
40
40
|
n_proj=10,
|
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
|
-
|
48
|
-
|
47
|
+
create_ini_flat=False,
|
48
|
+
create_final_flat=False,
|
49
49
|
n_proj=10,
|
50
50
|
n_ini_proj=10,
|
51
51
|
dim=12,
|
@@ -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(
|
@@ -139,32 +139,33 @@ class StitchingPostProcAggregation(_StitchingPostProcAggregation):
|
|
139
139
|
once stitching is done remotly we need to 'aggregate' the different part in the correct order
|
140
140
|
"""
|
141
141
|
|
142
|
-
def __init__(self,
|
142
|
+
def __init__(self, *args, **kwargs) -> None:
|
143
|
+
super().__init__(*args, **kwargs)
|
143
144
|
self._n_finished = 0
|
144
|
-
|
145
|
-
if isinstance(stitching_config, dict):
|
145
|
+
|
146
|
+
if isinstance(self.stitching_config, dict):
|
146
147
|
stitching_type = StitchingType.from_value(
|
147
|
-
stitching_config["stitching"]["type"]
|
148
|
+
self.stitching_config["stitching"]["type"]
|
148
149
|
)
|
149
150
|
if stitching_type is StitchingType.Z_PREPROC:
|
150
151
|
self._stitching_config = PreProcessedZStitchingConfiguration.from_dict(
|
151
|
-
stitching_config
|
152
|
+
self.stitching_config
|
152
153
|
)
|
153
154
|
elif stitching_type is StitchingType.Z_POSTPROC:
|
154
155
|
self._stitching_config = PostProcessedZStitchingConfiguration.from_dict(
|
155
|
-
stitching_config
|
156
|
+
self.stitching_config
|
156
157
|
)
|
157
158
|
else:
|
158
159
|
raise NotImplementedError("stitching type not handled")
|
159
|
-
elif not isinstance(stitching_config, StitchingConfiguration):
|
160
|
+
elif not isinstance(self.stitching_config, StitchingConfiguration):
|
160
161
|
raise TypeError(
|
161
|
-
f"stitching_config is expected to be an instance of {StitchingConfiguration}. {type(stitching_config)} provided instead"
|
162
|
+
f"stitching_config is expected to be an instance of {StitchingConfiguration}. {type(self.stitching_config)} provided instead"
|
162
163
|
)
|
163
|
-
else:
|
164
|
-
self._stitching_config = stitching_config
|
165
164
|
|
166
165
|
def onePartFinished(self, *args, **kwargs):
|
167
166
|
self._n_finished += 1
|
167
|
+
# note: for now we only consider the user of the futures.
|
168
|
+
# if users want to only run post-processing agregation then they will use the nabu CLI for it.
|
168
169
|
if self._n_finished == len(self._futures):
|
169
170
|
_logger.info("All slurm job finished. Will aggregate results")
|
170
171
|
self.process()
|