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
@@ -5,10 +5,10 @@ from tomoscan.serie import Serie
|
|
5
5
|
from ewokscore.missing_data import is_missing_data
|
6
6
|
|
7
7
|
from tomwer.core.process.task import TaskWithProgress
|
8
|
-
from tomwer.core.scan.
|
8
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
9
9
|
|
10
|
-
from
|
11
|
-
from nxtomomill.nexus
|
10
|
+
from nxtomo.application.nxtomo import NXtomo
|
11
|
+
from nxtomomill.utils.nexus import concatenate as nx_concatenate
|
12
12
|
|
13
13
|
_logger = logging.getLogger(__name__)
|
14
14
|
|
@@ -28,7 +28,7 @@ class ConcatenateNXtomoTask(
|
|
28
28
|
output_names=("data",),
|
29
29
|
):
|
30
30
|
"""
|
31
|
-
Task used to concatenate a list of NXtomo (
|
31
|
+
Task used to concatenate a list of NXtomo (NXtomoScan) into a single NXtomo
|
32
32
|
"""
|
33
33
|
|
34
34
|
def run(self):
|
@@ -43,17 +43,17 @@ class ConcatenateNXtomoTask(
|
|
43
43
|
file_path=self.inputs.output_file, serie=scans_serie
|
44
44
|
)
|
45
45
|
|
46
|
-
# cast scan from
|
47
|
-
def cast_scan_to_nxtomo(obj:
|
48
|
-
# convert
|
49
|
-
if isinstance(obj,
|
46
|
+
# cast scan from NXtomoScan to NXtomo
|
47
|
+
def cast_scan_to_nxtomo(obj: NXtomoScan):
|
48
|
+
# convert NXtomoScan to NXtomo as we expect to get NXtomoScan
|
49
|
+
if isinstance(obj, NXtomoScan):
|
50
50
|
return NXtomo().load(
|
51
51
|
file_path=obj.master_file,
|
52
52
|
data_path=obj.entry,
|
53
53
|
)
|
54
54
|
else:
|
55
55
|
raise TypeError(
|
56
|
-
f"nxtomos are supposed to be instances of {NXtomo} or {
|
56
|
+
f"nxtomos are supposed to be instances of {NXtomo} or {NXtomoScan}. Get {type(obj)}"
|
57
57
|
)
|
58
58
|
|
59
59
|
scans_serie = tuple([cast_scan_to_nxtomo(nxtomo) for nxtomo in scans_serie])
|
@@ -68,8 +68,8 @@ class ConcatenateNXtomoTask(
|
|
68
68
|
overwrite=self.inputs.overwrite,
|
69
69
|
)
|
70
70
|
|
71
|
-
# cast back nxtomomill NXtomo to
|
72
|
-
scan =
|
71
|
+
# cast back nxtomomill NXtomo to NXtomoScan (reference object for tomwer)
|
72
|
+
scan = NXtomoScan(
|
73
73
|
scan=output_file,
|
74
74
|
entry=self.inputs.output_entry,
|
75
75
|
)
|
@@ -84,14 +84,14 @@ def format_output_location(file_path, serie: Serie):
|
|
84
84
|
format possible keys from the location like {scan_dir} or {scan_path}
|
85
85
|
|
86
86
|
:param file_path:
|
87
|
-
:param serie: serie of
|
87
|
+
:param serie: serie of NXtomoScan
|
88
88
|
:return:
|
89
89
|
"""
|
90
90
|
if serie is None:
|
91
91
|
_logger.warning("scan is !none, enable to format the nabu output location")
|
92
92
|
|
93
93
|
for scan in serie:
|
94
|
-
if not isinstance(scan,
|
94
|
+
if not isinstance(scan, NXtomoScan):
|
95
95
|
raise TypeError
|
96
96
|
|
97
97
|
def get_common_path():
|
@@ -23,6 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# ###########################################################################*/
|
25
25
|
|
26
|
+
from __future__ import annotations
|
27
|
+
|
26
28
|
__authors__ = ["H. Payno"]
|
27
29
|
__license__ = "MIT"
|
28
30
|
__date__ = "30/07/2020"
|
@@ -32,34 +34,33 @@ import logging
|
|
32
34
|
import os
|
33
35
|
import pathlib
|
34
36
|
|
37
|
+
from tomoscan.serie import Serie
|
38
|
+
|
35
39
|
from nxtomomill import converter as nxtomomill_converter
|
36
40
|
from nxtomomill.io.config import TomoEDFConfig as EDFConfig
|
37
41
|
from nxtomomill.io.config import TomoHDF5Config as HDF5Config
|
38
|
-
from nxtomomill.converter.hdf5.utils import
|
42
|
+
from nxtomomill.converter.hdf5.utils import (
|
43
|
+
get_default_output_file,
|
44
|
+
)
|
39
45
|
|
46
|
+
from tomwer.io.utils.raw_and_processed_data import to_raw_data_path
|
47
|
+
from tomwer.core.process.output import ProcessDataOutputDirMode
|
40
48
|
from tomwer.core.process.task import TaskWithProgress
|
41
|
-
from tomwer.core.scan.
|
49
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
42
50
|
from tomwer.core.utils.scanutils import format_output_location
|
43
51
|
|
44
|
-
from silx.utils.enum import Enum as _Enum
|
45
|
-
|
46
52
|
_logger = logging.getLogger(__name__)
|
47
53
|
|
48
54
|
|
49
|
-
class NXtomomillNXDefaultOutput(_Enum):
|
50
|
-
NEAR_INPUT_FILE = "near input"
|
51
|
-
PROCESSED_DATA = "processed data dir"
|
52
|
-
|
53
|
-
|
54
55
|
class H5ToNxProcess(
|
55
56
|
TaskWithProgress,
|
56
57
|
input_names=("h5_to_nx_configuration",),
|
57
58
|
optional_input_names=(
|
58
59
|
"progress",
|
59
|
-
"
|
60
|
+
"bliss_scan",
|
60
61
|
"serialize_output_data",
|
61
62
|
),
|
62
|
-
output_names=("data",),
|
63
|
+
output_names=("data", "serie"),
|
63
64
|
):
|
64
65
|
"""
|
65
66
|
Task to convert from a bliss dataset to a nexus compliant dataset
|
@@ -67,21 +68,29 @@ class H5ToNxProcess(
|
|
67
68
|
|
68
69
|
@staticmethod
|
69
70
|
def deduce_output_file_path(master_file_name, scan, entry, outputdir):
|
70
|
-
|
71
|
-
|
72
|
-
master_file_name = os.path.realpath(master_file_name)
|
71
|
+
master_file_name = os.path.abspath(master_file_name)
|
73
72
|
# step 1: get output dir
|
74
73
|
try:
|
75
|
-
outputdir =
|
74
|
+
outputdir = ProcessDataOutputDirMode.from_value(outputdir)
|
76
75
|
except ValueError:
|
76
|
+
# case path provided directly
|
77
77
|
output_folder = format_output_location(outputdir, scan=scan)
|
78
78
|
else:
|
79
|
-
if outputdir is
|
79
|
+
if outputdir is ProcessDataOutputDirMode.OTHER:
|
80
|
+
raise ValueError(
|
81
|
+
f"When output dir mode is {ProcessDataOutputDirMode.OTHER} we expect to received the output dir directly"
|
82
|
+
)
|
83
|
+
if outputdir is ProcessDataOutputDirMode.PROCESSED_DATA_FOLDER:
|
80
84
|
path = pathlib.Path(
|
81
85
|
get_default_output_file(input_file=master_file_name)
|
82
86
|
)
|
83
87
|
output_folder = str(path.parent)
|
84
|
-
elif outputdir is
|
88
|
+
elif outputdir is ProcessDataOutputDirMode.RAW_DATA_FOLDER:
|
89
|
+
path = pathlib.Path(
|
90
|
+
get_default_raw_data_output_file(input_file=master_file_name)
|
91
|
+
)
|
92
|
+
output_folder = str(path.parent)
|
93
|
+
elif outputdir is ProcessDataOutputDirMode.IN_SCAN_FOLDER:
|
85
94
|
output_folder = os.path.dirname(master_file_name)
|
86
95
|
else:
|
87
96
|
raise RuntimeError(f"output dir {outputdir} not handled")
|
@@ -119,20 +128,22 @@ class H5ToNxProcess(
|
|
119
128
|
if len(convs) == 0:
|
120
129
|
return
|
121
130
|
|
122
|
-
|
123
|
-
|
124
|
-
|
131
|
+
serie = []
|
132
|
+
for conv in convs:
|
133
|
+
conv_file, conv_entry = conv
|
134
|
+
scan_converted = NXtomoScan(scan=conv_file, entry=conv_entry)
|
135
|
+
_logger.processSucceed(
|
136
|
+
f"{config.input_file} {config.entries} has been translated to {scan_converted}"
|
125
137
|
)
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
138
|
+
if self.get_input_value("serialize_output_data", True):
|
139
|
+
data = scan_converted.to_dict()
|
140
|
+
else:
|
141
|
+
data = scan_converted
|
142
|
+
serie.append(data)
|
143
|
+
self.outputs.serie = Serie(
|
144
|
+
name=f"serie created from {config.input_file}", iterable=serie
|
131
145
|
)
|
132
|
-
if
|
133
|
-
self.outputs.data = scan_converted.to_dict()
|
134
|
-
else:
|
135
|
-
self.outputs.data = scan_converted
|
146
|
+
self.outputs.data = serie[-1] if len(serie) > 0 else None
|
136
147
|
|
137
148
|
|
138
149
|
class EDFToNxProcess(
|
@@ -157,23 +168,70 @@ class EDFToNxProcess(
|
|
157
168
|
raise TypeError(
|
158
169
|
"edf_to_nx_configuration should be a dict or an instance of {TomoEDFConfig}"
|
159
170
|
)
|
171
|
+
os.makedirs(os.path.dirname(config.output_file), exist_ok=True)
|
160
172
|
file_path, entry = nxtomomill_converter.from_edf_to_nx(
|
161
173
|
configuration=config, progress=self.progress
|
162
174
|
)
|
163
|
-
scan =
|
175
|
+
scan = NXtomoScan(entry=entry, scan=file_path)
|
164
176
|
if self.get_input_value("serialize_output_data", True):
|
165
177
|
self.outputs.data = scan.to_dict()
|
166
178
|
else:
|
167
179
|
self.outputs.data = scan
|
168
180
|
|
169
181
|
@staticmethod
|
170
|
-
def deduce_output_file_path(
|
171
|
-
|
182
|
+
def deduce_output_file_path(
|
183
|
+
folder_path, output_dir: ProcessDataOutputDirMode | str, scan
|
184
|
+
):
|
185
|
+
try:
|
186
|
+
output_dir = ProcessDataOutputDirMode.from_value(output_dir)
|
187
|
+
except Exception:
|
188
|
+
pass
|
189
|
+
|
190
|
+
if output_dir is ProcessDataOutputDirMode.OTHER:
|
191
|
+
raise ValueError("if mode is other, we expect 'output_dir' to be the path")
|
192
|
+
elif output_dir in (None, ProcessDataOutputDirMode.IN_SCAN_FOLDER):
|
172
193
|
output_folder = os.path.dirname(folder_path)
|
173
|
-
elif output_dir
|
194
|
+
elif output_dir is ProcessDataOutputDirMode.PROCESSED_DATA_FOLDER:
|
174
195
|
path = pathlib.Path(get_default_output_file(folder_path))
|
175
196
|
output_folder = str(path.parent)
|
197
|
+
elif output_dir is ProcessDataOutputDirMode.RAW_DATA_FOLDER:
|
198
|
+
path = pathlib.Path(get_default_raw_data_output_file(folder_path))
|
199
|
+
output_folder = str(path.parent)
|
176
200
|
else:
|
201
|
+
# else we expect people to provide output location
|
177
202
|
output_folder = format_output_location(output_dir, scan=scan)
|
178
|
-
print("output output_folder is", output_folder)
|
179
203
|
return os.path.join(output_folder, os.path.basename(folder_path) + ".nx")
|
204
|
+
|
205
|
+
|
206
|
+
def get_default_raw_data_output_file(
|
207
|
+
input_file: str, output_file_extension: str = ".nx"
|
208
|
+
) -> str:
|
209
|
+
"""
|
210
|
+
Policy: look for any 'RAW_DATA' in file directory. If find any (before any 'PROCESSED_DATA' directory) replace it "RAW_DATA".
|
211
|
+
Then replace input_file by the expected file_extension and make sure the output file is different than the input file. Else append _nxtomo to it.
|
212
|
+
|
213
|
+
:param str input_file: file to be converted from bliss to NXtomo
|
214
|
+
:param str output_file_extension:
|
215
|
+
:return: default output file according to policy
|
216
|
+
"""
|
217
|
+
if isinstance(input_file, pathlib.Path):
|
218
|
+
input_file = str(input_file)
|
219
|
+
if not isinstance(input_file, str):
|
220
|
+
raise TypeError(
|
221
|
+
f"input_file is expected to be an instance of str. {type(input_file)} provided"
|
222
|
+
)
|
223
|
+
if not isinstance(output_file_extension, str):
|
224
|
+
raise TypeError("output_file_extension is expected to be a str")
|
225
|
+
if not output_file_extension.startswith("."):
|
226
|
+
output_file_extension = "." + output_file_extension
|
227
|
+
|
228
|
+
input_file = os.path.abspath(input_file)
|
229
|
+
input_file_no_ext, _ = os.path.splitext(input_file)
|
230
|
+
|
231
|
+
output_path = to_raw_data_path(input_file_no_ext)
|
232
|
+
output_file = output_path + output_file_extension
|
233
|
+
if output_file == input_file:
|
234
|
+
# to be safer if the default output file is the same as the input file (if the input file has a .nx extension and not in any 'RAw_DATA' directory)
|
235
|
+
return output_path + "_nxtomo" + output_file_extension
|
236
|
+
else:
|
237
|
+
return output_file
|
@@ -1,52 +1,29 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# /*##########################################################################
|
3
|
-
#
|
4
|
-
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
|
5
|
-
#
|
6
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
# of this software and associated documentation files (the "Software"), to deal
|
8
|
-
# in the Software without restriction, including without limitation the rights
|
9
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
# copies of the Software, and to permit persons to whom the Software is
|
11
|
-
# furnished to do so, subject to the following conditions:
|
12
|
-
#
|
13
|
-
# The above copyright notice and this permission notice shall be included in
|
14
|
-
# all copies or substantial portions of the Software.
|
15
|
-
#
|
16
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
-
# THE SOFTWARE.
|
23
|
-
#
|
24
|
-
# ###########################################################################*/
|
25
|
-
|
26
|
-
__authors__ = ["H. Payno"]
|
27
|
-
__license__ = "MIT"
|
28
|
-
__date__ = "05/07/2017"
|
29
|
-
|
30
|
-
|
31
1
|
import fnmatch
|
32
2
|
import logging
|
33
3
|
import os
|
34
4
|
import shutil
|
35
|
-
from
|
5
|
+
from tomwer.core.utils.deprecation import deprecated_warning
|
36
6
|
|
37
7
|
import tomwer.version
|
38
8
|
from tomwer.core.process.reconstruction.nabu.settings import NABU_CFG_FILE_FOLDER
|
39
9
|
from tomwer.core.process.reconstruction.nabu.utils import update_cfg_file_after_transfer
|
40
10
|
from tomwer.core.process.task import Task
|
41
11
|
from tomwer.core.scan.edfscan import EDFTomoScan
|
42
|
-
from tomwer.core.scan.
|
12
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
43
13
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
44
14
|
from tomwer.core.scan.scanfactory import ScanFactory
|
45
15
|
from tomwer.core.settings import get_dest_path, get_lbsram_path
|
46
16
|
from tomwer.core.signal import Signal
|
47
|
-
from tomwer.core.utils import logconfig
|
17
|
+
from tomwer.core.utils import logconfig
|
18
|
+
from tomwer.core.utils.spec import rebaseParFile
|
48
19
|
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
49
20
|
from tomwer.io.utils import get_linked_files_with_entry
|
21
|
+
from tomwer.core.process.reconstruction.saaxis.saaxis import (
|
22
|
+
DEFAULT_RECONS_FOLDER as MULTI_COR_DEFAULT_FOLDER,
|
23
|
+
)
|
24
|
+
from tomwer.core.process.reconstruction.sadeltabeta.sadeltabeta import (
|
25
|
+
DEFAULT_RECONS_FOLDER as MULTI_DB_DEFAULT_FOLDER,
|
26
|
+
)
|
50
27
|
|
51
28
|
logger = logging.getLogger(__name__)
|
52
29
|
|
@@ -103,7 +80,7 @@ class ScanTransferTask(
|
|
103
80
|
self._copying = inputs.get("copying", False)
|
104
81
|
force_sync = inputs.get("force_sync", None)
|
105
82
|
if force_sync is not None:
|
106
|
-
from
|
83
|
+
from tomwer.core.utils.deprecation import deprecated_warning
|
107
84
|
|
108
85
|
deprecated_warning(
|
109
86
|
type_="Parameter",
|
@@ -190,7 +167,7 @@ class ScanTransferTask(
|
|
190
167
|
else:
|
191
168
|
output_scan = scan._deduce_transfert_scan(outputdir)
|
192
169
|
try:
|
193
|
-
output_scan.
|
170
|
+
output_scan._update_latest_recons_identifiers(
|
194
171
|
old_path=scan.path, new_path=output_scan.path
|
195
172
|
)
|
196
173
|
except Exception as e:
|
@@ -211,7 +188,7 @@ class ScanTransferTask(
|
|
211
188
|
self._signalCopying(scanID=source, outputdir=target)
|
212
189
|
output_scan = scan._deduce_transfert_scan(outputdir)
|
213
190
|
try:
|
214
|
-
output_scan.
|
191
|
+
output_scan._update_latest_recons_identifiers(
|
215
192
|
old_path=scan.path, new_path=output_scan.path
|
216
193
|
)
|
217
194
|
except Exception as e:
|
@@ -242,7 +219,7 @@ class ScanTransferTask(
|
|
242
219
|
)
|
243
220
|
|
244
221
|
def _get_hdf5_sample_file_or_nx_dst(self, bliss_sample_file):
|
245
|
-
bliss_sample_file = os.path.
|
222
|
+
bliss_sample_file = os.path.abspath(bliss_sample_file)
|
246
223
|
if self._destDir is not None:
|
247
224
|
rel_path = os.path.join(*bliss_sample_file.split(os.sep)[-2:])
|
248
225
|
return os.path.join(self._destDir, rel_path)
|
@@ -266,7 +243,7 @@ class ScanTransferTask(
|
|
266
243
|
return self._getOutputDirSpec() or self._getOutputDirLBS(bliss_sample_file)
|
267
244
|
|
268
245
|
def _process_hdf5_scan(self, scan) -> TomwerScanBase:
|
269
|
-
assert isinstance(scan,
|
246
|
+
assert isinstance(scan, NXtomoScan)
|
270
247
|
from tomwer.core.process.control.datalistener import DataListener
|
271
248
|
|
272
249
|
files_sources = []
|
@@ -339,7 +316,7 @@ class ScanTransferTask(
|
|
339
316
|
files_sources.append(scan.master_file)
|
340
317
|
files_dest.append(new_nx_file)
|
341
318
|
delete_opt.append(True)
|
342
|
-
output_scan =
|
319
|
+
output_scan = NXtomoScan(scan=new_nx_file, entry=scan.entry)
|
343
320
|
else:
|
344
321
|
output_scan = None
|
345
322
|
|
@@ -397,8 +374,8 @@ class ScanTransferTask(
|
|
397
374
|
patterns = [
|
398
375
|
NABU_CFG_FILE_FOLDER,
|
399
376
|
"*slice*",
|
400
|
-
|
401
|
-
|
377
|
+
MULTI_COR_DEFAULT_FOLDER,
|
378
|
+
MULTI_DB_DEFAULT_FOLDER,
|
402
379
|
"steps_file_basename_nabu_sinogram_save_step",
|
403
380
|
]
|
404
381
|
for folder_ in os.listdir(dir_name):
|
@@ -482,7 +459,7 @@ class ScanTransferTask(
|
|
482
459
|
overwrite=self.get_input_value("overwrite", True),
|
483
460
|
noRsync=self._noRsync,
|
484
461
|
)
|
485
|
-
elif isinstance(scan,
|
462
|
+
elif isinstance(scan, NXtomoScan):
|
486
463
|
if self._move is True:
|
487
464
|
raise NotImplementedError("move option not implemented")
|
488
465
|
if self._noRsync is True:
|
@@ -530,7 +507,7 @@ class ScanTransferTask(
|
|
530
507
|
|
531
508
|
results = {"input_scan": str(input_scan), "output_scan": str(output_scan)}
|
532
509
|
entry = "entry"
|
533
|
-
if isinstance(output_scan,
|
510
|
+
if isinstance(output_scan, NXtomoScan):
|
534
511
|
entry = output_scan.entry
|
535
512
|
self.register_process(
|
536
513
|
process_file=output_scan.process_file,
|
@@ -31,7 +31,8 @@ import logging
|
|
31
31
|
|
32
32
|
from ewokscore.task import Task as EwoksTask
|
33
33
|
|
34
|
-
from tomwer.core import settings
|
34
|
+
from tomwer.core import settings
|
35
|
+
from tomwer.core.utils.lbsram import is_low_on_memory
|
35
36
|
from tomwer.core.process.task import BaseProcessInfo
|
36
37
|
from tomwer.core.scan.scanbase import TomwerScanBase, _TomwerBaseDock
|
37
38
|
from tomwer.core.scan.scanfactory import ScanFactory
|
@@ -98,7 +99,7 @@ class ScanValidator(BaseProcessInfo):
|
|
98
99
|
|
99
100
|
def _freeStackIfNeeded(self):
|
100
101
|
# if we are low in memory in lbsram: we will automatically validate the current scan
|
101
|
-
isLowMemoryLbs =
|
102
|
+
isLowMemoryLbs = is_low_on_memory(settings.get_lbsram_path()) is True
|
102
103
|
if not self.isValidationManual():
|
103
104
|
self._validateStack()
|
104
105
|
elif isLowMemoryLbs:
|
@@ -5,15 +5,15 @@ from tomwer.core.process.control.nxtomoconcatenate import (
|
|
5
5
|
ConcatenateNXtomoTask,
|
6
6
|
format_output_location,
|
7
7
|
)
|
8
|
-
from tomwer.core.scan.
|
9
|
-
from tomwer.core.utils.scanutils import
|
8
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
9
|
+
from tomwer.core.utils.scanutils import MockNXtomo
|
10
10
|
|
11
11
|
|
12
12
|
def test_concatenate_nx_tomo_task(tmp_path):
|
13
13
|
"""
|
14
|
-
test execution of ConcatenateNXtomoTask with two
|
14
|
+
test execution of ConcatenateNXtomoTask with two NXtomoScan
|
15
15
|
"""
|
16
|
-
scan_1 =
|
16
|
+
scan_1 = MockNXtomo(
|
17
17
|
scan_path=os.path.join(tmp_path, "scan1"),
|
18
18
|
n_proj=10,
|
19
19
|
n_ini_proj=10,
|
@@ -21,7 +21,7 @@ def test_concatenate_nx_tomo_task(tmp_path):
|
|
21
21
|
dim=20,
|
22
22
|
energy=12.3,
|
23
23
|
).scan
|
24
|
-
scan_2 =
|
24
|
+
scan_2 = MockNXtomo(
|
25
25
|
scan_path=os.path.join(tmp_path, "scan2"),
|
26
26
|
n_proj=10,
|
27
27
|
n_ini_proj=10,
|
@@ -42,18 +42,18 @@ def test_concatenate_nx_tomo_task(tmp_path):
|
|
42
42
|
}
|
43
43
|
)
|
44
44
|
task.run()
|
45
|
-
assert isinstance(task.outputs.data,
|
45
|
+
assert isinstance(task.outputs.data, NXtomoScan)
|
46
46
|
assert os.path.exists(output_scan_file)
|
47
47
|
# note: correct processing of the concatenation is done at nxtomomill
|
48
48
|
|
49
49
|
|
50
50
|
def test_format_output_location():
|
51
51
|
"""test behavior of format_output_location"""
|
52
|
-
scan1 =
|
52
|
+
scan1 = NXtomoScan(
|
53
53
|
"/path/to/scan_1.nx",
|
54
54
|
entry="entry0000",
|
55
55
|
)
|
56
|
-
scan2 =
|
56
|
+
scan2 = NXtomoScan(
|
57
57
|
"/path/to/scan_2.nx",
|
58
58
|
entry="entry0001",
|
59
59
|
)
|
@@ -65,7 +65,7 @@ def test_format_output_location():
|
|
65
65
|
)
|
66
66
|
|
67
67
|
assert format_output_location(
|
68
|
-
"concatenate.nx", Serie([scan1, scan2])
|
68
|
+
"concatenate.nx", Serie("my_serie", [scan1, scan2])
|
69
69
|
) == os.path.abspath("concatenate.nx")
|
70
70
|
|
71
71
|
assert (
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
import numpy
|
3
|
-
from tomwer.core.process.control.
|
4
|
-
from tomwer.core.scan.
|
3
|
+
from tomwer.core.process.control.emailnotifier import format_email_info, _ls_tomo_obj
|
4
|
+
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
5
5
|
from tomwer.core.volume.hdf5volume import HDF5Volume
|
6
6
|
from tomwer.core.utils.scanutils import HDF5MockContext
|
7
7
|
|
@@ -11,11 +11,11 @@ def test__ls_tomo_obj(tmp_path):
|
|
11
11
|
for i in range(2):
|
12
12
|
open(os.path.join(tmp_path, f"{i}.nx"), "a").close()
|
13
13
|
|
14
|
-
scan =
|
14
|
+
scan = NXtomoScan(
|
15
15
|
scan=os.path.join(tmp_path, "1.nx"),
|
16
16
|
entry="entry0000",
|
17
17
|
)
|
18
|
-
assert isinstance(scan,
|
18
|
+
assert isinstance(scan, NXtomoScan)
|
19
19
|
|
20
20
|
assert len(_ls_tomo_obj(scan)) == 2
|
21
21
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import os
|
2
2
|
from tomwer.core.scan.edfscan import EDFTomoScan
|
3
|
+
from tomwer.core.process.output import ProcessDataOutputDirMode
|
3
4
|
from tomwer.core.process.control.nxtomomill import (
|
4
5
|
EDFToNxProcess,
|
5
6
|
H5ToNxProcess,
|
6
|
-
|
7
|
+
get_default_raw_data_output_file,
|
7
8
|
)
|
8
|
-
from tomwer.core.utils.scanutils import
|
9
|
+
from tomwer.core.utils.scanutils import MockNXtomo, MockEDF
|
9
10
|
from nxtomomill.converter.hdf5.utils import PROCESSED_DATA_DIR_NAME, RAW_DATA_DIR_NAME
|
10
11
|
|
11
12
|
|
@@ -14,14 +15,14 @@ def test_h52nx_process_deduce_output_file_path(tmp_path):
|
|
14
15
|
scan_path = str(tmp_path / "path" / RAW_DATA_DIR_NAME / "my_scan")
|
15
16
|
os.makedirs(scan_path)
|
16
17
|
|
17
|
-
scan =
|
18
|
+
scan = MockNXtomo(scan_path=scan_path, n_proj=0).scan
|
18
19
|
|
19
20
|
# test H52NXDefaultOutput.PROCESSED_DATA
|
20
21
|
assert H5ToNxProcess.deduce_output_file_path(
|
21
22
|
master_file_name=scan.master_file,
|
22
23
|
scan=scan,
|
23
24
|
entry=scan.entry,
|
24
|
-
outputdir=
|
25
|
+
outputdir=ProcessDataOutputDirMode.PROCESSED_DATA_FOLDER.value,
|
25
26
|
) == str(
|
26
27
|
tmp_path
|
27
28
|
/ "path"
|
@@ -35,7 +36,7 @@ def test_h52nx_process_deduce_output_file_path(tmp_path):
|
|
35
36
|
master_file_name=scan.master_file,
|
36
37
|
scan=scan,
|
37
38
|
entry=scan.entry,
|
38
|
-
outputdir=
|
39
|
+
outputdir=ProcessDataOutputDirMode.IN_SCAN_FOLDER.value,
|
39
40
|
) == str(
|
40
41
|
tmp_path / "path" / RAW_DATA_DIR_NAME / "my_scan" / f"my_scan_{scan.entry}.nx"
|
41
42
|
)
|
@@ -77,14 +78,14 @@ def test_edf2nx_process_deduce_output_file_path(tmp_path):
|
|
77
78
|
# test NEAR_INPUT_FILE
|
78
79
|
assert EDFToNxProcess.deduce_output_file_path(
|
79
80
|
folder_path=scan_path,
|
80
|
-
output_dir=
|
81
|
+
output_dir=ProcessDataOutputDirMode.IN_SCAN_FOLDER.value,
|
81
82
|
scan=scan,
|
82
83
|
) == os.path.join(tmp_path, "path", RAW_DATA_DIR_NAME, "my_edf_scan.nx")
|
83
84
|
|
84
85
|
# test PROCESSED_DATA
|
85
86
|
assert EDFToNxProcess.deduce_output_file_path(
|
86
87
|
folder_path=scan_path,
|
87
|
-
output_dir=
|
88
|
+
output_dir=ProcessDataOutputDirMode.PROCESSED_DATA_FOLDER.value,
|
88
89
|
scan=scan,
|
89
90
|
) == os.path.join(tmp_path, "path", PROCESSED_DATA_DIR_NAME, "my_edf_scan.nx")
|
90
91
|
|
@@ -104,3 +105,54 @@ def test_edf2nx_process_deduce_output_file_path(tmp_path):
|
|
104
105
|
)
|
105
106
|
== "/tmp/output/my_edf_scan.nx"
|
106
107
|
)
|
108
|
+
|
109
|
+
|
110
|
+
def test_get_default_raw_data_output_file():
|
111
|
+
"""test 'get_default_raw_data_output_file' function"""
|
112
|
+
assert get_default_raw_data_output_file("/tmp/path/file.h5") == "/tmp/path/file.nx"
|
113
|
+
assert (
|
114
|
+
get_default_raw_data_output_file(f"/tmp/{PROCESSED_DATA_DIR_NAME}/file.h5")
|
115
|
+
== f"/tmp/{RAW_DATA_DIR_NAME}/file.nx"
|
116
|
+
)
|
117
|
+
|
118
|
+
assert (
|
119
|
+
get_default_raw_data_output_file(
|
120
|
+
f"/tmp/path/{PROCESSED_DATA_DIR_NAME}/toto/file.h5"
|
121
|
+
)
|
122
|
+
== f"/tmp/path/{RAW_DATA_DIR_NAME}/toto/file.nx"
|
123
|
+
)
|
124
|
+
# note: _RAW_DATA_DIR_NAME part of the path but not a folder
|
125
|
+
assert (
|
126
|
+
get_default_raw_data_output_file(f"/tmp/path_{RAW_DATA_DIR_NAME}/toto/file.h5")
|
127
|
+
== f"/tmp/path_{RAW_DATA_DIR_NAME}/toto/file.nx"
|
128
|
+
)
|
129
|
+
|
130
|
+
# 2. advance test
|
131
|
+
# 2.1 use case: '_RAW_DATA_DIR_NAME' is present twice in the path -> replace the deeper one
|
132
|
+
assert (
|
133
|
+
get_default_raw_data_output_file(
|
134
|
+
f"/tmp/{PROCESSED_DATA_DIR_NAME}/path/{RAW_DATA_DIR_NAME}/toto/file.h5"
|
135
|
+
)
|
136
|
+
== f"/tmp/{PROCESSED_DATA_DIR_NAME}/path/{RAW_DATA_DIR_NAME}/toto/file.nx"
|
137
|
+
)
|
138
|
+
|
139
|
+
# 2.2 use case: contains both '_RAW_DATA_DIR_NAME' and '_PROCESSED_DATA_DIR_NAME' in the path
|
140
|
+
assert (
|
141
|
+
get_default_raw_data_output_file(
|
142
|
+
f"/tmp/{PROCESSED_DATA_DIR_NAME}/path/{RAW_DATA_DIR_NAME}/toto/file.h5"
|
143
|
+
)
|
144
|
+
== f"/tmp/{PROCESSED_DATA_DIR_NAME}/path/{RAW_DATA_DIR_NAME}/toto/file.nx"
|
145
|
+
)
|
146
|
+
|
147
|
+
assert (
|
148
|
+
get_default_raw_data_output_file(
|
149
|
+
f"/tmp/{RAW_DATA_DIR_NAME}/path/{PROCESSED_DATA_DIR_NAME}/toto/file.h5"
|
150
|
+
)
|
151
|
+
== f"/tmp/{RAW_DATA_DIR_NAME}/path/{RAW_DATA_DIR_NAME}/toto/file.nx"
|
152
|
+
)
|
153
|
+
|
154
|
+
# 2.3 use case: expected output file is the input file. Make sure append '_nxtomo'
|
155
|
+
assert (
|
156
|
+
get_default_raw_data_output_file("/tmp/path/file.nx")
|
157
|
+
== "/tmp/path/file_nxtomo.nx"
|
158
|
+
)
|