tomwer 1.0.3__py3-none-any.whl → 1.1.0__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/EBS_tomo_listener.ows +39 -0
- orangecontrib/tomwer/tutorials/cast_volume.ows +34 -0
- orangecontrib/tomwer/tutorials/simple_slice_reconstruction.ows +39 -0
- orangecontrib/tomwer/tutorials/simple_volume_local_reconstruction.ows +49 -0
- orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +59 -0
- orangecontrib/tomwer/tutorials/using_saaxis_to_find_cor.ows +44 -0
- orangecontrib/tomwer/widgets/cluster/FutureSupervisorOW.py +1 -1
- orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +14 -4
- orangecontrib/tomwer/widgets/cluster/__init__.py +1 -1
- orangecontrib/tomwer/widgets/control/DataListOW.py +12 -5
- orangecontrib/tomwer/widgets/control/DataListenerOW.py +18 -9
- orangecontrib/tomwer/widgets/control/DataSelectorOW.py +13 -6
- orangecontrib/tomwer/widgets/control/DataTransfertOW.py +3 -5
- orangecontrib/tomwer/widgets/control/DataValidatorOW.py +8 -4
- orangecontrib/tomwer/widgets/control/DataWatcherOW.py +4 -6
- orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +49 -62
- orangecontrib/tomwer/widgets/control/FilterOW.py +2 -4
- orangecontrib/tomwer/widgets/control/NXTomomillMixIn.py +93 -0
- orangecontrib/tomwer/widgets/control/NXTomomillOW.py +135 -129
- orangecontrib/tomwer/widgets/control/NotifierOW.py +34 -9
- orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +3 -5
- orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +19 -13
- orangecontrib/tomwer/widgets/control/VolumeSelector.py +12 -4
- orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +11 -7
- orangecontrib/tomwer/widgets/control/icons/notification.svg +4 -4
- orangecontrib/tomwer/widgets/control/icons/nxtomomill.png +0 -0
- orangecontrib/tomwer/widgets/control/icons/nxtomomill.svg +8 -5
- orangecontrib/tomwer/widgets/control/icons/tomoobjserie.png +0 -0
- orangecontrib/tomwer/widgets/control/icons/tomoobjserie.svg +73 -78
- orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +16 -4
- orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +100 -0
- orangecontrib/tomwer/widgets/edit/icons/image_key_editor.png +0 -0
- orangecontrib/tomwer/widgets/edit/icons/image_key_upgrader.png +0 -0
- orangecontrib/tomwer/widgets/edit/icons/nx_tomo_editor.png +0 -0
- orangecontrib/tomwer/widgets/edit/icons/nx_tomo_editor.svg +123 -0
- orangecontrib/tomwer/widgets/edit/test/test_dark_flat_patch.py +21 -1
- orangecontrib/tomwer/widgets/edit/test/test_image_key_editor.py +1 -1
- orangecontrib/tomwer/widgets/edit/test/test_image_key_upgrader.py +1 -1
- orangecontrib/tomwer/widgets/edit/test/test_nxtomo_editor.py +25 -0
- orangecontrib/tomwer/widgets/other/PythonScriptOW.py +19 -11
- orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +20 -14
- orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +24 -10
- orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +26 -21
- orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +29 -12
- orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +44 -17
- orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +28 -20
- orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +24 -18
- orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +6 -6
- orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +4 -2
- orangecontrib/tomwer/widgets/reconstruction/icons/nabu_2d.png +0 -0
- orangecontrib/tomwer/widgets/reconstruction/icons/nabu_2d.svg +11 -8
- orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +10 -4
- orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +69 -0
- orangecontrib/tomwer/widgets/visualization/SampleMovedOW.py +2 -4
- orangecontrib/tomwer/widgets/visualization/icons/nx_tomo_metadata_viewer.png +0 -0
- orangecontrib/tomwer/widgets/visualization/icons/nx_tomo_metadata_viewer.svg +105 -0
- tomwer/__main__.py +10 -5
- tomwer/app/canvas_launcher/config.py +10 -10
- tomwer/app/canvas_launcher/mainwindow.py +68 -6
- tomwer/app/canvas_launcher/widgetsscheme.py +1 -3
- tomwer/app/darkref.py +16 -12
- tomwer/app/imagekeyeditor.py +2 -2
- tomwer/app/imagekeyupgrader.py +104 -0
- tomwer/app/intensitynormalization.py +0 -1
- tomwer/app/nxtomoeditor.py +103 -0
- tomwer/app/rsync.py +1 -1
- tomwer/core/cluster/cluster.py +1 -1
- tomwer/core/futureobject.py +1 -0
- tomwer/core/process/control/datalistener/datalistener.py +7 -1
- tomwer/core/process/control/datalistener/rpcserver.py +3 -4
- tomwer/core/process/control/datawatcher/datawatcher.py +18 -18
- tomwer/core/process/control/datawatcher/datawatcherobserver.py +5 -8
- tomwer/core/process/control/datawatcher/datawatcherprocess.py +2 -3
- tomwer/core/process/control/datawatcher/edfdwprocess.py +2 -2
- tomwer/core/process/control/nxtomomill.py +33 -58
- tomwer/core/process/control/scanlist.py +2 -1
- tomwer/core/process/control/scanselector.py +7 -0
- tomwer/core/process/control/scantransfer.py +2 -2
- tomwer/core/process/control/scanvalidator.py +6 -5
- tomwer/core/process/control/singletomoobj.py +2 -1
- tomwer/core/process/control/timer.py +2 -1
- tomwer/core/process/control/tomoobjserie.py +8 -2
- tomwer/core/process/control/volumeselector.py +2 -1
- tomwer/core/process/control/volumesymlink.py +2 -1
- tomwer/core/process/edit/darkflatpatch.py +2 -1
- tomwer/core/process/edit/imagekeyeditor.py +4 -3
- tomwer/core/process/reconstruction/axis/axis.py +29 -32
- tomwer/core/process/reconstruction/axis/mode.py +3 -2
- tomwer/core/process/reconstruction/axis/params.py +35 -16
- tomwer/core/process/reconstruction/darkref/darkrefs.py +90 -707
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +44 -16
- tomwer/core/process/reconstruction/darkref/params.py +62 -67
- tomwer/core/process/reconstruction/lamino/tofu.py +1 -2
- tomwer/core/process/reconstruction/nabu/castvolume.py +21 -26
- tomwer/core/process/reconstruction/nabu/nabucommon.py +36 -38
- tomwer/core/process/reconstruction/nabu/nabuscores.py +28 -13
- tomwer/core/process/reconstruction/nabu/nabuslices.py +41 -14
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +21 -12
- tomwer/core/process/reconstruction/nabu/utils.py +32 -3
- tomwer/core/process/reconstruction/normalization/normalization.py +9 -8
- tomwer/core/process/reconstruction/saaxis/saaxis.py +46 -20
- tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +38 -12
- tomwer/core/process/reconstruction/test/__init__.py +0 -39
- tomwer/core/process/reconstruction/test/test_axis_params.py +25 -3
- tomwer/core/process/reconstruction/test/test_darkref_copy.py +117 -1
- tomwer/core/process/script/python.py +16 -12
- tomwer/core/process/task.py +3 -7
- tomwer/core/process/test/test_axis.py +1 -1
- tomwer/core/process/test/test_dark_and_flat.py +41 -111
- tomwer/core/process/test/test_data_listener.py +0 -29
- tomwer/core/process/test/test_data_transfer.py +10 -14
- tomwer/core/process/test/test_nabu.py +1 -1
- tomwer/core/process/test/test_normalization.py +1 -1
- tomwer/core/process/visualization/liveslice.py +6 -0
- tomwer/core/scan/blissscan.py +37 -2
- tomwer/core/scan/edfscan.py +19 -8
- tomwer/core/scan/hdf5scan.py +10 -4
- tomwer/core/scan/scanbase.py +35 -29
- tomwer/core/scan/scanfactory.py +3 -17
- tomwer/core/scan/test/test_h5.py +1 -1
- tomwer/core/scan/test/test_process_registration.py +0 -11
- tomwer/core/scan/test/test_scan.py +32 -30
- tomwer/core/settings.py +2 -2
- tomwer/core/test/test_utils.py +1 -1
- tomwer/core/tomwer_object.py +19 -0
- tomwer/core/utils/__init__.py +0 -45
- tomwer/core/utils/char.py +2 -0
- tomwer/core/utils/gpu.py +5 -5
- tomwer/core/utils/nxtomoutils.py +2 -2
- tomwer/core/utils/scanutils.py +50 -0
- tomwer/core/utils/volumeutils.py +13 -0
- tomwer/core/volume/edfvolume.py +4 -0
- tomwer/core/volume/hdf5volume.py +4 -0
- tomwer/core/volume/jp2kvolume.py +4 -0
- tomwer/core/volume/rawvolume.py +22 -5
- tomwer/core/volume/tiffvolume.py +4 -0
- tomwer/core/volume/volumebase.py +19 -12
- tomwer/core/volume/volumefactory.py +20 -1
- tomwer/gui/cluster/slurm.py +1 -1
- tomwer/gui/cluster/supervisor.py +0 -2
- tomwer/gui/cluster/test/test_cluster.py +2 -2
- tomwer/gui/control/datalist.py +109 -36
- tomwer/gui/control/datatransfert.py +1 -1
- tomwer/gui/control/datawatcher/configuration.py +0 -2
- tomwer/gui/control/datawatcher/datawatcher.py +23 -13
- tomwer/gui/control/datawatcher/datawatcherobserver.py +1 -1
- tomwer/gui/control/observations.py +0 -3
- tomwer/gui/control/selectorwidgetbase.py +42 -12
- tomwer/gui/control/serie/seriecreator.py +967 -0
- tomwer/{web/__init__.py → gui/control/serie/seriewaiter.py} +5 -7
- tomwer/gui/control/singletomoobj.py +15 -4
- tomwer/gui/control/test/test_datalist.py +1 -1
- tomwer/gui/control/test/test_datalistener.py +1 -1
- tomwer/gui/control/test/test_inputwidget.py +1 -1
- tomwer/gui/control/test/test_process_manager.py +1 -13
- tomwer/gui/control/test/test_scanselector.py +1 -1
- tomwer/gui/control/test/test_scanvalidator.py +1 -1
- tomwer/gui/control/test/test_single_tomo_obj.py +1 -1
- tomwer/gui/control/test/test_volume_dialog.py +19 -7
- tomwer/gui/control/test/test_volumeselector.py +4 -4
- tomwer/gui/debugtools/datasetgenerator.py +1 -9
- tomwer/gui/edit/dkrfpatch.py +2 -3
- tomwer/gui/edit/imagekeyeditor.py +12 -11
- tomwer/gui/edit/nxtomoeditor.py +475 -0
- tomwer/gui/edit/test/test_dkrf_patch.py +2 -14
- tomwer/gui/edit/test/test_image_key_editor.py +2 -2
- tomwer/gui/edit/test/test_nx_editor.py +155 -0
- tomwer/gui/icons.py +0 -1
- tomwer/gui/qfolderdialog.py +11 -0
- tomwer/gui/reconstruction/axis/CompareImages.py +27 -29
- tomwer/gui/reconstruction/axis/axis.py +2 -0
- tomwer/gui/reconstruction/axis/radioaxis.py +70 -14
- tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +7 -9
- tomwer/gui/reconstruction/darkref/darkrefwidget.py +22 -24
- tomwer/gui/reconstruction/lamino/tofu/projections.py +1 -1
- tomwer/gui/reconstruction/lamino/tofu/tofu.py +3 -3
- tomwer/gui/reconstruction/lamino/tofu/tofuexpert.py +4 -4
- tomwer/gui/reconstruction/lamino/tofu/tofuoutput.py +10 -5
- tomwer/gui/reconstruction/nabu/castvolume.py +103 -24
- tomwer/gui/reconstruction/nabu/check.py +1 -1
- tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +352 -0
- tomwer/gui/reconstruction/nabu/nabuconfig/nabuconfig.py +0 -9
- tomwer/gui/reconstruction/nabu/nabuconfig/output.py +1 -1
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +18 -19
- tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +30 -7
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +26 -15
- tomwer/gui/reconstruction/nabu/slices.py +10 -4
- tomwer/gui/reconstruction/nabu/slurm.py +1 -1
- tomwer/gui/reconstruction/nabu/volume.py +13 -7
- tomwer/gui/reconstruction/normalization/intensity.py +1 -5
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +10 -37
- tomwer/gui/reconstruction/saaxis/saaxis.py +11 -7
- tomwer/gui/reconstruction/saaxis/sliceselector.py +11 -26
- tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +13 -8
- tomwer/gui/reconstruction/scores/scoreplot.py +67 -62
- tomwer/gui/reconstruction/test/test_axis.py +2 -2
- tomwer/gui/reconstruction/test/test_lamino.py +2 -2
- tomwer/gui/reconstruction/test/test_nabu.py +14 -1
- tomwer/gui/reconstruction/test/test_saaxis.py +8 -17
- tomwer/gui/reconstruction/test/test_sadeltabeta.py +7 -13
- tomwer/gui/stackplot.py +11 -28
- tomwer/gui/test/test_axis_gui.py +4 -4
- tomwer/gui/test/test_qfolder_dialog.py +12 -0
- tomwer/gui/utils/inputwidget.py +42 -22
- tomwer/gui/utils/lineselector/lineselector.py +13 -21
- tomwer/gui/utils/scandescription.py +2 -4
- tomwer/gui/utils/slider.py +1 -102
- tomwer/gui/utils/unitsystem.py +48 -11
- tomwer/gui/visualization/dataviewer.py +24 -17
- tomwer/gui/visualization/diffviewer/diffviewer.py +2 -11
- tomwer/gui/visualization/nxtomometadata.py +21 -0
- tomwer/gui/visualization/scanoverview.py +0 -1
- tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +72 -0
- tomwer/gui/visualization/test/test_stacks.py +1 -1
- tomwer/gui/visualization/tomoobjoverview.py +49 -0
- tomwer/gui/visualization/volumeoverview.py +64 -0
- tomwer/gui/visualization/volumeviewer.py +1 -1
- tomwer/io/utils/utils.py +2 -2
- tomwer/resources/gui/icons/multi-document-save.png +0 -0
- tomwer/resources/gui/icons/multi-document-save.svg +101 -0
- tomwer/resources/gui/illustrations/ctf_z1.png +0 -0
- tomwer/resources/gui/illustrations/ctf_z1.svg +471 -0
- tomwer/synctools/axis.py +0 -1
- tomwer/synctools/darkref.py +0 -1
- tomwer/synctools/datalistener.py +5 -1
- tomwer/synctools/imageloaderthread.py +2 -2
- tomwer/synctools/saaxis.py +0 -1
- tomwer/synctools/sadeltabeta.py +0 -1
- tomwer/synctools/stacks/edit/imagekeyeditor.py +1 -1
- tomwer/synctools/stacks/processingstack.py +2 -2
- tomwer/synctools/stacks/reconstruction/castvolume.py +1 -0
- tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -1
- tomwer/synctools/stacks/reconstruction/lamino.py +1 -3
- tomwer/synctools/stacks/reconstruction/sadeltabeta.py +0 -2
- tomwer/synctools/test/test_darkRefs.py +32 -149
- tomwer/synctools/test/test_foldertransfer.py +1 -1
- tomwer/synctools/test/test_scanstages.py +2 -2
- tomwer/tests/conftest.py +51 -0
- tomwer/{test → tests}/test_scripts.py +1 -1
- tomwer/tests/test_utils.py +10 -0
- tomwer/{test → tests}/utils/utilstest.py +0 -11
- tomwer/version.py +3 -3
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/METADATA +14 -16
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/RECORD +255 -235
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/WHEEL +1 -1
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/entry_points.txt +6 -0
- orangecontrib/tomwer/setup.py +0 -45
- orangecontrib/tomwer/widgets/setup.py +0 -49
- tomwer/app/process.py +0 -153
- tomwer/core/process/reconstruction/nabu/slurm.py +0 -36
- tomwer/core/process/reconstruction/utils/nabu_slice_exec.py +0 -10
- tomwer/core/utils/laminoutils.py +0 -80
- tomwer/gui/utils/lineselector/lineselection.py +0 -76
- tomwer/setup.py +0 -52
- tomwer/slurm/executor.py +0 -36
- tomwer/slurm/job.py +0 -349
- tomwer/slurm/utils.py +0 -44
- tomwer/web/client.py +0 -43
- tomwer/web/config.py +0 -36
- tomwer/web/test/test_graylog_connection.py +0 -59
- {tomwer/slurm → orangecontrib/tomwer/tutorials}/__init__.py +0 -0
- /tomwer/{test → gui/control/serie}/__init__.py +0 -0
- /tomwer/{web/test → tests}/__init__.py +0 -0
- /tomwer/{test → tests}/utils/__init__.py +0 -0
- /tomwer-1.0.3-py3.8-nspkg.pth → /tomwer-1.1.0-py3.9-nspkg.pth +0 -0
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/LICENSE +0 -0
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,9 @@
|
|
1
1
|
import os
|
2
2
|
import pytest
|
3
|
-
from tomwer.core.process.reconstruction.axis.params import
|
3
|
+
from tomwer.core.process.reconstruction.axis.params import (
|
4
|
+
AxisResource,
|
5
|
+
AxisCalculationInput,
|
6
|
+
)
|
4
7
|
from tomwer.core.utils.scanutils import MockHDF5
|
5
8
|
import numpy
|
6
9
|
|
@@ -22,7 +25,8 @@ def test_axis_resource(tmp_path):
|
|
22
25
|
first_proj = list(scan.projections.keys())[0]
|
23
26
|
data_url = scan.projections[first_proj]
|
24
27
|
|
25
|
-
axis_resource = AxisResource(data_url)
|
28
|
+
axis_resource = AxisResource(url=data_url)
|
29
|
+
assert axis_resource.data is not None
|
26
30
|
|
27
31
|
with pytest.raises(TypeError):
|
28
32
|
axis_resource.normalize_data(scan=None, log_=True)
|
@@ -34,4 +38,22 @@ def test_axis_resource(tmp_path):
|
|
34
38
|
|
35
39
|
assert isinstance(axis_resource.normalized_data_paganin, numpy.ndarray)
|
36
40
|
|
37
|
-
assert isinstance(axis_resource
|
41
|
+
assert isinstance(str(axis_resource), str)
|
42
|
+
axis_resource.data = None
|
43
|
+
assert axis_resource is not None
|
44
|
+
|
45
|
+
|
46
|
+
def test_AxisCalculationInput():
|
47
|
+
"""test all class AxisCalculationInput which is a bit 'malformed'"""
|
48
|
+
assert (
|
49
|
+
AxisCalculationInput.from_value("transmission_withpag")
|
50
|
+
is AxisCalculationInput.transmission_pag
|
51
|
+
)
|
52
|
+
assert (
|
53
|
+
AxisCalculationInput.from_value("transmission_nopag")
|
54
|
+
is AxisCalculationInput.transmission
|
55
|
+
)
|
56
|
+
assert (
|
57
|
+
AxisCalculationInput.from_value("transmission")
|
58
|
+
is AxisCalculationInput.transmission
|
59
|
+
)
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import os
|
2
|
+
import numpy
|
3
|
+
import pytest
|
4
|
+
from silx.io.dictdump import dicttoh5
|
2
5
|
from tomwer.core.process.reconstruction.darkref.darkrefscopy import DarkRefsCopy
|
3
6
|
from tomwer.core.utils.scanutils import MockHDF5
|
4
|
-
import pytest
|
5
7
|
|
6
8
|
|
7
9
|
@pytest.mark.parametrize(
|
@@ -82,3 +84,117 @@ def test_register_and_copy_darks_and_flats(
|
|
82
84
|
elif process_only_dkrf_scan_without_raw:
|
83
85
|
assert scan_without_raw.load_reduced_darks() not in (None, {})
|
84
86
|
assert scan_without_raw.load_reduced_flats() not in (None, {})
|
87
|
+
|
88
|
+
|
89
|
+
def test_save_reduced_frames_to_be_copied(tmp_path):
|
90
|
+
"""
|
91
|
+
test save_flats_to_be_copied and save_darks_to_be_copied functions
|
92
|
+
"""
|
93
|
+
# create raw data
|
94
|
+
from tomoscan.scanbase import ReducedFramesInfos
|
95
|
+
from silx.io.url import DataUrl
|
96
|
+
|
97
|
+
raw_data = tmp_path / "raw_data"
|
98
|
+
raw_data.mkdir()
|
99
|
+
dark_file_path = os.path.join(raw_data, "darks.h5")
|
100
|
+
darks_dict = {
|
101
|
+
"0": numpy.linspace(0, 100, 10000).reshape(100, 100),
|
102
|
+
ReducedFramesInfos.COUNT_TIME_KEY: numpy.array(
|
103
|
+
[
|
104
|
+
0.2,
|
105
|
+
]
|
106
|
+
),
|
107
|
+
ReducedFramesInfos.MACHINE_ELECT_CURRENT_KEY: numpy.array(
|
108
|
+
[
|
109
|
+
12.2,
|
110
|
+
]
|
111
|
+
),
|
112
|
+
}
|
113
|
+
|
114
|
+
dicttoh5(
|
115
|
+
darks_dict,
|
116
|
+
h5file=dark_file_path,
|
117
|
+
h5path="entry0000/darks",
|
118
|
+
update_mode="modify",
|
119
|
+
mode="a",
|
120
|
+
)
|
121
|
+
|
122
|
+
flat_file_path = os.path.join(raw_data, "flats.hdf5")
|
123
|
+
flats_dict = {
|
124
|
+
"0": numpy.linspace(0, 100, 10000).reshape(100, 100),
|
125
|
+
"200": numpy.ones((100, 100)).reshape(100, 100),
|
126
|
+
ReducedFramesInfos.COUNT_TIME_KEY: numpy.array([0.2, 0.3]),
|
127
|
+
ReducedFramesInfos.MACHINE_ELECT_CURRENT_KEY: numpy.array([12.2, 12.1]),
|
128
|
+
}
|
129
|
+
|
130
|
+
dicttoh5(
|
131
|
+
flats_dict,
|
132
|
+
h5file=flat_file_path,
|
133
|
+
h5path="entry0000/flats",
|
134
|
+
update_mode="modify",
|
135
|
+
mode="a",
|
136
|
+
)
|
137
|
+
|
138
|
+
raw_darks_url_1 = DataUrl(
|
139
|
+
file_path=dark_file_path,
|
140
|
+
data_path="entry0000",
|
141
|
+
)
|
142
|
+
raw_darks_url_2 = DataUrl(
|
143
|
+
file_path=dark_file_path,
|
144
|
+
data_path="entry0000/darks",
|
145
|
+
)
|
146
|
+
raw_darks_url_3 = DataUrl(
|
147
|
+
file_path=dark_file_path,
|
148
|
+
data_path="",
|
149
|
+
)
|
150
|
+
|
151
|
+
assert (
|
152
|
+
DarkRefsCopy.get_reduced_frame_data(
|
153
|
+
url=raw_darks_url_1, reduced_target="darks"
|
154
|
+
).keys()
|
155
|
+
== darks_dict.keys()
|
156
|
+
)
|
157
|
+
assert (
|
158
|
+
DarkRefsCopy.get_reduced_frame_data(
|
159
|
+
url=raw_darks_url_2, reduced_target="darks"
|
160
|
+
).keys()
|
161
|
+
== darks_dict.keys()
|
162
|
+
)
|
163
|
+
assert (
|
164
|
+
DarkRefsCopy.get_reduced_frame_data(
|
165
|
+
url=raw_darks_url_3, reduced_target="darks"
|
166
|
+
).keys()
|
167
|
+
!= darks_dict.keys()
|
168
|
+
)
|
169
|
+
|
170
|
+
flat_darks_url_1 = DataUrl(
|
171
|
+
file_path=flat_file_path,
|
172
|
+
data_path="entry0000",
|
173
|
+
)
|
174
|
+
flat_darks_url_2 = DataUrl(
|
175
|
+
file_path=flat_file_path,
|
176
|
+
data_path="entry0000/flats",
|
177
|
+
)
|
178
|
+
flat_darks_url_3 = DataUrl(
|
179
|
+
file_path=flat_file_path,
|
180
|
+
data_path="",
|
181
|
+
)
|
182
|
+
|
183
|
+
assert (
|
184
|
+
DarkRefsCopy.get_reduced_frame_data(
|
185
|
+
url=flat_darks_url_1, reduced_target="flats"
|
186
|
+
).keys()
|
187
|
+
== flats_dict.keys()
|
188
|
+
)
|
189
|
+
assert (
|
190
|
+
DarkRefsCopy.get_reduced_frame_data(
|
191
|
+
url=flat_darks_url_2, reduced_target="flats"
|
192
|
+
).keys()
|
193
|
+
== flats_dict.keys()
|
194
|
+
)
|
195
|
+
assert (
|
196
|
+
DarkRefsCopy.get_reduced_frame_data(
|
197
|
+
url=flat_darks_url_3, reduced_target="flats"
|
198
|
+
).keys()
|
199
|
+
!= flats_dict.keys()
|
200
|
+
)
|
@@ -32,6 +32,8 @@ from tomwer.core.process.task import Task
|
|
32
32
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
33
33
|
from tomwer.core.scan.scanfactory import ScanFactory
|
34
34
|
from tomwer.core.scan.edfscan import EDFTomoScan
|
35
|
+
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
36
|
+
from tomwer.core.utils.volumeutils import volume_identifier_to_volume
|
35
37
|
import tomwer.version
|
36
38
|
import logging
|
37
39
|
import code
|
@@ -40,22 +42,29 @@ import code
|
|
40
42
|
_logger = logging.getLogger(__name__)
|
41
43
|
|
42
44
|
|
43
|
-
class PythonScript(
|
45
|
+
class PythonScript(
|
46
|
+
Task, optional_input_names=("data", "volume"), output_names=("data", "volume")
|
47
|
+
):
|
44
48
|
def run(self):
|
45
|
-
|
49
|
+
# load data
|
50
|
+
scan = data_identifier_to_scan(self.inputs.data)
|
46
51
|
if isinstance(scan, dict):
|
47
52
|
scan = ScanFactory.create_scan_object_frm_dict(scan)
|
48
|
-
elif isinstance(scan, TomwerScanBase):
|
53
|
+
elif isinstance(scan, (TomwerScanBase, type(None))):
|
49
54
|
scan = scan
|
50
55
|
else:
|
51
56
|
raise ValueError(
|
52
57
|
"input type of {}: {} is not managed" "".format(scan, type(scan))
|
53
58
|
)
|
59
|
+
# load volume
|
60
|
+
volume = volume_identifier_to_volume(self.inputs.volume)
|
54
61
|
|
55
62
|
cfg = self.get_configuration()
|
56
63
|
interpreter = code.InteractiveConsole(locals={"in_data": scan})
|
64
|
+
interpreter = code.InteractiveConsole(locals={"in_volume": volume})
|
57
65
|
interpreter.runcode(cfg["scriptText"])
|
58
|
-
|
66
|
+
out_data = data_identifier_to_scan(interpreter.locals.get("out_data"))
|
67
|
+
out_volume = data_identifier_to_scan(interpreter.locals.get("out_volume"))
|
59
68
|
|
60
69
|
# register process
|
61
70
|
if isinstance(scan, EDFTomoScan):
|
@@ -63,25 +72,20 @@ class PythonScript(Task, input_names=("data",), output_names=("data",)):
|
|
63
72
|
else:
|
64
73
|
entry = scan.entry
|
65
74
|
|
66
|
-
results = {}
|
67
|
-
if res is not None:
|
68
|
-
if hasattr(res, "to_dict"):
|
69
|
-
results = res.to_dict()
|
70
|
-
else:
|
71
|
-
results = res
|
72
75
|
try:
|
73
76
|
self.register_process(
|
74
77
|
process_file=scan.process_file,
|
75
78
|
entry=entry,
|
76
79
|
configuration={"scriptText": self.get_configuration()["scriptText"]},
|
77
|
-
results=
|
80
|
+
results=None,
|
78
81
|
process_index=scan.pop_process_index(),
|
79
82
|
overwrite=True,
|
80
83
|
)
|
81
84
|
except Exception as e:
|
82
85
|
_logger.error("Fail to register process. Error is " + str(e))
|
83
86
|
|
84
|
-
self.outputs.data =
|
87
|
+
self.outputs.data = out_data
|
88
|
+
self.outputs.volume = out_volume
|
85
89
|
|
86
90
|
@staticmethod
|
87
91
|
def program_name():
|
tomwer/core/process/task.py
CHANGED
@@ -97,7 +97,9 @@ class BaseProcessInfo:
|
|
97
97
|
@staticmethod
|
98
98
|
def _get_lock(file_name):
|
99
99
|
if file_name not in _MULTIPROCESSING_LOCKERS:
|
100
|
-
_MULTIPROCESSING_LOCKERS[
|
100
|
+
_MULTIPROCESSING_LOCKERS[
|
101
|
+
file_name
|
102
|
+
] = mult_manager.Lock() # pylint: disable=E1101
|
101
103
|
return _MULTIPROCESSING_LOCKERS[file_name]
|
102
104
|
|
103
105
|
@staticmethod
|
@@ -133,12 +135,6 @@ class BaseProcessInfo:
|
|
133
135
|
"""
|
134
136
|
self._output_values[key] = value
|
135
137
|
|
136
|
-
def key_exist(self, key):
|
137
|
-
for _output in self.outputs:
|
138
|
-
if _output.name == key:
|
139
|
-
return True
|
140
|
-
return False
|
141
|
-
|
142
138
|
@staticmethod
|
143
139
|
def program_name():
|
144
140
|
"""Name of the program used for this processing"""
|
@@ -34,7 +34,7 @@ import unittest
|
|
34
34
|
import numpy
|
35
35
|
import os
|
36
36
|
import h5py
|
37
|
-
from tomwer.
|
37
|
+
from tomwer.tests.utils import UtilsTest
|
38
38
|
from tomwer.core.utils.scanutils import MockEDF, MockHDF5
|
39
39
|
from ..reconstruction.axis.axis import AxisProcess
|
40
40
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
@@ -33,13 +33,15 @@ import shutil
|
|
33
33
|
import tempfile
|
34
34
|
import unittest
|
35
35
|
import numpy
|
36
|
-
import time
|
37
36
|
from tomwer.core.utils.scanutils import MockEDF, MockHDF5
|
38
|
-
from tomwer.core.process.reconstruction.darkref.params import
|
37
|
+
from tomwer.core.process.reconstruction.darkref.params import (
|
38
|
+
DKRFRP,
|
39
|
+
ReduceMethod as cMethod,
|
40
|
+
)
|
39
41
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
40
42
|
from ..reconstruction.darkref.darkrefs import DarkRefs
|
41
43
|
from ..reconstruction.darkref.darkrefscopy import DarkRefsCopy
|
42
|
-
from tomwer.
|
44
|
+
from tomwer.tests.utils import UtilsTest
|
43
45
|
from tomwer.core.scan.hdf5scan import HDF5TomoScan
|
44
46
|
from tomoscan.esrf.scan.utils import get_data
|
45
47
|
|
@@ -145,11 +147,13 @@ class TestDarkRefEdf(unittest.TestCase):
|
|
145
147
|
|
146
148
|
def setUp(self) -> None:
|
147
149
|
self.scan_folder = tempfile.mkdtemp()
|
148
|
-
self.dark_data = numpy.array(
|
149
|
-
numpy.random.random(4 * 200 * 200) * 100,
|
150
|
+
self.dark_data = numpy.array( # pylint: disable=E1121
|
151
|
+
numpy.random.random(4 * 200 * 200) * 100,
|
152
|
+
dtype=numpy.uint16,
|
150
153
|
).reshape(4, 200, 200)
|
151
|
-
self.flat_data = numpy.array(
|
152
|
-
numpy.random.random(4 * 200 * 200) * 100,
|
154
|
+
self.flat_data = numpy.array( # pylint: disable=E1121
|
155
|
+
numpy.random.random(4 * 200 * 200) * 100,
|
156
|
+
dtype=numpy.uint32,
|
153
157
|
).reshape(4, 200, 200)
|
154
158
|
self.scan = MockEDF.mockScan(
|
155
159
|
scanID=self.scan_folder,
|
@@ -175,10 +179,10 @@ class TestDarkRefEdf(unittest.TestCase):
|
|
175
179
|
Test darks are computed when only dark are requested
|
176
180
|
"""
|
177
181
|
method_to_test = (
|
178
|
-
cMethod.
|
179
|
-
cMethod.
|
180
|
-
cMethod.
|
181
|
-
cMethod.
|
182
|
+
cMethod.MEDIAN,
|
183
|
+
cMethod.MEAN,
|
184
|
+
cMethod.FIRST,
|
185
|
+
cMethod.LAST,
|
182
186
|
)
|
183
187
|
th_results = (
|
184
188
|
numpy.median(self.dark_data, axis=0),
|
@@ -198,13 +202,8 @@ class TestDarkRefEdf(unittest.TestCase):
|
|
198
202
|
)
|
199
203
|
|
200
204
|
self.recons_params.dark_calc_method = method
|
201
|
-
self.recons_params.
|
205
|
+
self.recons_params.flat_calc_method = cMethod.NONE
|
202
206
|
process.run()
|
203
|
-
self.assertTrue(os.path.exists(self.scan.process_file))
|
204
|
-
darks = DarkRefs.get_darks_frm_process_file(
|
205
|
-
self.scan.process_file, entry="entry"
|
206
|
-
)
|
207
|
-
self.assertEqual(len(darks), 1)
|
208
207
|
numpy.testing.assert_array_almost_equal(
|
209
208
|
self.scan.reduced_darks[0], th_res.astype(numpy.uint16)
|
210
209
|
)
|
@@ -214,10 +213,10 @@ class TestDarkRefEdf(unittest.TestCase):
|
|
214
213
|
Test flats are computed when only flat are requested
|
215
214
|
"""
|
216
215
|
method_to_test = (
|
217
|
-
cMethod.
|
218
|
-
cMethod.
|
219
|
-
cMethod.
|
220
|
-
cMethod.
|
216
|
+
cMethod.MEDIAN,
|
217
|
+
cMethod.MEAN,
|
218
|
+
cMethod.FIRST,
|
219
|
+
cMethod.LAST,
|
221
220
|
)
|
222
221
|
th_results = (
|
223
222
|
numpy.median(self.flat_data, axis=0),
|
@@ -229,8 +228,8 @@ class TestDarkRefEdf(unittest.TestCase):
|
|
229
228
|
with self.subTest(method=method):
|
230
229
|
if os.path.exists(self.scan.process_file):
|
231
230
|
os.remove(self.scan.process_file)
|
232
|
-
self.recons_params.dark_calc_method = cMethod.
|
233
|
-
self.recons_params.
|
231
|
+
self.recons_params.dark_calc_method = cMethod.NONE
|
232
|
+
self.recons_params.flat_calc_method = method
|
234
233
|
process = DarkRefs(
|
235
234
|
inputs={
|
236
235
|
"dark_ref_params": self.recons_params,
|
@@ -238,11 +237,6 @@ class TestDarkRefEdf(unittest.TestCase):
|
|
238
237
|
}
|
239
238
|
)
|
240
239
|
process.run()
|
241
|
-
self.assertTrue(os.path.exists(self.scan.process_file))
|
242
|
-
flats = DarkRefs.get_flats_frm_process_file(
|
243
|
-
self.scan.process_file, entry="entry"
|
244
|
-
)
|
245
|
-
self.assertEqual(len(flats), 1)
|
246
240
|
numpy.testing.assert_array_almost_equal(
|
247
241
|
self.scan.reduced_flats[0], th_res.astype(numpy.uint16)
|
248
242
|
)
|
@@ -277,33 +271,23 @@ class TestDarkRefNx(unittest.TestCase):
|
|
277
271
|
"""
|
278
272
|
darks = self.scan.darks
|
279
273
|
self.assertEqual(len(darks), 1)
|
280
|
-
dark_data = get_data(list(darks.values())[0])
|
281
274
|
|
282
|
-
method_to_test = (cMethod.
|
275
|
+
method_to_test = (cMethod.MEAN, cMethod.MEDIAN, cMethod.FIRST, cMethod.LAST)
|
283
276
|
for method in method_to_test:
|
284
277
|
with self.subTest(method=method):
|
285
278
|
self.recons_params.dark_calc_method = method
|
286
|
-
self.recons_params.
|
279
|
+
self.recons_params.flat_calc_method = cMethod.NONE
|
287
280
|
process = DarkRefs(
|
288
281
|
inputs={
|
289
282
|
"dark_ref_params": self.recons_params,
|
290
283
|
"data": self.scan,
|
291
284
|
}
|
292
285
|
)
|
293
|
-
if os.path.exists(self.scan.process_file):
|
294
|
-
os.remove(self.scan.process_file)
|
295
|
-
|
296
286
|
process.run()
|
297
|
-
self.
|
298
|
-
darks = DarkRefs.get_darks_frm_process_file(
|
299
|
-
self.scan.process_file, entry=self.scan.entry
|
300
|
-
)
|
301
|
-
self.assertEqual(len(darks), 1)
|
302
|
-
self.assertTrue(numpy.allclose(darks[0], dark_data))
|
303
|
-
flats = DarkRefs.get_flats_frm_process_file(
|
304
|
-
self.scan.process_file, entry=self.scan.entry
|
305
|
-
)
|
287
|
+
flats = self.scan.load_reduced_flats()
|
306
288
|
self.assertEqual(len(flats), 0)
|
289
|
+
darks = self.scan.load_reduced_darks()
|
290
|
+
self.assertEqual(len(darks), 1)
|
307
291
|
|
308
292
|
def testFlat(self):
|
309
293
|
"""
|
@@ -321,26 +305,26 @@ class TestDarkRefNx(unittest.TestCase):
|
|
321
305
|
self.recons_params.overwrite_dark = True
|
322
306
|
self.recons_params.overwrite_ref = True
|
323
307
|
|
324
|
-
method_to_test = (cMethod.
|
308
|
+
method_to_test = (cMethod.MEAN, cMethod.MEDIAN, cMethod.FIRST, cMethod.LAST)
|
325
309
|
for method in method_to_test:
|
326
310
|
with self.subTest(method=method):
|
327
|
-
if method is cMethod.
|
311
|
+
if method is cMethod.MEDIAN:
|
328
312
|
expected_res_s1 = numpy.median(data_flat_serie_1, axis=0)
|
329
313
|
expected_res_s2 = numpy.median(data_flat_serie_2, axis=0)
|
330
|
-
elif method is cMethod.
|
314
|
+
elif method is cMethod.MEAN:
|
331
315
|
expected_res_s1 = numpy.mean(data_flat_serie_1, axis=0)
|
332
316
|
expected_res_s2 = numpy.mean(data_flat_serie_2, axis=0)
|
333
|
-
elif method is cMethod.
|
317
|
+
elif method is cMethod.FIRST:
|
334
318
|
expected_res_s1 = data_flat_serie_1[0]
|
335
319
|
expected_res_s2 = data_flat_serie_2[0]
|
336
|
-
elif method is cMethod.
|
320
|
+
elif method is cMethod.LAST:
|
337
321
|
expected_res_s1 = data_flat_serie_1[-1]
|
338
322
|
expected_res_s2 = data_flat_serie_2[-1]
|
339
323
|
else:
|
340
324
|
raise ValueError("method not managed")
|
341
325
|
|
342
|
-
self.recons_params.dark_calc_method = cMethod.
|
343
|
-
self.recons_params.
|
326
|
+
self.recons_params.dark_calc_method = cMethod.NONE
|
327
|
+
self.recons_params.flat_calc_method = method
|
344
328
|
process = DarkRefs(
|
345
329
|
inputs={
|
346
330
|
"dark_ref_params": self.recons_params,
|
@@ -348,14 +332,10 @@ class TestDarkRefNx(unittest.TestCase):
|
|
348
332
|
}
|
349
333
|
)
|
350
334
|
process.run()
|
351
|
-
|
352
|
-
darks =
|
353
|
-
self.scan.process_file, entry=self.scan.entry
|
354
|
-
)
|
335
|
+
|
336
|
+
darks = self.scan.load_reduced_darks()
|
355
337
|
self.assertEqual(len(darks), 0)
|
356
|
-
flats =
|
357
|
-
self.scan.process_file, entry=self.scan.entry
|
358
|
-
)
|
338
|
+
flats = self.scan.load_reduced_flats()
|
359
339
|
self.assertEqual(len(flats), 2)
|
360
340
|
self.assertTrue(1 in flats)
|
361
341
|
self.assertTrue(1521 in flats)
|
@@ -375,8 +355,8 @@ class TestDarkRefNx(unittest.TestCase):
|
|
375
355
|
data_flat_serie_1 = [get_data(url) for url in url_flat_serie_1]
|
376
356
|
data_flat_serie_2 = [get_data(url) for url in url_flat_serie_2]
|
377
357
|
|
378
|
-
self.recons_params.dark_calc_method = cMethod.
|
379
|
-
self.recons_params.
|
358
|
+
self.recons_params.dark_calc_method = cMethod.MEAN
|
359
|
+
self.recons_params.flat_calc_method = cMethod.MEDIAN
|
380
360
|
darks = self.scan.darks
|
381
361
|
self.assertEqual(len(darks), 1)
|
382
362
|
dark_data = get_data(list(darks.values())[0])
|
@@ -390,14 +370,9 @@ class TestDarkRefNx(unittest.TestCase):
|
|
390
370
|
}
|
391
371
|
)
|
392
372
|
process.run()
|
393
|
-
self.
|
394
|
-
|
395
|
-
self.scan.process_file, entry=self.scan.entry
|
396
|
-
)
|
373
|
+
darks = self.scan.load_reduced_darks()
|
374
|
+
flats = self.scan.load_reduced_flats()
|
397
375
|
self.assertEqual(len(darks), 1)
|
398
|
-
flats = DarkRefs.get_flats_frm_process_file(
|
399
|
-
self.scan.process_file, entry=self.scan.entry
|
400
|
-
)
|
401
376
|
self.assertEqual(len(flats), 2)
|
402
377
|
self.assertTrue(0 in darks)
|
403
378
|
self.assertTrue(1 in flats)
|
@@ -405,48 +380,3 @@ class TestDarkRefNx(unittest.TestCase):
|
|
405
380
|
self.assertTrue(numpy.allclose(flats[1], expected_flats_s1))
|
406
381
|
self.assertTrue(numpy.allclose(flats[1521], expected_flats_s2))
|
407
382
|
self.assertTrue(numpy.allclose(darks[0], dark_data))
|
408
|
-
|
409
|
-
def testReprocessing(self):
|
410
|
-
"""
|
411
|
-
Make sure computation is executed only when necessary
|
412
|
-
"""
|
413
|
-
self.assertTrue(self.scan.reduced_darks in (None, {}))
|
414
|
-
self.assertTrue(self.scan.reduced_flats in (None, {}))
|
415
|
-
process = DarkRefs(
|
416
|
-
inputs={
|
417
|
-
"dark_ref_params": self.recons_params,
|
418
|
-
"data": self.scan,
|
419
|
-
}
|
420
|
-
)
|
421
|
-
process.run()
|
422
|
-
self.assertEqual(len(self.scan.reduced_darks), 1)
|
423
|
-
self.assertEqual(len(self.scan.reduced_flats), 2)
|
424
|
-
|
425
|
-
# test behavior if overwrite is False
|
426
|
-
self.recons_params.overwrite_dark = False
|
427
|
-
self.recons_params.overwrite_flat = False
|
428
|
-
self.scan.set_reduced_darks(None)
|
429
|
-
self.scan.set_reduced_flats(None)
|
430
|
-
timestamp_tomwer_processes = os.path.getmtime(self.scan.process_file)
|
431
|
-
time.sleep(1)
|
432
|
-
process.run()
|
433
|
-
self.assertEqual(
|
434
|
-
timestamp_tomwer_processes, os.path.getmtime(self.scan.process_file)
|
435
|
-
)
|
436
|
-
self.assertEqual(len(self.scan.reduced_darks), 1)
|
437
|
-
self.assertEqual(len(self.scan.reduced_flats), 2)
|
438
|
-
|
439
|
-
# test behavior if overwrite is True
|
440
|
-
self.recons_params.overwrite_dark = True
|
441
|
-
self.recons_params.overwrite_flat = True
|
442
|
-
self.scan.set_reduced_darks(None)
|
443
|
-
self.scan.set_reduced_flats(None)
|
444
|
-
|
445
|
-
timestamp_tomwer_processes = os.path.getmtime(self.scan.process_file)
|
446
|
-
time.sleep(1)
|
447
|
-
process.run()
|
448
|
-
self.assertNotEqual(
|
449
|
-
timestamp_tomwer_processes, os.path.getmtime(self.scan.process_file)
|
450
|
-
)
|
451
|
-
self.assertEqual(len(self.scan.reduced_darks), 1)
|
452
|
-
self.assertEqual(len(self.scan.reduced_flats), 2)
|
@@ -29,7 +29,6 @@ __date__ = "09/06/2020"
|
|
29
29
|
|
30
30
|
|
31
31
|
import unittest
|
32
|
-
import requests
|
33
32
|
import tempfile
|
34
33
|
import shutil
|
35
34
|
import os
|
@@ -81,34 +80,6 @@ class JSONRPCClient:
|
|
81
80
|
"id": 3,
|
82
81
|
}
|
83
82
|
|
84
|
-
def execute(self):
|
85
|
-
url = "http://localhost:4000/jsonrpc"
|
86
|
-
timeout = 1.5
|
87
|
-
|
88
|
-
requests.post(
|
89
|
-
url,
|
90
|
-
json=self.sequence_started(
|
91
|
-
saving_file="saving_file.h5",
|
92
|
-
scan_title="my scan title",
|
93
|
-
entry_name="entry0000",
|
94
|
-
proposal_file="ihpropfile.h5",
|
95
|
-
),
|
96
|
-
timeout=timeout,
|
97
|
-
).json()
|
98
|
-
requests.post(
|
99
|
-
url, json=self.scan_started(scan_number="0001"), timeout=timeout
|
100
|
-
).json()
|
101
|
-
requests.post(
|
102
|
-
url, json=self.scan_ended(scan_number="0001"), timeout=timeout
|
103
|
-
).json()
|
104
|
-
requests.post(
|
105
|
-
url,
|
106
|
-
json=self.sequence_ended(
|
107
|
-
saving_file="saving_file.h5", entry_name="entry0000", suceed=True
|
108
|
-
),
|
109
|
-
timeout=timeout,
|
110
|
-
).json()
|
111
|
-
|
112
83
|
|
113
84
|
class TestJsonRPCServer(unittest.TestCase):
|
114
85
|
"""test the json rpc server"""
|
@@ -28,27 +28,27 @@ __license__ = "MIT"
|
|
28
28
|
__date__ = "05/04/2019"
|
29
29
|
|
30
30
|
|
31
|
-
import
|
32
|
-
import tempfile
|
33
|
-
import shutil
|
34
|
-
import time
|
31
|
+
import gc
|
35
32
|
import os
|
36
33
|
import h5py
|
34
|
+
import time
|
37
35
|
import numpy
|
38
|
-
|
36
|
+
import pytest
|
37
|
+
import shutil
|
38
|
+
import unittest
|
39
|
+
import tempfile
|
39
40
|
from tomoscan.io import HDF5File
|
40
41
|
from tomwer.core.scan.hdf5scan import HDF5TomoScan
|
41
42
|
from tomwer.core.utils.scanutils import MockEDF
|
42
43
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
43
44
|
from tomwer.core.process.control.scantransfer import ScanTransfer
|
44
|
-
from tomwer.
|
45
|
+
from tomwer.tests.utils import UtilsTest
|
45
46
|
from tomwer.synctools.rsyncmanager import RSyncManager
|
46
47
|
from tomwer.core.process.control.datalistener import DataListener
|
47
48
|
from nxtomomill.converter import from_h5_to_nx
|
48
49
|
from nxtomomill.io.config.hdf5config import TomoHDF5Config
|
49
|
-
import pytest
|
50
50
|
from tomoscan.validator import is_valid_for_reconstruction
|
51
|
-
from tomoscan.esrf.hdf5scan import ImageKey
|
51
|
+
from tomoscan.esrf.scan.hdf5scan import ImageKey
|
52
52
|
|
53
53
|
|
54
54
|
class TestDataTransferIO(unittest.TestCase):
|
@@ -146,6 +146,7 @@ class TestBlissDataTransfer(unittest.TestCase):
|
|
146
146
|
def tearDown(self):
|
147
147
|
shutil.rmtree(self.input_dir)
|
148
148
|
shutil.rmtree(self.output_dir)
|
149
|
+
gc.collect()
|
149
150
|
|
150
151
|
def testDataTransfer(self):
|
151
152
|
"""Make sure the data transfer is able to retrieve the scan,
|
@@ -153,10 +154,6 @@ class TestBlissDataTransfer(unittest.TestCase):
|
|
153
154
|
Check that only the specific scan folders will be copy and removed
|
154
155
|
and the other won't be affected.
|
155
156
|
"""
|
156
|
-
out_nx = os.path.join(
|
157
|
-
self.output_dir, "sample_29042021", "sample_29042021_1_1.nx"
|
158
|
-
)
|
159
|
-
self.assertFalse(os.path.exists(out_nx))
|
160
157
|
out_proposal = os.path.join(self.output_dir, "ihpayno_sample.h5")
|
161
158
|
self.assertFalse(os.path.exists(out_proposal))
|
162
159
|
out_sample_file = os.path.join(
|
@@ -186,8 +183,7 @@ class TestBlissDataTransfer(unittest.TestCase):
|
|
186
183
|
process.run()
|
187
184
|
|
188
185
|
time.sleep(1)
|
189
|
-
self.assertTrue(os.path.exists(
|
190
|
-
# self.assertTrue(os.path.exists(out_proposal), f"{out_proposal} does not exists")
|
186
|
+
self.assertTrue(os.path.exists(out_proposal), f"{out_proposal} does not exists")
|
191
187
|
self.assertTrue(
|
192
188
|
os.path.exists(out_sample_file), f"{out_sample_file} does not exists"
|
193
189
|
)
|
@@ -32,7 +32,7 @@ import shutil
|
|
32
32
|
import tempfile
|
33
33
|
from glob import glob
|
34
34
|
import unittest
|
35
|
-
from tomwer.
|
35
|
+
from tomwer.tests.utils import UtilsTest
|
36
36
|
from tomwer.core.process.reconstruction.nabu import nabuslices as nabu
|
37
37
|
from tomwer.core.process.reconstruction.nabu import utils as nabuutils
|
38
38
|
from tomwer.core.scan.scanfactory import ScanFactory
|
@@ -63,7 +63,7 @@ class TestNormalization(unittest.TestCase):
|
|
63
63
|
# step1: rewrite the detector data to simplify result check
|
64
64
|
with h5py.File(self.scan.master_file, mode="a") as h5f:
|
65
65
|
dataset = h5f["/entry/instrument/detector/data"]
|
66
|
-
assert dataset.shape == (2, 100, 100)
|
66
|
+
assert dataset.shape == (2, 100, 100) # pylint: disable=E1101
|
67
67
|
del h5f["/entry/instrument/detector/data"]
|
68
68
|
h5f["/entry/instrument/detector/data"] = numpy.arange(
|
69
69
|
100 * 100 * 2
|