tomwer 1.3.7__py3-none-any.whl → 1.3.8__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.
- tomwer/core/process/reconstruction/nabu/utils.py +2 -0
- tomwer/gui/control/datawatcher/datawatcher.py +1 -24
- tomwer/version.py +1 -1
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/METADATA +1 -1
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/RECORD +11 -108
- orangecontrib/tomwer/test/TestAcquisition.py +0 -246
- orangecontrib/tomwer/widgets/cluster/test/test_future_supervisorow.py +0 -87
- orangecontrib/tomwer/widgets/cluster/test/test_slurm_clusterow.py +0 -67
- orangecontrib/tomwer/widgets/control/test/test_advancement.py +0 -51
- orangecontrib/tomwer/widgets/control/test/test_data_validator.py +0 -55
- orangecontrib/tomwer/widgets/control/test/test_datadiscovery.py +0 -131
- orangecontrib/tomwer/widgets/control/test/test_datalist.py +0 -70
- orangecontrib/tomwer/widgets/control/test/test_datalistener.py +0 -137
- orangecontrib/tomwer/widgets/control/test/test_dataselector.py +0 -95
- orangecontrib/tomwer/widgets/control/test/test_datawatcher.py +0 -436
- orangecontrib/tomwer/widgets/control/test/test_emailow.py +0 -29
- orangecontrib/tomwer/widgets/control/test/test_notifier.py +0 -51
- orangecontrib/tomwer/widgets/control/test/test_nxtomo_concatenate_ow.py +0 -64
- orangecontrib/tomwer/widgets/control/test/test_nxtomomill.py +0 -160
- orangecontrib/tomwer/widgets/control/test/test_reduce_dark_flat_selector.py +0 -40
- orangecontrib/tomwer/widgets/control/test/test_singletomoobj.py +0 -40
- orangecontrib/tomwer/widgets/control/test/test_timerow.py +0 -51
- orangecontrib/tomwer/widgets/control/test/test_tomoobj_serie.py +0 -96
- orangecontrib/tomwer/widgets/control/test/test_volume_selector.py +0 -69
- orangecontrib/tomwer/widgets/control/test/test_volumesymlink.py +0 -51
- orangecontrib/tomwer/widgets/debugtools/test/test_dataset_generator.py +0 -57
- orangecontrib/tomwer/widgets/debugtools/test/test_object_inspector.py +0 -62
- orangecontrib/tomwer/widgets/other/test/test_pythonscript.py +0 -31
- orangecontrib/tomwer/widgets/reconstruction/test/test_axis.py +0 -224
- orangecontrib/tomwer/widgets/reconstruction/test/test_cast_volumeow.py +0 -85
- orangecontrib/tomwer/widgets/reconstruction/test/test_dark_refs_widget.py +0 -136
- orangecontrib/tomwer/widgets/reconstruction/test/test_delta_beta_selector.py +0 -15
- orangecontrib/tomwer/widgets/reconstruction/test/test_i_norm.py +0 -226
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_helical_prepare_weights_double.py +0 -20
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_volume.py +0 -100
- orangecontrib/tomwer/widgets/reconstruction/test/test_nabu_widget.py +0 -107
- orangecontrib/tomwer/widgets/reconstruction/test/test_sa_delta_beta.py +0 -194
- orangecontrib/tomwer/widgets/reconstruction/test/test_saaxis.py +0 -220
- orangecontrib/tomwer/widgets/stitching/test/test_zstitching.py +0 -308
- orangecontrib/tomwer/widgets/test/test_conditions.py +0 -111
- orangecontrib/tomwer/widgets/test/test_darkref.py +0 -251
- orangecontrib/tomwer/widgets/test/test_foldertransfert.py +0 -131
- orangecontrib/tomwer/widgets/visualization/test/test_dataviewerow.py +0 -83
- orangecontrib/tomwer/widgets/visualization/test/test_diffviewerow.py +0 -65
- orangecontrib/tomwer/widgets/visualization/test/test_live_sliceow.py +0 -63
- orangecontrib/tomwer/widgets/visualization/test/test_nxtomo_metadata_viewer.py +0 -29
- orangecontrib/tomwer/widgets/visualization/test/test_radio_stackow.py +0 -56
- orangecontrib/tomwer/widgets/visualization/test/test_sample_movedow.py +0 -72
- orangecontrib/tomwer/widgets/visualization/test/test_sinogram_viewerow.py +0 -56
- orangecontrib/tomwer/widgets/visualization/test/test_slice_stackow.py +0 -57
- orangecontrib/tomwer/widgets/visualization/test/test_volume_viewerow.py +0 -57
- tomwer/core/log/test/test_processlog.py +0 -41
- tomwer/core/process/edit/test/test_darkflatpatch.py +0 -269
- tomwer/core/process/edit/test/test_imagekey_editor.py +0 -125
- tomwer/core/process/icat/test/test_create_screenshots.py +0 -98
- tomwer/core/process/icat/test/test_gallery.py +0 -170
- tomwer/core/process/reconstruction/nabu/test/test_castvolume.py +0 -143
- tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +0 -203
- tomwer/core/process/reconstruction/nabu/test/test_nabunormalization.py +0 -222
- tomwer/core/process/script/test/test_script.py +0 -68
- tomwer/core/process/stitching/test/test_metadataholder.py +0 -17
- tomwer/core/process/visualization/test/test_data_viewer.py +0 -39
- tomwer/core/process/visualization/test/test_diff_viewer.py +0 -39
- tomwer/core/process/visualization/test/test_image_stack_viewer.py +0 -41
- tomwer/core/process/visualization/test/test_radio_stack.py +0 -39
- tomwer/core/process/visualization/test/test_sample_moved.py +0 -41
- tomwer/core/process/visualization/test/test_sinogram_viewer.py +0 -39
- tomwer/core/process/visualization/test/test_slice_stack.py +0 -39
- tomwer/core/process/visualization/test/test_volume_viewer.py +0 -39
- tomwer/core/utils/test/test_image.py +0 -30
- tomwer/core/utils/test/test_nxtomo.py +0 -66
- tomwer/core/utils/test/test_scan_utils.py +0 -46
- tomwer/core/utils/test/test_time.py +0 -6
- tomwer/core/volume/test/test_volumes.py +0 -21
- tomwer/gui/control/serie/test/test_creator.py +0 -451
- tomwer/gui/control/serie/test/test_nxtomo_concatenate.py +0 -21
- tomwer/gui/icat/test/test_create_screenshots_gui.py +0 -23
- tomwer/gui/icat/test/test_gallery_gui.py +0 -37
- tomwer/gui/reconstruction/nabu/test/test_check.py +0 -92
- tomwer/gui/reconstruction/nabu/test/test_ctf.py +0 -46
- tomwer/gui/reconstruction/nabu/test/test_helical.py +0 -21
- tomwer/gui/reconstruction/nabu/test/test_nabu_preprocessing.py +0 -81
- tomwer/gui/reconstruction/normalization/test/test_intensity.py +0 -119
- tomwer/gui/stitching/config/tests/test_axisparams.py +0 -25
- tomwer/gui/stitching/tests/test_axis_ordered_list.py +0 -21
- tomwer/gui/stitching/tests/test_normalization.py +0 -27
- tomwer/gui/stitching/tests/test_preview.py +0 -85
- tomwer/gui/stitching/tests/test_stitching_raw.py +0 -110
- tomwer/gui/stitching/tests/test_z_stitching.py +0 -67
- tomwer/gui/stitching/tests/utils.py +0 -79
- tomwer/gui/stitching/z_stitching/tests/test_fine_estimation.py +0 -35
- tomwer/gui/stitching/z_stitching/tests/test_raw_estimation.py +0 -215
- tomwer/gui/stitching/z_stitching/tests/test_stitching_window.py +0 -51
- tomwer/gui/utils/test/test_completer.py +0 -67
- tomwer/gui/utils/test/test_line_selector.py +0 -21
- tomwer/gui/utils/test/test_splashscreen.py +0 -8
- tomwer/gui/utils/test/test_vignettes.py +0 -68
- tomwer/io/utils/test/test_raw_and_processed_data.py +0 -10
- tomwer/io/utils/test/test_utils.py +0 -92
- tomwer/tests/test_ewoks/test_conversion.py +0 -104
- tomwer/tests/test_ewoks/test_single_node_execution.py +0 -112
- tomwer/tests/test_ewoks/test_workflows.py +0 -160
- /tomwer-1.3.7-py3.11-nspkg.pth → /tomwer-1.3.8-py3.11-nspkg.pth +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/LICENSE +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/WHEEL +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/entry_points.txt +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.3.7.dist-info → tomwer-1.3.8.dist-info}/top_level.txt +0 -0
@@ -1,66 +0,0 @@
|
|
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__ = "02/12/2021"
|
29
|
-
|
30
|
-
|
31
|
-
import pytest
|
32
|
-
from nxtomo.nxobject.nxdetector import ImageKey
|
33
|
-
|
34
|
-
from tomwer.core.utils.nxtomoutils import get_n_series
|
35
|
-
|
36
|
-
|
37
|
-
def test_get_n_series():
|
38
|
-
"""test tomwer.core.utils.nxtomoutils.get_n_series function"""
|
39
|
-
array_1 = (
|
40
|
-
[ImageKey.DARK_FIELD] * 2
|
41
|
-
+ [ImageKey.FLAT_FIELD]
|
42
|
-
+ [ImageKey.PROJECTION] * 4
|
43
|
-
+ [ImageKey.FLAT_FIELD]
|
44
|
-
)
|
45
|
-
|
46
|
-
with pytest.raises(ValueError):
|
47
|
-
get_n_series(array_1, ImageKey.INVALID)
|
48
|
-
with pytest.raises(ValueError):
|
49
|
-
get_n_series(array_1, 3)
|
50
|
-
|
51
|
-
assert len(array_1) == 8
|
52
|
-
assert get_n_series(array_1, ImageKey.DARK_FIELD) == 1
|
53
|
-
assert get_n_series(array_1, ImageKey.FLAT_FIELD) == 2
|
54
|
-
assert get_n_series(array_1, ImageKey.PROJECTION) == 1
|
55
|
-
assert get_n_series(array_1, 0) == 1
|
56
|
-
|
57
|
-
array_2 = (
|
58
|
-
[ImageKey.FLAT_FIELD.value]
|
59
|
-
+ [ImageKey.PROJECTION.value] * 4
|
60
|
-
+ [ImageKey.INVALID.value] * 2
|
61
|
-
+ [ImageKey.PROJECTION.value] * 3
|
62
|
-
+ [ImageKey.FLAT_FIELD.value]
|
63
|
-
)
|
64
|
-
assert get_n_series(array_2, ImageKey.DARK_FIELD) == 0
|
65
|
-
assert get_n_series(array_2, ImageKey.PROJECTION) == 1
|
66
|
-
assert get_n_series(array_2, ImageKey.FLAT_FIELD) == 2
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
from tomwer.core.scan.blissscan import BlissScan
|
4
|
-
from tomwer.core.scan.edfscan import EDFTomoScan
|
5
|
-
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
6
|
-
from tomwer.core.utils.scanutils import format_output_location
|
7
|
-
|
8
|
-
|
9
|
-
def test_format_output_location(tmp_path):
|
10
|
-
"""
|
11
|
-
test different use cases of 'format_output_location'
|
12
|
-
"""
|
13
|
-
bliss_raw_dir = tmp_path / "raw"
|
14
|
-
bliss_raw_dir.mkdir()
|
15
|
-
bliss_sample_dir = bliss_raw_dir / "sample"
|
16
|
-
bliss_sample_dir.mkdir()
|
17
|
-
bliss_master_file = bliss_sample_dir / "dataset.h5"
|
18
|
-
|
19
|
-
bliss_proposal_file = bliss_raw_dir / "ihsample.h5"
|
20
|
-
bliss_proposal_file = os.path.abspath(bliss_proposal_file)
|
21
|
-
|
22
|
-
bliss_scan = BlissScan(
|
23
|
-
master_file=bliss_master_file, entry="1.1", proposal_file=bliss_proposal_file
|
24
|
-
)
|
25
|
-
expected_path = os.path.join(tmp_path, "reduced", "sample")
|
26
|
-
assert (
|
27
|
-
format_output_location(
|
28
|
-
location="{scan_parent_dir_basename}/../reduced/{scan_dir_name}",
|
29
|
-
scan=bliss_scan,
|
30
|
-
)
|
31
|
-
== expected_path
|
32
|
-
)
|
33
|
-
|
34
|
-
edf_scan = EDFTomoScan("/test/my/folder/")
|
35
|
-
assert (
|
36
|
-
format_output_location(
|
37
|
-
location="{scan_parent_dir_basename}/output", scan=edf_scan
|
38
|
-
)
|
39
|
-
== "/test/my/output"
|
40
|
-
)
|
41
|
-
|
42
|
-
hdf5_scan = NXtomoScan("/ddsad/my/file.hdf5", entry="entry0000")
|
43
|
-
assert (
|
44
|
-
format_output_location(location="{scan_basename}/output.nx", scan=hdf5_scan)
|
45
|
-
== "/ddsad/my/output.nx"
|
46
|
-
)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
from tomwer.core.volume import EDFVolume, HDF5Volume, RawVolume
|
2
|
-
from tomwer.core.volume.rawvolume import RawVolumeIdentifier
|
3
|
-
|
4
|
-
|
5
|
-
def test_volume_data_parent_folder():
|
6
|
-
edf_volume = EDFVolume(folder="/my/folder/path")
|
7
|
-
assert edf_volume.volume_data_parent_folder() == "/my/folder"
|
8
|
-
|
9
|
-
hdf5_volume = HDF5Volume(file_path="/path/to/hdf5/file.hdf5", data_path="entry")
|
10
|
-
assert hdf5_volume.volume_data_parent_folder() == "/path/to/hdf5"
|
11
|
-
|
12
|
-
raw_volume = RawVolume(file_path="/path/to/raw.vol")
|
13
|
-
assert raw_volume.volume_data_parent_folder() == "/path/to"
|
14
|
-
|
15
|
-
|
16
|
-
def test_raw_identifier():
|
17
|
-
raw_volume = RawVolume(file_path="/path/to/raw.vol")
|
18
|
-
assert (
|
19
|
-
RawVolumeIdentifier.from_str(raw_volume.get_identifier().to_str())
|
20
|
-
== raw_volume.get_identifier()
|
21
|
-
)
|
@@ -1,451 +0,0 @@
|
|
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__ = "12/01/2022"
|
29
|
-
|
30
|
-
|
31
|
-
import os
|
32
|
-
import shutil
|
33
|
-
import tempfile
|
34
|
-
|
35
|
-
from silx.gui import qt
|
36
|
-
from silx.gui.utils.testutils import SignalListener, TestCaseQt
|
37
|
-
from tomoscan.serie import Serie
|
38
|
-
|
39
|
-
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
40
|
-
from tomwer.core.utils.scanutils import MockEDF, MockNXtomo
|
41
|
-
from tomwer.core.volume.hdf5volume import HDF5Volume
|
42
|
-
from tomwer.gui.control.serie.seriecreator import (
|
43
|
-
SerieDefinition,
|
44
|
-
SerieHistoryDialog,
|
45
|
-
SerieManualControlDialog,
|
46
|
-
SerieManualFromTomoObj,
|
47
|
-
SerieTree,
|
48
|
-
SerieWidget,
|
49
|
-
)
|
50
|
-
|
51
|
-
|
52
|
-
class _MockScanBase:
|
53
|
-
def init(self):
|
54
|
-
n_hdf5_scan = 11
|
55
|
-
self._scans = []
|
56
|
-
self._root_dir = tempfile.mkdtemp()
|
57
|
-
for i_scan in range(n_hdf5_scan):
|
58
|
-
scan_path = os.path.join(self._root_dir, f"scan_{i_scan}")
|
59
|
-
scan = MockNXtomo(scan_path=scan_path, n_proj=10, n_ini_proj=0).scan
|
60
|
-
self._scans.append(scan)
|
61
|
-
n_edf_scan = 4
|
62
|
-
for i_scan in range(n_edf_scan):
|
63
|
-
scan_path = os.path.join(self._root_dir, f"scan_{i_scan}")
|
64
|
-
scan = MockEDF.mockScan(
|
65
|
-
scanID=scan_path,
|
66
|
-
nRadio=10,
|
67
|
-
dim=10,
|
68
|
-
)
|
69
|
-
self._scans.append(scan)
|
70
|
-
|
71
|
-
def close(self):
|
72
|
-
shutil.rmtree(self._root_dir)
|
73
|
-
|
74
|
-
|
75
|
-
class _MockSerieBase(_MockScanBase):
|
76
|
-
def init(self):
|
77
|
-
super().init()
|
78
|
-
self._series = [
|
79
|
-
Serie("serie1", self._scans[0:1], use_identifiers=True),
|
80
|
-
Serie("serie2", self._scans[1:5], use_identifiers=False),
|
81
|
-
Serie("serie3", self._scans[5:11], use_identifiers=True),
|
82
|
-
Serie("serie4", self._scans[8:11], use_identifiers=True),
|
83
|
-
Serie("serie5", self._scans[-2:-1], use_identifiers=False),
|
84
|
-
Serie("serie6", self._scans[-5:], use_identifiers=True),
|
85
|
-
]
|
86
|
-
|
87
|
-
def close(self):
|
88
|
-
self._series.clear()
|
89
|
-
super().close()
|
90
|
-
|
91
|
-
|
92
|
-
class TestSerieTree(TestCaseQt, _MockSerieBase):
|
93
|
-
"""Test the SerieTree widget"""
|
94
|
-
|
95
|
-
def setUp(self):
|
96
|
-
super().setUp()
|
97
|
-
super().init()
|
98
|
-
self._widget = SerieTree()
|
99
|
-
|
100
|
-
def tearDown(self):
|
101
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
102
|
-
self._widget.close()
|
103
|
-
self._widget = None
|
104
|
-
super().close()
|
105
|
-
super().tearDown()
|
106
|
-
|
107
|
-
def test_add_remove(self):
|
108
|
-
"""Test adding and removing serie"""
|
109
|
-
self._widget.show()
|
110
|
-
self.qWaitForWindowExposed(self._widget)
|
111
|
-
for serie in self._series:
|
112
|
-
self._widget.addSerie(serie)
|
113
|
-
assert self._widget.n_series == 6
|
114
|
-
self._widget.removeSerie(self._series[3])
|
115
|
-
assert self._widget.n_series == 5
|
116
|
-
self._widget.removeSerie(self._series[2])
|
117
|
-
self._widget.removeSerie(self._series[1])
|
118
|
-
self._widget.removeSerie(self._series[0])
|
119
|
-
# make sure no error is raised if we try to remove twine the same serie
|
120
|
-
self._widget.removeSerie(self._series[0])
|
121
|
-
assert self._widget.n_series == 2
|
122
|
-
self._widget.addSerie(self._series[1])
|
123
|
-
self._widget.addSerie(self._series[2])
|
124
|
-
assert self._widget.n_series == 4
|
125
|
-
|
126
|
-
def test_selection(self):
|
127
|
-
"""Test selection of the SerieTree"""
|
128
|
-
self._widget.show()
|
129
|
-
self.qWaitForWindowExposed(self._widget)
|
130
|
-
for serie in self._series:
|
131
|
-
self._widget.addSerie(serie)
|
132
|
-
|
133
|
-
selection = (self._series[2], self._series[3])
|
134
|
-
self._widget.setSelectedSeries(selection)
|
135
|
-
assert self._widget.getSelectedSeries() == selection
|
136
|
-
self._widget.clearSelection()
|
137
|
-
assert self._widget.getSelectedSeries() == ()
|
138
|
-
|
139
|
-
|
140
|
-
class TestSerieHistoryDialog(TestCaseQt, _MockSerieBase):
|
141
|
-
"""Test the SerieHistoryDialog"""
|
142
|
-
|
143
|
-
def setUp(self):
|
144
|
-
super().setUp()
|
145
|
-
super().init()
|
146
|
-
self._widget = SerieHistoryDialog()
|
147
|
-
|
148
|
-
# create listener for the nabu widget
|
149
|
-
self.signal_listener = SignalListener()
|
150
|
-
|
151
|
-
# connect signal / slot
|
152
|
-
self._widget.sigSerieSend.connect(self.signal_listener)
|
153
|
-
|
154
|
-
def tearDown(self):
|
155
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
156
|
-
self._widget.close()
|
157
|
-
self._widget = None
|
158
|
-
super().close()
|
159
|
-
super().tearDown()
|
160
|
-
|
161
|
-
def test(self):
|
162
|
-
self._widget.show()
|
163
|
-
self.qWaitForWindowExposed(self._widget)
|
164
|
-
for serie in self._series:
|
165
|
-
self._widget.addSerie(serie)
|
166
|
-
|
167
|
-
selection = (self._series[0], self._series[4])
|
168
|
-
self._widget.setSelectedSeries(selection)
|
169
|
-
assert self._widget.getSelectedSeries() == selection
|
170
|
-
assert self.signal_listener.callCount() == 0
|
171
|
-
self._widget._sendButton.clicked.emit()
|
172
|
-
self.qapp.processEvents()
|
173
|
-
assert self.signal_listener.callCount() == 2
|
174
|
-
assert self._widget.getSelectedSeries() == selection
|
175
|
-
self.signal_listener.clear()
|
176
|
-
self._widget._clearButton.clicked.emit()
|
177
|
-
assert self._widget.getSelectedSeries() == ()
|
178
|
-
assert self.signal_listener.callCount() == 0
|
179
|
-
self._widget._sendButton.clicked.emit()
|
180
|
-
assert self.signal_listener.callCount() == 0
|
181
|
-
|
182
|
-
|
183
|
-
class TestSerieDefinition(TestCaseQt):
|
184
|
-
def setUp(self):
|
185
|
-
super().setUp()
|
186
|
-
self._widget = SerieDefinition()
|
187
|
-
|
188
|
-
def tearDown(self):
|
189
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
190
|
-
self._widget.close()
|
191
|
-
self._widget = None
|
192
|
-
super().tearDown()
|
193
|
-
|
194
|
-
def test_manual_selection(self):
|
195
|
-
self._widget.setMode("manual")
|
196
|
-
self._widget.show()
|
197
|
-
self.qWaitForWindowExposed(self._widget)
|
198
|
-
assert not self._widget._automaticDefWidget.isVisible()
|
199
|
-
assert self._widget._manualDefWidget.isVisible()
|
200
|
-
|
201
|
-
def test_automatic_selection(self):
|
202
|
-
self._widget.setMode("auto")
|
203
|
-
self._widget.show()
|
204
|
-
self.qWaitForWindowExposed(self._widget)
|
205
|
-
assert self._widget._automaticDefWidget.isVisible()
|
206
|
-
assert not self._widget._manualDefWidget.isVisible()
|
207
|
-
|
208
|
-
|
209
|
-
class TestSerieManualDefinitionDialog(TestCaseQt, _MockScanBase):
|
210
|
-
"""Test interaction with the serie manual definition"""
|
211
|
-
|
212
|
-
def setUp(self):
|
213
|
-
self._widget = SerieManualControlDialog()
|
214
|
-
super().setUp()
|
215
|
-
super().init()
|
216
|
-
|
217
|
-
def tearDown(self):
|
218
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
219
|
-
self._widget.close()
|
220
|
-
self._widget = None
|
221
|
-
super().close()
|
222
|
-
super().tearDown()
|
223
|
-
|
224
|
-
def test(self):
|
225
|
-
self._widget.show()
|
226
|
-
self.qWaitForWindowExposed(self._widget)
|
227
|
-
|
228
|
-
self._widget.setSerieName("serie test")
|
229
|
-
self.qapp.processEvents()
|
230
|
-
assert self._widget.getSerieName() == "serie test"
|
231
|
-
|
232
|
-
self._widget._mainWidget._newSerieWidget._serieTree.rootItem.setText(
|
233
|
-
0, "new serie"
|
234
|
-
)
|
235
|
-
self.qapp.processEvents()
|
236
|
-
assert self._widget.getSerieName() == "new serie"
|
237
|
-
|
238
|
-
for scan in self._scans[:5]:
|
239
|
-
self._widget.addScan(scan)
|
240
|
-
|
241
|
-
self.assertEqual(self._widget.n_tomo_objs, len(self._scans[:5]))
|
242
|
-
self._widget.removeScan(self._scans[0])
|
243
|
-
self.assertEqual(self._widget.n_tomo_objs, len(self._scans[:5]) - 1)
|
244
|
-
|
245
|
-
series_scan = tuple(self._scans[1:5])
|
246
|
-
assert isinstance(series_scan, tuple)
|
247
|
-
|
248
|
-
current_serie = self._widget.getSerie(use_identifiers=True)
|
249
|
-
assert isinstance(current_serie, Serie)
|
250
|
-
serie_test_1 = Serie(
|
251
|
-
name="new serie", iterable=series_scan, use_identifiers=True
|
252
|
-
)
|
253
|
-
|
254
|
-
self.assertEqual(serie_test_1, current_serie)
|
255
|
-
serie_test_2 = Serie(name="test", iterable=series_scan, use_identifiers=True)
|
256
|
-
assert serie_test_2.name == "test"
|
257
|
-
assert current_serie.name == "new serie"
|
258
|
-
self.assertNotEqual(serie_test_2, current_serie)
|
259
|
-
|
260
|
-
self._widget.setSelectedScans([self._scans[2]])
|
261
|
-
self._widget.getSelectedScans() == (self._scans[2],)
|
262
|
-
self._widget.removeSelectedScans()
|
263
|
-
self.assertEqual(self._widget.n_tomo_objs, len(self._scans[:5]) - 2)
|
264
|
-
self._widget.getSelectedScans() == tuple()
|
265
|
-
|
266
|
-
self._widget.clearSerie()
|
267
|
-
self.assertEqual(self._widget.n_tomo_objs, 0)
|
268
|
-
self.assertEqual(Serie(name="new serie"), self._widget.getSerie())
|
269
|
-
|
270
|
-
# test adding an nx file
|
271
|
-
hdf5_scan = self._scans[0]
|
272
|
-
assert isinstance(hdf5_scan, NXtomoScan)
|
273
|
-
self._widget.addScanFromNxFile(hdf5_scan.master_file)
|
274
|
-
self.assertEqual(self._widget.n_tomo_objs, 1)
|
275
|
-
|
276
|
-
|
277
|
-
class TestSerieWidget(TestCaseQt, _MockSerieBase):
|
278
|
-
"""
|
279
|
-
Test the SerieWidget
|
280
|
-
"""
|
281
|
-
|
282
|
-
def setUp(self):
|
283
|
-
super().setUp()
|
284
|
-
super().init()
|
285
|
-
self._widget = SerieWidget()
|
286
|
-
# create listeners
|
287
|
-
self.signal_send_serie_listener = SignalListener()
|
288
|
-
self.signal_serie_changed_listener = SignalListener()
|
289
|
-
self.signal_history_changed_listener = SignalListener()
|
290
|
-
|
291
|
-
# connect signal / slot
|
292
|
-
self._widget.sigSerieSend.connect(self.signal_send_serie_listener)
|
293
|
-
self._widget.sigCurrentSerieChanged.connect(self.signal_serie_changed_listener)
|
294
|
-
self._widget.sigHistoryChanged.connect(self.signal_history_changed_listener)
|
295
|
-
|
296
|
-
def tearDown(self):
|
297
|
-
self._widget.sigSerieSend.disconnect(self.signal_send_serie_listener)
|
298
|
-
self._widget.sigCurrentSerieChanged.disconnect(
|
299
|
-
self.signal_serie_changed_listener
|
300
|
-
)
|
301
|
-
self._widget.sigHistoryChanged.disconnect(self.signal_history_changed_listener)
|
302
|
-
|
303
|
-
self.signal_send_serie_listener = None
|
304
|
-
self.signal_serie_changed_listener = None
|
305
|
-
self.signal_history_changed_listener = None
|
306
|
-
|
307
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
308
|
-
self._widget.close()
|
309
|
-
self._widget = None
|
310
|
-
super().close()
|
311
|
-
super().tearDown()
|
312
|
-
|
313
|
-
def test(self):
|
314
|
-
self._widget.show()
|
315
|
-
self.qWaitForWindowExposed(self._widget)
|
316
|
-
self._series[3].name = "toto serie"
|
317
|
-
for serie in self._series[2:5]:
|
318
|
-
self._widget.getHistoryWidget().addSerie(serie)
|
319
|
-
self._widget.setMode("history")
|
320
|
-
self._widget.setMode("serie definition", "manual")
|
321
|
-
self._widget.getDefinitionWidget().getManualDefinitionWidget().setSerieName(
|
322
|
-
"new serie"
|
323
|
-
)
|
324
|
-
|
325
|
-
self.assertEqual(
|
326
|
-
len(
|
327
|
-
self._widget.getDefinitionWidget()
|
328
|
-
.getManualDefinitionWidget()
|
329
|
-
.getSerie()
|
330
|
-
),
|
331
|
-
0,
|
332
|
-
)
|
333
|
-
|
334
|
-
self._widget.getHistoryWidget().setSelectedSeries(
|
335
|
-
[
|
336
|
-
self._series[3],
|
337
|
-
]
|
338
|
-
)
|
339
|
-
assert len(self._widget.getHistoryWidget().getSelectedSeries()) == 1
|
340
|
-
|
341
|
-
self.signal_serie_changed_listener.clear()
|
342
|
-
self._widget.getHistoryWidget().editSelected()
|
343
|
-
self.qapp.processEvents()
|
344
|
-
assert self.signal_serie_changed_listener.callCount() == 1
|
345
|
-
|
346
|
-
self.assertEqual(
|
347
|
-
self._widget.getDefinitionWidget()
|
348
|
-
.getManualDefinitionWidget()
|
349
|
-
.getSerie()
|
350
|
-
.name,
|
351
|
-
"toto serie",
|
352
|
-
)
|
353
|
-
|
354
|
-
self.assertEqual(
|
355
|
-
self._widget.getDefinitionWidget()
|
356
|
-
.getManualDefinitionWidget()
|
357
|
-
.getSerie(use_identifiers=True),
|
358
|
-
self._series[3],
|
359
|
-
)
|
360
|
-
|
361
|
-
self.signal_serie_changed_listener.clear()
|
362
|
-
self._widget.getDefinitionWidget().getManualDefinitionWidget().addToCurrentSerie(
|
363
|
-
self._scans[0]
|
364
|
-
)
|
365
|
-
self.qapp.processEvents()
|
366
|
-
assert self.signal_serie_changed_listener.callCount() == 1
|
367
|
-
|
368
|
-
expected_scans = self._scans[8:11]
|
369
|
-
expected_scans.append(self._scans[0])
|
370
|
-
expected_serie = Serie("toto serie", expected_scans, use_identifiers=True)
|
371
|
-
|
372
|
-
self.assertEqual(
|
373
|
-
self._widget.getDefinitionWidget()
|
374
|
-
.getManualDefinitionWidget()
|
375
|
-
.getSerie(use_identifiers=True),
|
376
|
-
expected_serie,
|
377
|
-
)
|
378
|
-
|
379
|
-
# check send edited serie
|
380
|
-
self.signal_history_changed_listener.clear()
|
381
|
-
self.signal_send_serie_listener.clear()
|
382
|
-
self.qapp.processEvents()
|
383
|
-
|
384
|
-
# check send selected from the history
|
385
|
-
self.signal_send_serie_listener.clear()
|
386
|
-
self._widget.getHistoryWidget().setSelectedSeries(
|
387
|
-
[
|
388
|
-
self._series[4],
|
389
|
-
]
|
390
|
-
)
|
391
|
-
assert len(self._widget.getHistoryWidget().getSelectedSeries()) == 1
|
392
|
-
self._widget.getHistoryWidget().sendSelected()
|
393
|
-
assert self.signal_send_serie_listener.callCount() == 1
|
394
|
-
|
395
|
-
|
396
|
-
class TestSerieManualFromTomoObj(TestCaseQt):
|
397
|
-
"""
|
398
|
-
test the SerieManualFromTomoObj widget
|
399
|
-
"""
|
400
|
-
|
401
|
-
def setUp(self):
|
402
|
-
super().setUp()
|
403
|
-
self._tmp_dir = tempfile.mkdtemp()
|
404
|
-
self._widget = SerieManualFromTomoObj()
|
405
|
-
self._volume_1 = HDF5Volume(
|
406
|
-
file_path=os.path.join(self._tmp_dir, "vol1.hdf5"),
|
407
|
-
data_path="data",
|
408
|
-
)
|
409
|
-
self._volume_2 = HDF5Volume(
|
410
|
-
file_path=os.path.join(self._tmp_dir, "vol2.hdf"),
|
411
|
-
data_path="data",
|
412
|
-
)
|
413
|
-
self._volume_3 = HDF5Volume(
|
414
|
-
file_path=os.path.join(self._tmp_dir, "vol3.nx"),
|
415
|
-
data_path="data",
|
416
|
-
)
|
417
|
-
self._scan_1 = MockNXtomo(
|
418
|
-
scan_path=os.path.join(self._tmp_dir, "scan_1"), n_proj=10, n_ini_proj=10
|
419
|
-
).scan
|
420
|
-
self._scan_2 = MockNXtomo(
|
421
|
-
scan_path=os.path.join(self._tmp_dir, "scan_2"), n_proj=10, n_ini_proj=10
|
422
|
-
).scan
|
423
|
-
|
424
|
-
def tearDown(self):
|
425
|
-
shutil.rmtree(self._tmp_dir)
|
426
|
-
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
|
427
|
-
self._widget.close()
|
428
|
-
self._widget = None
|
429
|
-
return super().tearDown()
|
430
|
-
|
431
|
-
def test(self):
|
432
|
-
self._widget.show()
|
433
|
-
for tomo_obj in (
|
434
|
-
self._volume_1,
|
435
|
-
self._volume_2,
|
436
|
-
self._volume_3,
|
437
|
-
self._scan_1,
|
438
|
-
self._scan_2,
|
439
|
-
):
|
440
|
-
self._widget.addTomoObj(tomo_obj)
|
441
|
-
|
442
|
-
current_serie = self._widget.getSerie()
|
443
|
-
assert isinstance(current_serie, Serie)
|
444
|
-
assert len(current_serie) == 0
|
445
|
-
|
446
|
-
for tomo_obj in (self._volume_1, self._volume_2):
|
447
|
-
self._widget.addToCurrentSerie(tomo_obj)
|
448
|
-
|
449
|
-
current_serie = self._widget.getSerie()
|
450
|
-
assert isinstance(current_serie, Serie)
|
451
|
-
assert len(current_serie) == 2
|
@@ -1,21 +0,0 @@
|
|
1
|
-
from tomwer.tests.conftest import qtapp # noqa F401
|
2
|
-
from tomwer.gui.control.serie.nxtomoconcatenate import NXtomoConcatenateWidget
|
3
|
-
|
4
|
-
|
5
|
-
def test_NXtomoConcatenateWidget(
|
6
|
-
qtapp, # noqa F811
|
7
|
-
):
|
8
|
-
"""simple test of the NXtomoConcatenateWidget"""
|
9
|
-
widget = NXtomoConcatenateWidget()
|
10
|
-
assert widget.getConfiguration() == {
|
11
|
-
"output_file": "{common_path}/concatenate.nx",
|
12
|
-
"output_entry": "entry0000",
|
13
|
-
"overwrite": False,
|
14
|
-
}
|
15
|
-
config = {
|
16
|
-
"output_file": "helical.hdf5",
|
17
|
-
"output_entry": "my_entry",
|
18
|
-
"overwrite": True,
|
19
|
-
}
|
20
|
-
widget.setConfiguration(config=config)
|
21
|
-
assert widget.getConfiguration() == config
|
@@ -1,23 +0,0 @@
|
|
1
|
-
from tomwer.tests.conftest import qtapp # noqa F401
|
2
|
-
from tomwer.gui.icat.createscreenshots import CreateRawDataScreenshotsWidget
|
3
|
-
|
4
|
-
|
5
|
-
def test_CreateRawDataScreenshotsWidget(qtapp): # noqa F811
|
6
|
-
widget = CreateRawDataScreenshotsWidget()
|
7
|
-
|
8
|
-
assert widget.getConfiguration() == {
|
9
|
-
"raw_projections_required": True,
|
10
|
-
"raw_projections_each": 90,
|
11
|
-
"raw_darks_required": True,
|
12
|
-
"raw_flats_required": True,
|
13
|
-
}
|
14
|
-
|
15
|
-
new_config = {
|
16
|
-
"raw_projections_required": True,
|
17
|
-
"raw_projections_each": 26,
|
18
|
-
"raw_darks_required": False,
|
19
|
-
"raw_flats_required": False,
|
20
|
-
}
|
21
|
-
widget.setConfiguration(new_config)
|
22
|
-
|
23
|
-
assert widget.getConfiguration() == new_config
|
@@ -1,37 +0,0 @@
|
|
1
|
-
from tomwer.tests.conftest import qtapp # noqa F401
|
2
|
-
from tomwer.gui.icat.gallery import GalleryWidget
|
3
|
-
|
4
|
-
|
5
|
-
def test_GalleryWidget(
|
6
|
-
qtapp, # noqa F811
|
7
|
-
):
|
8
|
-
widget = GalleryWidget()
|
9
|
-
assert widget.getConfiguration() == {
|
10
|
-
"beamline": "bm05",
|
11
|
-
"beamline_auto_update": True,
|
12
|
-
"dataset": "",
|
13
|
-
"dataset_auto_update": True,
|
14
|
-
"proposal": "",
|
15
|
-
"proposal_auto_update": True,
|
16
|
-
"output_format": "png",
|
17
|
-
"output_location_mode": "dataset gallery",
|
18
|
-
"custom_output": "",
|
19
|
-
"overwrite": True,
|
20
|
-
"binning": "16x16",
|
21
|
-
}
|
22
|
-
|
23
|
-
new_config = {
|
24
|
-
"beamline": "id19",
|
25
|
-
"beamline_auto_update": False,
|
26
|
-
"dataset": "my_dataset",
|
27
|
-
"dataset_auto_update": False,
|
28
|
-
"proposal": "inh99",
|
29
|
-
"proposal_auto_update": False,
|
30
|
-
"output_location_mode": "custom",
|
31
|
-
"output_format": "jpg",
|
32
|
-
"custom_output": "",
|
33
|
-
"overwrite": False,
|
34
|
-
"binning": "4x4",
|
35
|
-
}
|
36
|
-
widget.setConfiguration(new_config)
|
37
|
-
assert widget.getConfiguration() == new_config
|