tomwer 1.4.19__py3-none-any.whl → 1.5.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.
Files changed (126) hide show
  1. orangecontrib/tomwer/tutorials/simple_volume_local_reconstruction.ows +11 -8
  2. orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +12 -9
  3. orangecontrib/tomwer/widgets/control/DataDiscoveryOW.py +1 -1
  4. orangecontrib/tomwer/widgets/control/NXTomomillMixIn.py +21 -10
  5. tomwer/app/axis.py +1 -1
  6. tomwer/app/reducedarkflat.py +2 -2
  7. tomwer/core/process/control/datalistener/rpcserver.py +2 -8
  8. tomwer/core/process/drac/binning.py +2 -2
  9. tomwer/core/process/drac/output.py +1 -1
  10. tomwer/core/process/edit/imagekeyeditor.py +4 -6
  11. tomwer/core/process/edit/nxtomoeditor.py +58 -20
  12. tomwer/core/process/output.py +6 -5
  13. tomwer/core/process/reconstruction/axis/anglemode.py +2 -2
  14. tomwer/core/process/reconstruction/axis/axis.py +1 -0
  15. tomwer/core/process/reconstruction/axis/mode.py +2 -2
  16. tomwer/core/process/reconstruction/axis/params.py +4 -4
  17. tomwer/core/process/reconstruction/axis/projectiontype.py +1 -1
  18. tomwer/core/process/reconstruction/axis/side.py +1 -1
  19. tomwer/core/process/reconstruction/darkref/darkrefs.py +2 -2
  20. tomwer/core/process/reconstruction/darkref/darkrefscopy.py +1 -1
  21. tomwer/core/process/reconstruction/darkref/params.py +2 -3
  22. tomwer/core/process/reconstruction/nabu/castvolume.py +4 -1
  23. tomwer/core/process/reconstruction/nabu/helical.py +3 -1
  24. tomwer/core/process/reconstruction/nabu/nabucommon.py +2 -2
  25. tomwer/core/process/reconstruction/nabu/nabuscores.py +1 -1
  26. tomwer/core/process/reconstruction/nabu/nabuslices.py +4 -4
  27. tomwer/core/process/reconstruction/nabu/plane.py +2 -2
  28. tomwer/core/process/reconstruction/nabu/target.py +1 -1
  29. tomwer/core/process/reconstruction/nabu/test/test_castvolume.py +2 -0
  30. tomwer/core/process/reconstruction/nabu/test/test_nabu_utils.py +9 -0
  31. tomwer/core/process/reconstruction/nabu/utils.py +18 -14
  32. tomwer/core/process/reconstruction/normalization/normalization.py +1 -1
  33. tomwer/core/process/reconstruction/normalization/params.py +4 -4
  34. tomwer/core/process/reconstruction/output.py +2 -2
  35. tomwer/core/process/reconstruction/saaxis/params.py +3 -3
  36. tomwer/core/process/reconstruction/saaxis/saaxis.py +5 -1
  37. tomwer/core/process/reconstruction/scores/params.py +2 -2
  38. tomwer/core/process/reconstruction/scores/scores.py +3 -3
  39. tomwer/core/process/reconstruction/tests/test_axis.py +1 -1
  40. tomwer/core/process/reconstruction/tests/test_saaxis.py +56 -66
  41. tomwer/core/process/stitching/metadataholder.py +5 -5
  42. tomwer/core/process/stitching/nabustitcher.py +1 -4
  43. tomwer/core/process/tests/test_normalization.py +2 -1
  44. tomwer/core/scan/edfscan.py +3 -3
  45. tomwer/core/scan/nxtomoscan.py +3 -3
  46. tomwer/core/scan/scanbase.py +3 -3
  47. tomwer/core/scan/scantype.py +1 -1
  48. tomwer/core/settings.py +1 -1
  49. tomwer/core/tomwer_object.py +1 -1
  50. tomwer/core/utils/nxtomoutils.py +2 -2
  51. tomwer/core/utils/spec.py +6 -3
  52. tomwer/gui/cluster/slurm.py +3 -3
  53. tomwer/gui/configuration/level.py +1 -1
  54. tomwer/gui/control/actions.py +1 -1
  55. tomwer/gui/control/datadiscovery.py +1 -1
  56. tomwer/gui/control/datalist.py +1 -1
  57. tomwer/gui/control/reducedarkflatselector.py +4 -4
  58. tomwer/gui/control/series/seriescreator.py +5 -5
  59. tomwer/gui/control/tomoobjdisplaymode.py +1 -1
  60. tomwer/gui/dataportal/gallery.py +6 -6
  61. tomwer/gui/edit/imagekeyeditor.py +7 -9
  62. tomwer/gui/edit/nxtomoeditor.py +420 -112
  63. tomwer/gui/edit/tests/test_nx_editor.py +155 -83
  64. tomwer/gui/reconstruction/axis/CalculationWidget.py +1 -1
  65. tomwer/gui/reconstruction/axis/EstimatedCORWidget.py +12 -8
  66. tomwer/gui/reconstruction/axis/EstimatedCorComboBox.py +2 -2
  67. tomwer/gui/reconstruction/axis/InputWidget.py +3 -3
  68. tomwer/gui/reconstruction/darkref/darkrefwidget.py +2 -2
  69. tomwer/gui/reconstruction/nabu/castvolume.py +16 -1
  70. tomwer/gui/reconstruction/nabu/nabuconfig/base.py +2 -4
  71. tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +6 -6
  72. tomwer/gui/reconstruction/nabu/nabuconfig/nabuconfig.py +1 -1
  73. tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +5 -5
  74. tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +2 -4
  75. tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +78 -52
  76. tomwer/gui/reconstruction/nabu/nabuflow.py +3 -13
  77. tomwer/gui/reconstruction/nabu/slices.py +11 -11
  78. tomwer/gui/reconstruction/nabu/test/test_cast_volume.py +19 -0
  79. tomwer/gui/reconstruction/nabu/volume.py +1 -1
  80. tomwer/gui/reconstruction/normalization/intensity.py +8 -12
  81. tomwer/gui/reconstruction/saaxis/corrangeselector.py +2 -2
  82. tomwer/gui/reconstruction/saaxis/dimensionwidget.py +71 -67
  83. tomwer/gui/reconstruction/sacommon.py +1 -1
  84. tomwer/gui/reconstruction/scores/scoreplot.py +18 -10
  85. tomwer/gui/reconstruction/tests/test_saaxis.py +18 -16
  86. tomwer/gui/stitching/SingleAxisStitchingWidget.py +8 -8
  87. tomwer/gui/stitching/StitchingOptionsWidget.py +1 -1
  88. tomwer/gui/stitching/alignment.py +8 -8
  89. tomwer/gui/stitching/config/axisparams.py +2 -2
  90. tomwer/gui/stitching/config/output.py +1 -1
  91. tomwer/gui/stitching/config/positionoveraxis.py +1 -1
  92. tomwer/gui/stitching/config/stitchingstrategies.py +4 -6
  93. tomwer/gui/stitching/config/tomoobjdetails.py +21 -13
  94. tomwer/gui/stitching/normalization.py +6 -6
  95. tomwer/gui/stitching/tests/test_ZStitchingWindow.py +8 -1
  96. tomwer/gui/stitching/tests/test_preview.py +10 -7
  97. tomwer/gui/stitching/tests/utils.py +27 -18
  98. tomwer/gui/stitching/z_stitching/fineestimation.py +7 -9
  99. tomwer/gui/stitching/z_stitching/tests/test_raw_estimation.py +18 -7
  100. tomwer/gui/stitching/z_stitching/tests/test_stitching_window.py +7 -2
  101. tomwer/gui/utils/buttons.py +54 -36
  102. tomwer/gui/utils/flow.py +2 -2
  103. tomwer/gui/utils/loadingmode.py +1 -1
  104. tomwer/gui/utils/unitsystem.py +44 -33
  105. tomwer/gui/utils/vignettes.py +1 -1
  106. tomwer/gui/visualization/dataviewer.py +7 -7
  107. tomwer/gui/visualization/diffviewer/diffviewer.py +4 -4
  108. tomwer/gui/visualization/diffviewer/shiftwidget.py +4 -6
  109. tomwer/gui/visualization/reconstructionparameters.py +35 -23
  110. tomwer/gui/visualization/scanoverview.py +28 -11
  111. tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +25 -13
  112. tomwer/gui/visualization/test/test_reconstruction_parameters.py +2 -2
  113. tomwer/model/dataset.py +0 -0
  114. tomwer/resources/gui/icons/borders.png +0 -0
  115. tomwer/synctools/utils/scanstages.py +3 -3
  116. tomwer/tasks/reconstruction/cleardarkflat.py +42 -0
  117. tomwer/tests/app/test_stitching.py +1 -1
  118. tomwer/tests/orangecontrib/tomwer/widgets/edit/tests/test_nxtomo_editor.py +32 -20
  119. tomwer/tests/orangecontrib/tomwer/widgets/reconstruction/tests/test_nabu_widget.py +1 -1
  120. tomwer/version.py +2 -2
  121. {tomwer-1.4.19.dist-info → tomwer-1.5.0.dist-info}/METADATA +8 -8
  122. {tomwer-1.4.19.dist-info → tomwer-1.5.0.dist-info}/RECORD +126 -123
  123. {tomwer-1.4.19.dist-info → tomwer-1.5.0.dist-info}/WHEEL +1 -1
  124. {tomwer-1.4.19.dist-info → tomwer-1.5.0.dist-info}/entry_points.txt +0 -0
  125. {tomwer-1.4.19.dist-info → tomwer-1.5.0.dist-info}/licenses/LICENSE +0 -0
  126. {tomwer-1.4.19.dist-info → tomwer-1.5.0.dist-info}/top_level.txt +0 -0
tomwer/core/settings.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import os
2
- from silx.utils.enum import Enum as _Enum
2
+ from enum import Enum as _Enum
3
3
 
4
4
 
5
5
  __LBSRAM_PATH = "/lbsram"
@@ -19,7 +19,7 @@ class TomwerObject(Dataset):
19
19
  """util function to clear some heavy object from the cache"""
20
20
  raise NotImplementedError()
21
21
 
22
- def clear_caches(self):
22
+ def clear_cache(self):
23
23
  pass
24
24
 
25
25
  @property
@@ -11,12 +11,12 @@ def get_n_series(image_key_values: tuple | list, image_key_type: ImageKey) -> in
11
11
 
12
12
  :param image_key_values: list or tuple of image_keys to consider. Can be integers or tomoscan.esrf.scan.hdf5scan.ImageKey
13
13
  """
14
- image_key_type = ImageKey.from_value(image_key_type)
14
+ image_key_type = ImageKey(image_key_type)
15
15
  if image_key_type is ImageKey.INVALID:
16
16
  raise ValueError(
17
17
  "we can't count Invalid image keys series because those are ignored from tomoscan"
18
18
  )
19
- image_key_values = [ImageKey.from_value(img_key) for img_key in image_key_values]
19
+ image_key_values = [ImageKey(img_key) for img_key in image_key_values]
20
20
 
21
21
  # remove invalid frames
22
22
  image_key_values = numpy.array(
tomwer/core/utils/spec.py CHANGED
@@ -3,14 +3,17 @@ from __future__ import annotations
3
3
  import fileinput
4
4
  import logging
5
5
  import os
6
+ import pint
7
+
8
+ import fabio
6
9
 
7
- import fabio.edfimage
8
10
  from lxml import etree
9
- from pyunitsystem.metricsystem import MetricSystem
10
11
 
11
12
 
12
13
  _logger = logging.getLogger(__name__)
13
14
 
15
+ _ureg = pint.get_application_registry()
16
+
14
17
 
15
18
  def _getInformation(scan, refFile, information, _type, aliases=None):
16
19
  """
@@ -258,6 +261,6 @@ def getPixelSize(scan) -> float | None:
258
261
  value = float(ddict["IMAGE_PIXEL_SIZE_1".lower()])
259
262
  # for now pixel size are stored in microns. We want to return them in meter
260
263
  if value is not None:
261
- return value * MetricSystem.MICROMETER.value
264
+ return (value * _ureg.micrometer).to_base_units().magnitude
262
265
  else:
263
266
  return None
@@ -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.values())
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.from_value(self._modeCombox.currentText())
158
+ return SlurmSettingsMode(self._modeCombox.currentText())
159
159
 
160
160
  def setCurrentSettingsMode(self, mode: SlurmSettingsMode) -> SlurmSettingsMode:
161
- mode = SlurmSettingsMode.from_value(mode)
161
+ mode = SlurmSettingsMode(mode)
162
162
  self._modeCombox.setCurrentText(mode.value)
163
163
 
164
164
  def setMode(self, mode: SlurmSettingsMode) -> None:
@@ -1,4 +1,4 @@
1
- from silx.utils.enum import Enum as _Enum
1
+ from enum import Enum as _Enum
2
2
 
3
3
 
4
4
  class ConfigurationLevel(_Enum):
@@ -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.from_value(mode)
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)
@@ -44,7 +44,7 @@ class ScanDiscoveryConfigWidget(qt.QGroupBox):
44
44
  raise NotImplementedError
45
45
 
46
46
  def setScanType(self, mode: ScanType):
47
- mode = ScanType.from_value(mode)
47
+ mode = ScanType(mode)
48
48
  if mode is ScanType.SPEC:
49
49
  self._specQRB.setChecked(True)
50
50
  elif mode is ScanType.BLISS:
@@ -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.from_value(mode)
619
+ self._displayMode = DisplayMode(mode)
620
620
  self._update()
621
621
 
622
622
  def n_data(self):
@@ -287,11 +287,11 @@ class ReduceDarkFlatSelectorTableWidget(qt.QWidget):
287
287
  h5file=url.file_path(),
288
288
  path=url.data_path(),
289
289
  )
290
- for target in REDUCER_TARGET.values():
291
- if target in reduced_info_dict:
292
- reduced_frames = reduced_info_dict[target]
290
+ for target in REDUCER_TARGET:
291
+ if target.value in reduced_info_dict:
292
+ reduced_frames = reduced_info_dict[target.value]
293
293
  reduced_frames["reduce_frames_name"] = (
294
- f"{target} from {url.data_path()}@{os.path.basename(url.file_path())}"
294
+ f"{target.value} from {url.data_path()}@{os.path.basename(url.file_path())}"
295
295
  )
296
296
  result.append(reduced_frames)
297
297
 
@@ -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 silx.utils.enum import Enum as _Enum
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.values():
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.from_value(self._modeCB.currentText())
172
+ return _SeriesDefinitionMode(self._modeCB.currentText())
173
173
 
174
174
  def setMode(self, mode: str):
175
- mode = _SeriesDefinitionMode.from_value(mode)
175
+ mode = _SeriesDefinitionMode(mode)
176
176
  idx = self._modeCB.findText(mode.value)
177
177
  self._modeCB.setCurrentIndex(idx)
178
178
 
@@ -1,4 +1,4 @@
1
- from silx.utils.enum import Enum as _Enum
1
+ from enum import Enum as _Enum
2
2
 
3
3
 
4
4
  class DisplayMode(_Enum):
@@ -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.values())
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.values())
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.from_value(self._outputFormat.currentText())
52
+ return OutputFormat(self._outputFormat.currentText())
53
53
 
54
54
  def setOutputFormat(self, format: OutputFormat):
55
- format = OutputFormat.from_value(format)
55
+ format = OutputFormat(format)
56
56
  self._outputFormat.setCurrentText(format.value)
57
57
 
58
58
  def getBinning(self) -> Binning:
59
- return Binning.from_value(self._binningQCB.currentText())
59
+ return Binning(self._binningQCB.currentText())
60
60
 
61
61
  def setBinning(self, binning: Binning):
62
- binning = Binning.from_value(binning)
62
+ binning = Binning(binning)
63
63
  self._binningQCB.setCurrentText(binning.value)
64
64
 
65
65
  def overwrite(self) -> bool:
@@ -112,9 +112,7 @@ class ImageKeyWindow(qt.QMainWindow):
112
112
  def setModifications(self, modifications):
113
113
  self._mainWindow.clearModifcations()
114
114
  image_keys_set = set(modifications.values())
115
- image_keys_set = set(
116
- [_ImageKey.from_value(image_key) for image_key in image_keys_set]
117
- )
115
+ image_keys_set = set([_ImageKey(image_key) for image_key in image_keys_set])
118
116
  for image_key_type in image_keys_set:
119
117
  self._mainWindow.applyModifications(
120
118
  modifications=modifications, new_image_key=image_key_type
@@ -432,7 +430,7 @@ class _ImageKeyList(qt.QTableWidget):
432
430
  self.setItem(i_frame, 0, _item)
433
431
 
434
432
  # current image key
435
- current_image_key = _ImageKey.from_value(frame.image_key)
433
+ current_image_key = _ImageKey(frame.image_key)
436
434
  current_image_key = self._IMAGE_KEYS_INV[current_image_key]
437
435
  currentImgKeyItem = qt.QLabel(current_image_key, self)
438
436
  self.setCellWidget(i_frame, 1, currentImgKeyItem)
@@ -442,7 +440,7 @@ class _ImageKeyList(qt.QTableWidget):
442
440
  new_image_key = frames_new_keys[frame.index]
443
441
  else:
444
442
  new_image_key = frame.image_key
445
- new_image_key = _ImageKey.from_value(new_image_key)
443
+ new_image_key = _ImageKey(new_image_key)
446
444
  new_image_key = self._IMAGE_KEYS_INV[new_image_key]
447
445
  newImgKeyItem = _ImageKeyComboBox(parent=self, image_key=new_image_key)
448
446
  self._imageKeyComboboxes[index] = newImgKeyItem
@@ -694,16 +692,16 @@ class ImageKeyUpgraderList(qt.QTableWidget):
694
692
  self.setCellWidget(i_operation, 1, remove_button)
695
693
 
696
694
  def addOperation(self, from_image_key: _ImageKey, to_image_key: _ImageKey):
697
- from_image_key = _ImageKey.from_value(from_image_key)
698
- to_image_key = _ImageKey.from_value(to_image_key)
695
+ from_image_key = _ImageKey(from_image_key)
696
+ to_image_key = _ImageKey(to_image_key)
699
697
 
700
698
  self._operations[from_image_key] = to_image_key
701
699
  self._update()
702
700
  self.sigOperationsChanged.emit()
703
701
 
704
702
  def removeOperation(self, from_image_key: _ImageKey, to_image_key: _ImageKey):
705
- from_image_key = _ImageKey.from_value(from_image_key)
706
- to_image_key = _ImageKey.from_value(to_image_key)
703
+ from_image_key = _ImageKey(from_image_key)
704
+ to_image_key = _ImageKey(to_image_key)
707
705
  if (
708
706
  from_image_key not in self._operations
709
707
  or self._operations[from_image_key] != to_image_key