tomwer 1.5.0rc0__py3-none-any.whl → 1.5.0rc3__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/app/axis.py +1 -1
- tomwer/core/process/control/datalistener/rpcserver.py +2 -8
- tomwer/core/process/drac/binning.py +2 -2
- tomwer/core/process/drac/output.py +1 -1
- tomwer/core/process/reconstruction/axis/mode.py +2 -2
- tomwer/core/process/reconstruction/axis/params.py +4 -4
- tomwer/core/process/reconstruction/axis/projectiontype.py +1 -1
- tomwer/core/process/reconstruction/axis/side.py +1 -1
- tomwer/core/process/reconstruction/darkref/params.py +1 -2
- tomwer/core/process/reconstruction/nabu/nabucommon.py +2 -2
- tomwer/core/process/reconstruction/nabu/target.py +1 -1
- tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +9 -0
- tomwer/core/process/reconstruction/nabu/utils.py +3 -0
- tomwer/core/process/reconstruction/normalization/normalization.py +1 -1
- tomwer/core/process/reconstruction/normalization/params.py +3 -3
- tomwer/core/process/reconstruction/saaxis/params.py +3 -3
- tomwer/core/process/reconstruction/saaxis/saaxis.py +1 -1
- tomwer/core/process/reconstruction/scores/params.py +2 -2
- tomwer/core/process/reconstruction/scores/scores.py +3 -3
- tomwer/core/process/tests/test_normalization.py +2 -1
- tomwer/core/scan/scanbase.py +1 -1
- tomwer/core/scan/scantype.py +1 -1
- tomwer/core/settings.py +1 -1
- tomwer/gui/cluster/slurm.py +3 -3
- tomwer/gui/configuration/level.py +1 -1
- tomwer/gui/control/actions.py +1 -1
- tomwer/gui/control/datalist.py +1 -1
- tomwer/gui/control/series/seriescreator.py +5 -5
- tomwer/gui/control/tomoobjdisplaymode.py +1 -1
- tomwer/gui/dataportal/gallery.py +6 -6
- tomwer/gui/edit/tests/test_nx_editor.py +1 -1
- tomwer/gui/reconstruction/axis/EstimatedCorComboBox.py +2 -2
- tomwer/gui/reconstruction/axis/InputWidget.py +3 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/base.py +1 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +6 -6
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +3 -3
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +7 -3
- tomwer/gui/reconstruction/nabu/slices.py +5 -5
- tomwer/gui/reconstruction/nabu/volume.py +1 -1
- tomwer/gui/reconstruction/normalization/intensity.py +6 -10
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +2 -2
- tomwer/gui/reconstruction/sacommon.py +1 -1
- tomwer/gui/reconstruction/scores/scoreplot.py +3 -3
- tomwer/gui/stitching/config/positionoveraxis.py +1 -1
- tomwer/gui/utils/flow.py +1 -1
- tomwer/gui/utils/loadingmode.py +1 -1
- tomwer/gui/utils/vignettes.py +1 -1
- tomwer/gui/visualization/dataviewer.py +7 -7
- tomwer/gui/visualization/reconstructionparameters.py +35 -23
- tomwer/gui/visualization/scanoverview.py +28 -11
- tomwer/gui/visualization/test/test_reconstruction_parameters.py +2 -2
- tomwer/synctools/utils/scanstages.py +3 -3
- tomwer/version.py +1 -1
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.0rc3.dist-info}/METADATA +1 -1
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.0rc3.dist-info}/RECORD +59 -59
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.0rc3.dist-info}/WHEEL +0 -0
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.0rc3.dist-info}/entry_points.txt +0 -0
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.0rc3.dist-info}/licenses/LICENSE +0 -0
- {tomwer-1.5.0rc0.dist-info → tomwer-1.5.0rc3.dist-info}/top_level.txt +0 -0
tomwer/app/axis.py
CHANGED
@@ -104,7 +104,7 @@ def main(argv):
|
|
104
104
|
parser.add_argument(
|
105
105
|
"--mode",
|
106
106
|
default=None,
|
107
|
-
help=f"Use a specific mode. Available modes are {AxisMode
|
107
|
+
help=f"Use a specific mode. Available modes are {[item.value for item in AxisMode]}",
|
108
108
|
)
|
109
109
|
parser.add_argument(
|
110
110
|
"--full-image",
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
from __future__ import annotations
|
3
3
|
|
4
|
+
from enum import Enum as _Enum
|
4
5
|
import getpass
|
5
6
|
import logging
|
6
7
|
import socket
|
@@ -10,7 +11,6 @@ from multiprocessing import Process
|
|
10
11
|
|
11
12
|
from jsonrpc import JSONRPCResponseManager, dispatcher
|
12
13
|
from psutil import process_iter
|
13
|
-
from silx.utils.enum import Enum as _Enum
|
14
14
|
from werkzeug.serving import run_simple
|
15
15
|
from werkzeug.wrappers import Request, Response
|
16
16
|
|
@@ -26,12 +26,6 @@ class TangoAcquisitionStatus(_Enum):
|
|
26
26
|
ENDED = "ended"
|
27
27
|
|
28
28
|
|
29
|
-
class _TangoState:
|
30
|
-
MOVING = "moving"
|
31
|
-
ON = "on"
|
32
|
-
FAULT = "fault"
|
33
|
-
|
34
|
-
|
35
29
|
class BlissAcquisition:
|
36
30
|
"""Define an acquisition made with bliss / tango"""
|
37
31
|
|
@@ -59,7 +53,7 @@ class BlissAcquisition:
|
|
59
53
|
self.scan_numbers.append(scan_number)
|
60
54
|
|
61
55
|
def set_status(self, status):
|
62
|
-
self.status = TangoAcquisitionStatus
|
56
|
+
self.status = TangoAcquisitionStatus(status)
|
63
57
|
|
64
58
|
def end(self, end_time, succeed: bool, error: str | None):
|
65
59
|
if succeed is True:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import numpy
|
2
|
-
from
|
2
|
+
from enum import Enum as _Enum
|
3
3
|
|
4
4
|
|
5
5
|
class Binning(_Enum):
|
@@ -18,7 +18,7 @@ class Binning(_Enum):
|
|
18
18
|
raise TypeError("data should be a numpy array")
|
19
19
|
if not data.ndim == 2:
|
20
20
|
raise ValueError("data is expected to be 2d")
|
21
|
-
binning = Binning
|
21
|
+
binning = Binning(binning)
|
22
22
|
if binning is Binning.ONE_BY_ONE:
|
23
23
|
return data
|
24
24
|
elif binning is Binning.TWO_BY_TWO:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
from
|
3
|
+
from enum import Enum as _Enum
|
4
4
|
from tomwer.core.process.reconstruction.axis.side import Side
|
5
5
|
|
6
6
|
_logger = logging.getLogger(__name__)
|
@@ -120,7 +120,7 @@ class AxisMode(_Enum):
|
|
120
120
|
elif value in ("read", "read from estimated cor"):
|
121
121
|
value = AxisMode.read
|
122
122
|
|
123
|
-
return
|
123
|
+
return AxisMode(value)
|
124
124
|
|
125
125
|
def requires_radio_indices(self) -> bool:
|
126
126
|
return self in (
|
@@ -5,7 +5,7 @@ from collections import namedtuple
|
|
5
5
|
|
6
6
|
import numpy
|
7
7
|
from silx.io.url import DataUrl
|
8
|
-
from
|
8
|
+
from enum import Enum as _Enum
|
9
9
|
from tomoscan.esrf.scan.utils import get_data
|
10
10
|
|
11
11
|
from tomwer.core.process.reconstruction.utils.cor import relative_pos_to_absolute
|
@@ -60,8 +60,8 @@ class AxisCalculationInput(_Enum):
|
|
60
60
|
if type(value) is str and len(value.split("_")) == 2:
|
61
61
|
proj_type, pag = value.split("_")
|
62
62
|
value_pag = True if pag == _WITH_PAG else False
|
63
|
-
value_proj = ProjectionType
|
64
|
-
return cls
|
63
|
+
value_proj = ProjectionType(proj_type)
|
64
|
+
return cls(_calculation_conf(value_proj, value_pag))
|
65
65
|
elif isinstance(value, cls):
|
66
66
|
return value
|
67
67
|
else:
|
@@ -348,7 +348,7 @@ class AxisRP:
|
|
348
348
|
@estimated_cor.setter
|
349
349
|
def estimated_cor(self, value: Side | float | None):
|
350
350
|
try:
|
351
|
-
value = Side
|
351
|
+
value = Side(value)
|
352
352
|
except ValueError:
|
353
353
|
pass
|
354
354
|
if self.__estimated_cor != value:
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
3
3
|
|
4
4
|
import enum
|
5
5
|
|
6
|
-
from silx.utils.enum import Enum as _Enum
|
7
6
|
from tomoscan.framereducer.method import ReduceMethod
|
8
7
|
|
9
8
|
from tomwer.core.process.reconstruction.darkref.settings import (
|
@@ -17,7 +16,7 @@ from tomwer.core.utils.deprecation import deprecated
|
|
17
16
|
# TODO: those classes (when, method) should be linked / embedded in the DarkRef
|
18
17
|
# method
|
19
18
|
@enum.unique
|
20
|
-
class When(
|
19
|
+
class When(enum.Enum):
|
21
20
|
never = (0,)
|
22
21
|
before = (1,)
|
23
22
|
after = (2,)
|
@@ -205,7 +205,7 @@ class _NabuBaseReconstructor:
|
|
205
205
|
axis: NabuPlane = NabuPlane.XY,
|
206
206
|
) -> None:
|
207
207
|
self._scan = scan
|
208
|
-
self._target = Target
|
208
|
+
self._target = Target(target)
|
209
209
|
self._dry_run = dry_run
|
210
210
|
self._process_name = process_name
|
211
211
|
self._process = None
|
@@ -564,7 +564,7 @@ class _NabuBaseReconstructor:
|
|
564
564
|
)
|
565
565
|
|
566
566
|
source = extra_infos.get("source", INormSource.NONE)
|
567
|
-
source = INormSource
|
567
|
+
source = INormSource(source)
|
568
568
|
|
569
569
|
if source is INormSource.NONE:
|
570
570
|
pass
|
@@ -275,3 +275,12 @@ def test_nabu_std_err_has_error():
|
|
275
275
|
)
|
276
276
|
is False
|
277
277
|
)
|
278
|
+
|
279
|
+
assert (
|
280
|
+
nabu_std_err_has_error(
|
281
|
+
b"""Performing MLEM-WL2 iterations: 0%| | 0/200[00:00<?, ?its/s]
|
282
|
+
Performing MLEM-WL2 iterations: 82%| | 163/200[00:00<?, 828.12its/s]
|
283
|
+
"""
|
284
|
+
)
|
285
|
+
is False
|
286
|
+
)
|
@@ -409,6 +409,9 @@ def nabu_std_err_has_error(errs: bytes | None):
|
|
409
409
|
or " unable to import 'siphash24.siphash13" in line
|
410
410
|
or "_create_built_program_from_source_cached" in line
|
411
411
|
or "prg.build(options_bytes," in line
|
412
|
+
or (
|
413
|
+
"Performing MLEM" in line and "iterations" in line
|
414
|
+
) # corrct usage of tqdm (goes to stderr)
|
412
415
|
)
|
413
416
|
|
414
417
|
if errs is None:
|
@@ -140,7 +140,7 @@ class SinoNormalizationTask(
|
|
140
140
|
if calc_fct is None:
|
141
141
|
raise ValueError("calc_fct should be provided")
|
142
142
|
else:
|
143
|
-
calc_fct = _ValueCalculationFct
|
143
|
+
calc_fct = _ValueCalculationFct(calc_fct)
|
144
144
|
|
145
145
|
try:
|
146
146
|
value = self._cache_compute_from_manual_roi(
|
@@ -4,7 +4,7 @@ material for radio and sinogram normalization
|
|
4
4
|
"""
|
5
5
|
from __future__ import annotations
|
6
6
|
|
7
|
-
from
|
7
|
+
from enum import Enum as _Enum
|
8
8
|
from tomoscan.normalization import Method
|
9
9
|
|
10
10
|
|
@@ -39,7 +39,7 @@ class _DatasetInfos:
|
|
39
39
|
|
40
40
|
@scope.setter
|
41
41
|
def scope(self, scope: str | _DatasetScope):
|
42
|
-
self._scope = _DatasetScope
|
42
|
+
self._scope = _DatasetScope(scope)
|
43
43
|
|
44
44
|
@property
|
45
45
|
def file_path(self):
|
@@ -96,7 +96,7 @@ class SinoNormalizationParams:
|
|
96
96
|
def source(self, source):
|
97
97
|
if source is None:
|
98
98
|
source = _ValueSource.NONE
|
99
|
-
self._source = _ValueSource
|
99
|
+
self._source = _ValueSource(source)
|
100
100
|
|
101
101
|
@property
|
102
102
|
def extra_infos(self):
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
4
4
|
from typing import Iterable
|
5
5
|
|
6
6
|
import numpy
|
7
|
-
from
|
7
|
+
from enum import Enum as _Enum
|
8
8
|
|
9
9
|
from tomwer.core.process.reconstruction.scores.params import SABaseParams
|
10
10
|
|
@@ -56,7 +56,7 @@ class SAAxisParams(SABaseParams):
|
|
56
56
|
|
57
57
|
@mode.setter
|
58
58
|
def mode(self, mode):
|
59
|
-
mode = ReconstructionMode
|
59
|
+
mode = ReconstructionMode(mode)
|
60
60
|
self._mode = mode
|
61
61
|
|
62
62
|
@property
|
@@ -91,7 +91,7 @@ class SAAxisParams(SABaseParams):
|
|
91
91
|
if "n_reconstruction" in dict_:
|
92
92
|
self.n_reconstruction = dict_["n_reconstruction"]
|
93
93
|
if "mode" in dict_:
|
94
|
-
self.mode = ReconstructionMode
|
94
|
+
self.mode = ReconstructionMode(dict_["mode"])
|
95
95
|
|
96
96
|
@staticmethod
|
97
97
|
def from_dict(dict_):
|
@@ -430,7 +430,7 @@ class SAAxisTask(
|
|
430
430
|
params.image_width = scan.dim_1
|
431
431
|
scan.saaxis_params = params
|
432
432
|
|
433
|
-
mode = ReconstructionMode
|
433
|
+
mode = ReconstructionMode(params.mode)
|
434
434
|
if mode is not ReconstructionMode.VERTICAL:
|
435
435
|
raise ValueError(f"{mode} is not handled for now")
|
436
436
|
|
@@ -102,7 +102,7 @@ class SABaseParams:
|
|
102
102
|
|
103
103
|
@score_method.setter
|
104
104
|
def score_method(self, method):
|
105
|
-
self._score_method = ScoreMethod
|
105
|
+
self._score_method = ScoreMethod(method)
|
106
106
|
|
107
107
|
@property
|
108
108
|
def scores(self) -> dict | None:
|
@@ -170,7 +170,7 @@ class SABaseParams:
|
|
170
170
|
output_dir = None
|
171
171
|
self.output_dir = output_dir
|
172
172
|
if "score_method" in dict_:
|
173
|
-
self.score_method = ScoreMethod
|
173
|
+
self.score_method = ScoreMethod(dict_["score_method"])
|
174
174
|
if "cluster_config" in dict_:
|
175
175
|
if dict_["cluster_config"] in (None, ""):
|
176
176
|
self.cluster_config = None
|
@@ -4,7 +4,7 @@ import logging
|
|
4
4
|
import sys
|
5
5
|
|
6
6
|
import numpy
|
7
|
-
from
|
7
|
+
from enum import Enum as _Enum
|
8
8
|
|
9
9
|
_logger = logging.getLogger(__name__)
|
10
10
|
|
@@ -36,7 +36,7 @@ class ComputedScore:
|
|
36
36
|
return self._tomo_consistency
|
37
37
|
|
38
38
|
def get(self, method: ScoreMethod):
|
39
|
-
method = ScoreMethod
|
39
|
+
method = ScoreMethod(method)
|
40
40
|
if method is ScoreMethod.TV:
|
41
41
|
return self.total_variation / float(10e5)
|
42
42
|
elif method is ScoreMethod.TV_INVERSE:
|
@@ -135,7 +135,7 @@ def compute_score(
|
|
135
135
|
:param method:
|
136
136
|
:return: score of the frame
|
137
137
|
"""
|
138
|
-
method = ScoreMethod
|
138
|
+
method = ScoreMethod(method)
|
139
139
|
if data.ndim == 3:
|
140
140
|
if data.shape[0] == 1:
|
141
141
|
data = data.reshape(data.shape[1], data.shape[2])
|
@@ -54,7 +54,8 @@ class TestNormalization(unittest.TestCase):
|
|
54
54
|
"median": numpy.array([800.5, 10800.5]),
|
55
55
|
}
|
56
56
|
|
57
|
-
for
|
57
|
+
for item in params._ValueCalculationFct:
|
58
|
+
calc_fct = item.value
|
58
59
|
with self.subTest(calc_fct=calc_fct):
|
59
60
|
process_params.extra_infos = {
|
60
61
|
"start_x": 0,
|
tomwer/core/scan/scanbase.py
CHANGED
@@ -10,7 +10,7 @@ from typing import Iterable
|
|
10
10
|
|
11
11
|
import numpy
|
12
12
|
from silx.io.url import DataUrl
|
13
|
-
from
|
13
|
+
from enum import Enum as _Enum
|
14
14
|
|
15
15
|
from tomoscan.identifier import VolumeIdentifier
|
16
16
|
from tomoscan.normalization import IntensityNormalization
|
tomwer/core/scan/scantype.py
CHANGED
tomwer/core/settings.py
CHANGED
tomwer/gui/cluster/slurm.py
CHANGED
@@ -94,7 +94,7 @@ class SlurmSettingsWindow(qt.QMainWindow):
|
|
94
94
|
|
95
95
|
self._modeCombox = qt.QComboBox(self)
|
96
96
|
self._mainWidget.layout().addRow("configuration: ", self._modeCombox)
|
97
|
-
self._modeCombox.addItems(SlurmSettingsMode
|
97
|
+
self._modeCombox.addItems([item.value for item in SlurmSettingsMode])
|
98
98
|
self._modeCombox.setCurrentText(SlurmSettingsMode.GENERIC.value)
|
99
99
|
|
100
100
|
self._settingsWidget = SlurmSettingsWidget(self, jobLimitation=None)
|
@@ -155,10 +155,10 @@ class SlurmSettingsWindow(qt.QMainWindow):
|
|
155
155
|
self._modeCombox.setCurrentText(SlurmSettingsMode.MANUAL.value)
|
156
156
|
|
157
157
|
def getCurrentSettingsMode(self) -> SlurmSettingsMode:
|
158
|
-
return SlurmSettingsMode
|
158
|
+
return SlurmSettingsMode(self._modeCombox.currentText())
|
159
159
|
|
160
160
|
def setCurrentSettingsMode(self, mode: SlurmSettingsMode) -> SlurmSettingsMode:
|
161
|
-
mode = SlurmSettingsMode
|
161
|
+
mode = SlurmSettingsMode(mode)
|
162
162
|
self._modeCombox.setCurrentText(mode.value)
|
163
163
|
|
164
164
|
def setMode(self, mode: SlurmSettingsMode) -> None:
|
tomwer/gui/control/actions.py
CHANGED
@@ -86,7 +86,7 @@ class TomoObjDisplayModeToolButton(qt.QToolButton):
|
|
86
86
|
urlDescAction.triggered.connect(partial(self.setDisplayMode, DisplayMode.URL))
|
87
87
|
|
88
88
|
def setDisplayMode(self, mode: DisplayMode):
|
89
|
-
mode = DisplayMode
|
89
|
+
mode = DisplayMode(mode)
|
90
90
|
if mode is DisplayMode.SHORT:
|
91
91
|
self.setIcon(self._shortDescIcon)
|
92
92
|
self.setToolTip(self._SHORT_DESC_TOOLTIP)
|
tomwer/gui/control/datalist.py
CHANGED
@@ -616,7 +616,7 @@ class _TomwerObjectList(qt.QTableWidget):
|
|
616
616
|
self.setDisplayMode(DisplayMode.SHORT)
|
617
617
|
|
618
618
|
def setDisplayMode(self, mode: DisplayMode) -> None:
|
619
|
-
self._displayMode = DisplayMode
|
619
|
+
self._displayMode = DisplayMode(mode)
|
620
620
|
self._update()
|
621
621
|
|
622
622
|
def n_data(self):
|
@@ -6,7 +6,7 @@ from typing import Iterable
|
|
6
6
|
|
7
7
|
from silx.gui import qt
|
8
8
|
from silx.gui.utils import blockSignals
|
9
|
-
from
|
9
|
+
from enum import Enum as _Enum
|
10
10
|
from tomoscan.series import Series
|
11
11
|
|
12
12
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
@@ -144,8 +144,8 @@ class SeriesDefinition(qt.QWidget):
|
|
144
144
|
self.layout().addWidget(self._modeLabel, 0, 0, 1, 1)
|
145
145
|
|
146
146
|
self._modeCB = qt.QComboBox(self)
|
147
|
-
for mode in _SeriesDefinitionMode
|
148
|
-
self._modeCB.addItem(mode)
|
147
|
+
for mode in _SeriesDefinitionMode:
|
148
|
+
self._modeCB.addItem(mode.value)
|
149
149
|
self.layout().addWidget(self._modeCB, 0, 1, 1, 1)
|
150
150
|
|
151
151
|
self._manualDefWidget = SeriesManualFromTomoObj(parent=self)
|
@@ -169,10 +169,10 @@ class SeriesDefinition(qt.QWidget):
|
|
169
169
|
raise ValueError(f"mode {self.getMode()} is not handled yet")
|
170
170
|
|
171
171
|
def getMode(self) -> str:
|
172
|
-
return _SeriesDefinitionMode
|
172
|
+
return _SeriesDefinitionMode(self._modeCB.currentText())
|
173
173
|
|
174
174
|
def setMode(self, mode: str):
|
175
|
-
mode = _SeriesDefinitionMode
|
175
|
+
mode = _SeriesDefinitionMode(mode)
|
176
176
|
idx = self._modeCB.findText(mode.value)
|
177
177
|
self._modeCB.setCurrentIndex(idx)
|
178
178
|
|
tomwer/gui/dataportal/gallery.py
CHANGED
@@ -29,7 +29,7 @@ class GalleryWidget(qt.QWidget):
|
|
29
29
|
self.layout().addRow("precision", self._precisionQCB)
|
30
30
|
# binning
|
31
31
|
self._binningQCB = qt.QComboBox(self)
|
32
|
-
self._binningQCB.addItems(Binning
|
32
|
+
self._binningQCB.addItems([item.value for item in Binning])
|
33
33
|
self.layout().addRow("binning", self._binningQCB)
|
34
34
|
self._binningQCB.setCurrentText(Binning.SIXTEEN_BY_SIXTEEN.value)
|
35
35
|
self._binningQCB.setToolTip(
|
@@ -37,7 +37,7 @@ class GalleryWidget(qt.QWidget):
|
|
37
37
|
) # recommended size: 5ko for the entire gallery
|
38
38
|
# output format
|
39
39
|
self._outputFormat = qt.QComboBox(self)
|
40
|
-
self._outputFormat.addItems(OutputFormat
|
40
|
+
self._outputFormat.addItems([item.value for item in OutputFormat])
|
41
41
|
self.layout().addRow("output format", self._outputFormat)
|
42
42
|
# overwrite
|
43
43
|
self._overwriteCB = qt.QCheckBox("overwrite", self)
|
@@ -49,17 +49,17 @@ class GalleryWidget(qt.QWidget):
|
|
49
49
|
self._binningQCB.currentIndexChanged.connect(self._configChanged)
|
50
50
|
|
51
51
|
def getOutputFormat(self) -> OutputFormat:
|
52
|
-
return OutputFormat
|
52
|
+
return OutputFormat(self._outputFormat.currentText())
|
53
53
|
|
54
54
|
def setOutputFormat(self, format: OutputFormat):
|
55
|
-
format = OutputFormat
|
55
|
+
format = OutputFormat(format)
|
56
56
|
self._outputFormat.setCurrentText(format.value)
|
57
57
|
|
58
58
|
def getBinning(self) -> Binning:
|
59
|
-
return Binning
|
59
|
+
return Binning(self._binningQCB.currentText())
|
60
60
|
|
61
61
|
def setBinning(self, binning: Binning):
|
62
|
-
binning = Binning
|
62
|
+
binning = Binning(binning)
|
63
63
|
self._binningQCB.setCurrentText(binning.value)
|
64
64
|
|
65
65
|
def overwrite(self) -> bool:
|
@@ -29,7 +29,7 @@ _ureg = pint.get_application_registry()
|
|
29
29
|
@pytest.mark.parametrize("detector_y_pixel_size", (None,))
|
30
30
|
@pytest.mark.parametrize("sample_x_pixel_size", (None,))
|
31
31
|
@pytest.mark.parametrize("sample_y_pixel_size", (None, 0.0066 * _ureg.meter))
|
32
|
-
@pytest.mark.parametrize("field_of_view", FOV
|
32
|
+
@pytest.mark.parametrize("field_of_view", [item.value for item in FOV])
|
33
33
|
@pytest.mark.parametrize("sample_detector_distance", (1.2 * _ureg.meter,))
|
34
34
|
@pytest.mark.parametrize("sample_source_distance", (-10.2 * _ureg.meter,))
|
35
35
|
@pytest.mark.parametrize("propagation_distance", (1.01 * _ureg.meter,))
|
@@ -13,8 +13,8 @@ class _EstimatedCorValidator(qt.QDoubleValidator):
|
|
13
13
|
|
14
14
|
def validate(self, a0: str, a1: int):
|
15
15
|
"""validate float or string that could be part of the side values..."""
|
16
|
-
for
|
17
|
-
if value.startswith(a0):
|
16
|
+
for side in Side:
|
17
|
+
if side.value.startswith(a0):
|
18
18
|
return (qt.QDoubleValidator.Acceptable, a0, a1)
|
19
19
|
return super().validate(a0, a1)
|
20
20
|
|
@@ -153,8 +153,8 @@ class InputWidget(qt.QWidget):
|
|
153
153
|
modes = set(modes)
|
154
154
|
for mode in modes:
|
155
155
|
try:
|
156
|
-
axis_mode._InputType
|
157
|
-
except
|
156
|
+
axis_mode._InputType(mode)
|
157
|
+
except ValueError:
|
158
158
|
raise ValueError(
|
159
159
|
f"mode {mode} should be an instance of {axis_mode._InputType}"
|
160
160
|
)
|
@@ -166,7 +166,7 @@ class InputWidget(qt.QWidget):
|
|
166
166
|
elif len(modes) < 0:
|
167
167
|
raise ValueError("modes is empty")
|
168
168
|
else:
|
169
|
-
mode = axis_mode._InputType
|
169
|
+
mode = axis_mode._InputType(modes.pop())
|
170
170
|
if mode is axis_mode._InputType.SINOGRAM:
|
171
171
|
self._sinogramGB.setEnabled(True)
|
172
172
|
self._radioGB.setEnabled(False)
|
@@ -49,9 +49,7 @@ class _NabuStageConfigBase:
|
|
49
49
|
:returns: _FilteringObject to use to define widget visibility
|
50
50
|
"""
|
51
51
|
filteringObj = _FilteringObject(widget=widget)
|
52
|
-
self._registeredWidgets[filteringObj] = ConfigurationLevel
|
53
|
-
config_level
|
54
|
-
)
|
52
|
+
self._registeredWidgets[filteringObj] = ConfigurationLevel(config_level)
|
55
53
|
return filteringObj
|
56
54
|
|
57
55
|
def getConfiguration(self) -> dict:
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from silx.gui import qt
|
4
4
|
from silx.gui.utils import blockSignals
|
5
|
-
from
|
5
|
+
from enum import Enum as _Enum
|
6
6
|
|
7
7
|
from tomwer.core.process.reconstruction.nabu.utils import _NabuStages
|
8
8
|
from tomwer.gui.reconstruction.nabu.nabuconfig import base
|
@@ -159,8 +159,8 @@ class CTFGeometry(qt.QGroupBox):
|
|
159
159
|
super().__init__(parent, title=title)
|
160
160
|
self.setLayout(qt.QFormLayout())
|
161
161
|
self._beamShapeCB = QComboBoxIgnoreWheel(self)
|
162
|
-
for shape in _BeamShape
|
163
|
-
self._beamShapeCB.addItem(shape)
|
162
|
+
for shape in _BeamShape:
|
163
|
+
self._beamShapeCB.addItem(shape.value)
|
164
164
|
self.layout().addRow("shape", self._beamShapeCB)
|
165
165
|
|
166
166
|
# cone beam settings
|
@@ -188,10 +188,10 @@ class CTFGeometry(qt.QGroupBox):
|
|
188
188
|
self._beamShapeCB.currentIndexChanged.connect(self._confChanged)
|
189
189
|
|
190
190
|
def getBeamShape(self):
|
191
|
-
return _BeamShape
|
191
|
+
return _BeamShape(self._beamShapeCB.currentText())
|
192
192
|
|
193
193
|
def setBeamShape(self, shape: str | _BeamShape):
|
194
|
-
shape = _BeamShape
|
194
|
+
shape = _BeamShape(shape)
|
195
195
|
self._beamShapeCB.setCurrentText(shape.value)
|
196
196
|
|
197
197
|
def _updateView(self, *args, **kwargs):
|
@@ -228,7 +228,7 @@ class CTFGeometry(qt.QGroupBox):
|
|
228
228
|
|
229
229
|
beam_shape = ddict.get("beam_shape", None)
|
230
230
|
if beam_shape is not None:
|
231
|
-
if _BeamShape
|
231
|
+
if _BeamShape(beam_shape) is _BeamShape.CONE:
|
232
232
|
self._coneBeamSettings.setGeometry(params)
|
233
233
|
self.setBeamShape(beam_shape)
|
234
234
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
5
5
|
import logging
|
6
6
|
|
7
7
|
from silx.gui import qt
|
8
|
-
from
|
8
|
+
from enum import Enum as _Enum
|
9
9
|
|
10
10
|
from tomwer.core.process.reconstruction.nabu.utils import _NabuPhaseMethod, _NabuStages
|
11
11
|
from tomwer.core.utils.char import BETA_CHAR, DELTA_CHAR
|
@@ -212,10 +212,10 @@ class NabuPaganinConfig(qt.QWidget, base._NabuStageConfigBase):
|
|
212
212
|
|
213
213
|
def getPaddingType(self) -> PaddingMode:
|
214
214
|
current_text = self._paddingTypeCB.currentText()
|
215
|
-
return PaddingMode
|
215
|
+
return PaddingMode(current_text)
|
216
216
|
|
217
217
|
def setPaddingType(self, padding_type):
|
218
|
-
padding_type = PaddingMode
|
218
|
+
padding_type = PaddingMode(padding_type)
|
219
219
|
item_index = self._paddingTypeCB.findText(padding_type.value)
|
220
220
|
self._paddingTypeCB.setCurrentIndex(item_index)
|
221
221
|
|
@@ -7,7 +7,7 @@ import logging
|
|
7
7
|
|
8
8
|
from silx.gui import qt
|
9
9
|
from silx.gui.dialog.DataFileDialog import DataFileDialog
|
10
|
-
from
|
10
|
+
from enum import Enum as _Enum
|
11
11
|
|
12
12
|
from nxtomomill.io.utils import convert_str_to_tuple
|
13
13
|
from tomwer.core.utils.char import DEGREE_CHAR
|
@@ -159,9 +159,13 @@ class TranslationMvtFileWidget(qt.QWidget):
|
|
159
159
|
self._grpBox.layout().setContentsMargins(0, 0, 0, 0)
|
160
160
|
self._grpBox.layout().setSpacing(0)
|
161
161
|
|
162
|
-
self._hdf5FileRB = qt.QRadioButton(
|
162
|
+
self._hdf5FileRB = qt.QRadioButton(
|
163
|
+
TranslationMvtFileWidget.Mode.HDF5.value, self
|
164
|
+
)
|
163
165
|
self._grpBox.layout().addWidget(self._hdf5FileRB)
|
164
|
-
self._textFileRB = qt.QRadioButton(
|
166
|
+
self._textFileRB = qt.QRadioButton(
|
167
|
+
TranslationMvtFileWidget.Mode.TEXT.value, self
|
168
|
+
)
|
165
169
|
self._grpBox.layout().addWidget(self._textFileRB)
|
166
170
|
self.layout().addWidget(self._grpBox)
|
167
171
|
|