tomwer 1.3.0rc9__py3-none-any.whl → 1.3.0rc10__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/widgets/__init__.py +5 -8
- orangecontrib/tomwer/widgets/control/NXTomomillOW.py +5 -5
- tomwer/core/process/control/datalistener/datalistener.py +15 -10
- tomwer/core/process/control/nxtomomill.py +1 -1
- tomwer/core/process/edit/imagekeyeditor.py +1 -1
- tomwer/core/process/reconstruction/axis/axis.py +199 -31
- tomwer/core/process/reconstruction/axis/params.py +8 -5
- tomwer/core/process/reconstruction/nabu/nabucommon.py +2 -2
- tomwer/core/process/reconstruction/nabu/nabuslices.py +4 -4
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +4 -2
- tomwer/core/process/task.py +2 -2
- tomwer/core/process/test/test_axis.py +3 -2
- tomwer/core/process/test/test_data_transfer.py +3 -3
- tomwer/core/scan/blissscan.py +3 -3
- tomwer/core/scan/nxtomoscan.py +2 -2
- tomwer/core/scan/scanbase.py +6 -4
- tomwer/core/scan/test/test_process_registration.py +2 -2
- tomwer/core/settings.py +3 -3
- tomwer/gui/cluster/slurm.py +14 -9
- tomwer/gui/cluster/test/test_cluster.py +1 -2
- tomwer/gui/control/datawatcher/controlwidget.py +2 -4
- tomwer/gui/control/reducedarkflatselector.py +2 -2
- tomwer/gui/edit/dkrfpatch.py +4 -4
- tomwer/gui/edit/nxtomowarmer.py +2 -2
- tomwer/gui/imagefromfile.py +2 -2
- tomwer/gui/reconstruction/darkref/darkrefwidget.py +2 -1
- tomwer/gui/test/test_axis_gui.py +4 -10
- tomwer/gui/visualization/volumeviewer.py +16 -14
- tomwer/io/utils/h5pyutils.py +3 -3
- tomwer/io/utils/utils.py +3 -3
- tomwer/version.py +1 -1
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/METADATA +8 -8
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/RECORD +39 -39
- /tomwer-1.3.0rc9-py3.11-nspkg.pth → /tomwer-1.3.0rc10-py3.11-nspkg.pth +0 -0
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/LICENSE +0 -0
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/WHEEL +0 -0
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/entry_points.txt +0 -0
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.3.0rc9.dist-info → tomwer-1.3.0rc10.dist-info}/top_level.txt +0 -0
tomwer/core/scan/nxtomoscan.py
CHANGED
@@ -45,7 +45,7 @@ from tomoscan.esrf.identifier.hdf5Identifier import (
|
|
45
45
|
)
|
46
46
|
from tomoscan.esrf.identifier.url_utils import UrlSettings, split_path, split_query
|
47
47
|
from tomoscan.esrf.scan.nxtomoscan import NXtomoScan as _tsNXtomoScan
|
48
|
-
from tomoscan.io import HDF5File
|
48
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
49
49
|
from nxtomo.nxobject.nxdetector import ImageKey
|
50
50
|
|
51
51
|
from tomwer.utils import docstring
|
@@ -422,7 +422,7 @@ class NXtomoScan(_tsNXtomoScan, TomwerScanBase):
|
|
422
422
|
return tuple()
|
423
423
|
else:
|
424
424
|
res = []
|
425
|
-
with HDF5File(file_path, mode="r", swmr=
|
425
|
+
with HDF5File(file_path, mode="r", swmr=get_swmr_mode()) as h5s:
|
426
426
|
for entry_name, node in h5s.items():
|
427
427
|
if isinstance(node, h5py.Group):
|
428
428
|
if NXtomoScan.entry_is_nx_tomo(node):
|
tomwer/core/scan/scanbase.py
CHANGED
@@ -41,7 +41,7 @@ import numpy
|
|
41
41
|
from silx.io.url import DataUrl
|
42
42
|
from silx.utils.enum import Enum as _Enum
|
43
43
|
from tomoscan.identifier import VolumeIdentifier
|
44
|
-
from tomoscan.io import HDF5File
|
44
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
45
45
|
from tomoscan.normalization import IntensityNormalization
|
46
46
|
from tomoscan.volumebase import VolumeBase
|
47
47
|
from tomoscan.identifier import BaseIdentifier
|
@@ -131,7 +131,7 @@ class TomwerScanBase(TomwerObject):
|
|
131
131
|
and self.process_file is not None
|
132
132
|
and os.path.exists(self.process_file)
|
133
133
|
):
|
134
|
-
with HDF5File(self.process_file, mode="r", swmr=
|
134
|
+
with HDF5File(self.process_file, mode="r", swmr=get_swmr_mode()) as h5s:
|
135
135
|
self._process_index = len(h5s.items())
|
136
136
|
else:
|
137
137
|
self._process_index = 0
|
@@ -756,7 +756,7 @@ class TomwerScanBase(TomwerObject):
|
|
756
756
|
from tomwer.core.process.task import Task
|
757
757
|
|
758
758
|
if os.path.exists(self.process_file):
|
759
|
-
with HDF5File(self.process_file, mode="r", swmr=
|
759
|
+
with HDF5File(self.process_file, mode="r", swmr=get_swmr_mode()) as h5s:
|
760
760
|
if not hasattr(self, "entry"):
|
761
761
|
entry = "entry"
|
762
762
|
else:
|
@@ -864,7 +864,9 @@ def _get_reconstructed_single_file_volume(
|
|
864
864
|
|
865
865
|
if check_url is True:
|
866
866
|
try:
|
867
|
-
with HDF5File(
|
867
|
+
with HDF5File(
|
868
|
+
os.path.abspath(file_), "r", swmr=get_swmr_mode()
|
869
|
+
) as h5f:
|
868
870
|
if entry not in h5f:
|
869
871
|
logger.info("{volume} does not exists")
|
870
872
|
return None
|
@@ -32,7 +32,7 @@ import shutil
|
|
32
32
|
import tempfile
|
33
33
|
import unittest
|
34
34
|
|
35
|
-
from tomoscan.io import HDF5File
|
35
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
36
36
|
|
37
37
|
from tomwer.core.process.task import Task
|
38
38
|
from tomwer.core.utils.scanutils import MockNXtomo
|
@@ -98,7 +98,7 @@ class TestProcessRegistration(unittest.TestCase):
|
|
98
98
|
process_index=i,
|
99
99
|
)
|
100
100
|
|
101
|
-
with HDF5File(self.scan.process_file, "r", swmr=
|
101
|
+
with HDF5File(self.scan.process_file, "r", swmr=get_swmr_mode()) as h5f:
|
102
102
|
nodes = Task._get_process_nodes(
|
103
103
|
root_node=h5f[self.scan.entry], process=self.DummyProcess
|
104
104
|
)
|
tomwer/core/settings.py
CHANGED
@@ -125,7 +125,7 @@ class SlurmSettings:
|
|
125
125
|
N_JOBS = 1
|
126
126
|
"""on how many job we want to split the EwoksTask"""
|
127
127
|
|
128
|
-
MEMORY_PER_WORKER =
|
128
|
+
MEMORY_PER_WORKER = 128 # memory in GB
|
129
129
|
"""Amount of memory per worker"""
|
130
130
|
|
131
131
|
PARTITION = "p9gpu"
|
@@ -136,7 +136,7 @@ class SlurmSettings:
|
|
136
136
|
N_GPUS_PER_WORKER = 1
|
137
137
|
"""number of gpu per worker"""
|
138
138
|
|
139
|
-
PYTHON_VENV =
|
139
|
+
PYTHON_VENV = None
|
140
140
|
"""Python executable to take. Useful if compute nodes have a different environment from the front end.
|
141
141
|
"""
|
142
142
|
|
@@ -144,7 +144,7 @@ class SlurmSettings:
|
|
144
144
|
"""Slurm cluster project name. `scan`, `process` and `info` will be format.
|
145
145
|
"""
|
146
146
|
|
147
|
-
MODULES_TO_LOAD =
|
147
|
+
MODULES_TO_LOAD = ("tomotools/stable", )
|
148
148
|
|
149
149
|
SBATCH_EXTRA_PARAMS = {
|
150
150
|
"export": "NONE", # value to provide to sbatch --export={}
|
tomwer/gui/cluster/slurm.py
CHANGED
@@ -168,6 +168,7 @@ class SlurmSettingsWindow(qt.QMainWindow):
|
|
168
168
|
"job_name": settingsClass.PROJECT_NAME,
|
169
169
|
"walltime": settingsClass.DEFAULT_WALLTIME,
|
170
170
|
"python_venv": settingsClass.PYTHON_VENV,
|
171
|
+
"modules": settingsClass.MODULES_TO_LOAD,
|
171
172
|
}
|
172
173
|
)
|
173
174
|
|
@@ -270,7 +271,7 @@ class SlurmSettingsWidget(qt.QWidget):
|
|
270
271
|
self.layout().addRow(self._preProcessingGroup)
|
271
272
|
|
272
273
|
# python venv
|
273
|
-
self._pythonVenv = qt.QLineEdit("", self)
|
274
|
+
self._pythonVenv = qt.QLineEdit("/scisoft/tomotools/activate stable", self)
|
274
275
|
self._sourceScriptCB = qt.QRadioButton("source script (python venv)", self)
|
275
276
|
self._preProcessingButtonGroup.addButton(self._sourceScriptCB)
|
276
277
|
self._preProcessingGroup.layout().addRow(self._sourceScriptCB, self._pythonVenv)
|
@@ -280,13 +281,13 @@ class SlurmSettingsWidget(qt.QWidget):
|
|
280
281
|
"""
|
281
282
|
)
|
282
283
|
|
283
|
-
self._modulesQLE = qt.QLineEdit("
|
284
|
-
self._modulesCB = qt.QRadioButton("module to load", self)
|
284
|
+
self._modulesQLE = qt.QLineEdit(", ".join(SlurmSettings.MODULES_TO_LOAD), self)
|
285
|
+
self._modulesCB = qt.QRadioButton("module(s) to load", self)
|
285
286
|
self._preProcessingButtonGroup.addButton(self._modulesCB)
|
286
287
|
self._preProcessingGroup.layout().addRow(self._modulesCB, self._modulesQLE)
|
287
288
|
self._preProcessingGroup.setToolTip(
|
288
289
|
"""
|
289
|
-
Optional list of modules to load before executing the script.
|
290
|
+
Optional list of modules to load before executing the script. each module must be separated by a coma
|
290
291
|
"""
|
291
292
|
)
|
292
293
|
|
@@ -372,8 +373,7 @@ class SlurmSettingsWidget(qt.QWidget):
|
|
372
373
|
self._nGpu.setValue(n_gpu)
|
373
374
|
self._jobName.setText(SlurmSettings.PROJECT_NAME)
|
374
375
|
self._wallTimeQLE.setText(SlurmSettings.DEFAULT_WALLTIME)
|
375
|
-
self.
|
376
|
-
self._sourceScriptCB.setChecked(True)
|
376
|
+
self._modulesCB.setChecked(True) # by default we go for modules
|
377
377
|
self._preProcessingModeChanged()
|
378
378
|
self._partitionChanged()
|
379
379
|
self._nGpuChanged()
|
@@ -569,7 +569,7 @@ class SlurmSettingsWidget(qt.QWidget):
|
|
569
569
|
self.sigConfigChanged.emit()
|
570
570
|
|
571
571
|
def getConfiguration(self) -> dict:
|
572
|
-
|
572
|
+
config = {
|
573
573
|
"cpu-per-task": self.getNCores(),
|
574
574
|
"n_tasks": self.getNWorkers(),
|
575
575
|
"n_jobs": self.getNJobs(),
|
@@ -578,10 +578,15 @@ class SlurmSettingsWidget(qt.QWidget):
|
|
578
578
|
"n_gpus": self.getNGPU(),
|
579
579
|
"job_name": self.getProjectName(),
|
580
580
|
"walltime": self.getWallTime(),
|
581
|
-
"python_venv": self.getPythonExe(),
|
582
|
-
"modules": self.getModulesToLoad(),
|
583
581
|
"sbatch_extra_params": self.getSBatchExtraParams(),
|
584
582
|
}
|
583
|
+
if self._modulesCB.isChecked():
|
584
|
+
config["modules"] = self.getModulesToLoad()
|
585
|
+
elif self._sourceScriptCB.isChecked():
|
586
|
+
config["python_venv"] = self.getPythonExe()
|
587
|
+
else:
|
588
|
+
raise ValueError("'modules' or python environement should be enable")
|
589
|
+
return config
|
585
590
|
|
586
591
|
def getSlurmClusterConfiguration(self):
|
587
592
|
from tomwer.core.cluster import SlurmClusterConfiguration
|
@@ -61,9 +61,8 @@ class TestSlurmWidget(TestCaseQt):
|
|
61
61
|
"partition": SlurmSettings.PARTITION,
|
62
62
|
"n_gpus": SlurmSettings.N_GPUS_PER_WORKER,
|
63
63
|
"job_name": "tomwer_{scan}_-_{process}_-_{info}",
|
64
|
-
"modules": tuple(),
|
65
64
|
"n_jobs": 1,
|
66
|
-
"
|
65
|
+
"modules": ("tomotools/stable",),
|
67
66
|
"walltime": "01:00:00",
|
68
67
|
"sbatch_extra_params": {
|
69
68
|
"export": "NONE",
|
@@ -99,10 +99,8 @@ class ControlWidget(qt.QWidget):
|
|
99
99
|
"""
|
100
100
|
Ask the user the path to the folder to observe
|
101
101
|
"""
|
102
|
-
defaultDirectory = self.
|
102
|
+
defaultDirectory = self._qteFolderSelected.text()
|
103
103
|
if defaultDirectory is None or not os.path.isdir(defaultDirectory):
|
104
|
-
if os.path.isdir(self.DEFAULT_DIRECTORY):
|
105
|
-
defaultDirectory = self.DEFAULT_DIRECTORY
|
106
104
|
if defaultDirectory is None:
|
107
105
|
defaultDirectory = get_default_directory()
|
108
106
|
|
@@ -113,4 +111,4 @@ class ControlWidget(qt.QWidget):
|
|
113
111
|
dialog.close()
|
114
112
|
return
|
115
113
|
|
116
|
-
self.
|
114
|
+
self._qteFolderSelected.setText(dialog.selectedFiles()[0])
|
@@ -12,7 +12,7 @@ from silx.gui.dialog.DataFileDialog import DataFileDialog
|
|
12
12
|
|
13
13
|
from tomoscan.esrf.scan.utils import cwd_context
|
14
14
|
from tomoscan.framereducer.target import REDUCER_TARGET
|
15
|
-
from tomoscan.io import HDF5File
|
15
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
16
16
|
|
17
17
|
from tomwer.io.utils import get_default_directory
|
18
18
|
|
@@ -249,7 +249,7 @@ class ReduceDarkFlatSelectorTableWidget(qt.QWidget):
|
|
249
249
|
if not os.path.exists(file_path):
|
250
250
|
_logger.error(f"file doesn't exists ({file_path})")
|
251
251
|
|
252
|
-
with HDF5File(file_path, mode="r", swmr=
|
252
|
+
with HDF5File(file_path, mode="r", swmr=get_swmr_mode()) as h5f:
|
253
253
|
entries = tuple(h5f.keys())
|
254
254
|
|
255
255
|
res = []
|
tomwer/gui/edit/dkrfpatch.py
CHANGED
@@ -37,7 +37,7 @@ from silx.gui.dialog.DataFileDialog import DataFileDialog
|
|
37
37
|
from silx.io.url import DataUrl
|
38
38
|
from silx.io.utils import h5py_read_dataset
|
39
39
|
from nxtomo.nxobject.nxdetector import ImageKey
|
40
|
-
from tomoscan.io import HDF5File
|
40
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
41
41
|
|
42
42
|
import tomwer.core.utils.nxtomoutils as nxtomo_utils
|
43
43
|
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
@@ -83,7 +83,7 @@ class _DarkOrFlatUrl(qt.QWidget):
|
|
83
83
|
url = self._redirectDataPath(url, logger=_logger)
|
84
84
|
|
85
85
|
def dataset_invalid(url):
|
86
|
-
with HDF5File(url.file_path(), mode="r", swmr=
|
86
|
+
with HDF5File(url.file_path(), mode="r", swmr=get_swmr_mode()) as h5s:
|
87
87
|
if not isinstance(h5s[url.data_path()], h5py.Dataset):
|
88
88
|
return True
|
89
89
|
return False
|
@@ -113,7 +113,7 @@ class _DarkOrFlatUrl(qt.QWidget):
|
|
113
113
|
|
114
114
|
def _redirectDataPath(self, url, logger=None):
|
115
115
|
try:
|
116
|
-
with HDF5File(url.file_path(), mode="r", swmr=
|
116
|
+
with HDF5File(url.file_path(), mode="r", swmr=get_swmr_mode()) as h5s:
|
117
117
|
node = h5s[url.data_path()]
|
118
118
|
|
119
119
|
if NXtomoScan.entry_is_nx_tomo(node):
|
@@ -188,7 +188,7 @@ class _DarkOrFlatUrl(qt.QWidget):
|
|
188
188
|
def _getImageKey(self, url):
|
189
189
|
# if we are on a 'detector / data dataset' then we can try to reach
|
190
190
|
# image_key information
|
191
|
-
with HDF5File(url.file_path(), mode="r", swmr=
|
191
|
+
with HDF5File(url.file_path(), mode="r", swmr=get_swmr_mode()) as h5s:
|
192
192
|
dataset = h5s[url.data_path()]
|
193
193
|
grp_parent = dataset.parent
|
194
194
|
if grp_parent is not None and NXtomoScan.is_nxdetector(grp_parent):
|
tomwer/gui/edit/nxtomowarmer.py
CHANGED
@@ -3,7 +3,7 @@ import h5py
|
|
3
3
|
from silx.gui import qt
|
4
4
|
from tomwer.core.scan.nxtomoscan import NXtomoScan
|
5
5
|
from tomwer.gui import icons
|
6
|
-
from tomoscan.io import HDF5File
|
6
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
7
7
|
|
8
8
|
|
9
9
|
class NXtomoProxyWarmer(qt.QWidget):
|
@@ -44,7 +44,7 @@ class NXtomoProxyWarmer(qt.QWidget):
|
|
44
44
|
if scan is None:
|
45
45
|
self._activateWarning(False)
|
46
46
|
elif isinstance(scan, NXtomoScan):
|
47
|
-
with HDF5File(scan.master_file, mode="r", swmr=
|
47
|
+
with HDF5File(scan.master_file, mode="r", swmr=get_swmr_mode()) as h5f:
|
48
48
|
entry = h5f.get(
|
49
49
|
name=scan.entry, getclass=True, getlink=True, default=None
|
50
50
|
)
|
tomwer/gui/imagefromfile.py
CHANGED
@@ -34,7 +34,7 @@ import logging
|
|
34
34
|
|
35
35
|
from silx.gui import qt
|
36
36
|
from silx.io.url import DataUrl
|
37
|
-
from tomoscan.io import HDF5File
|
37
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
38
38
|
|
39
39
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
40
40
|
from tomwer.synctools.imageloaderthread import ImageLoaderThread
|
@@ -71,7 +71,7 @@ class ImageFromFile(_Image):
|
|
71
71
|
|
72
72
|
def get_nabu_entry():
|
73
73
|
try:
|
74
|
-
with HDF5File(_file, mode="r", swmr=
|
74
|
+
with HDF5File(_file, mode="r", swmr=get_swmr_mode()) as h5s:
|
75
75
|
for node in h5s:
|
76
76
|
if "reconstruction" in h5s[node]:
|
77
77
|
return "/".join(
|
@@ -198,7 +198,8 @@ class _TabGeneral(qt.QWidget):
|
|
198
198
|
self._grpOptions = qt.QGroupBox("options", parent=self)
|
199
199
|
self._grpOptions.setLayout(qt.QVBoxLayout())
|
200
200
|
self._rmOptionCB = qt.QCheckBox(
|
201
|
-
parent=self._grpOptions,
|
201
|
+
parent=self._grpOptions,
|
202
|
+
text="remove raw EDF files when done (for spec only)",
|
202
203
|
)
|
203
204
|
self.sigRmToggled = self._rmOptionCB.toggled
|
204
205
|
self._skipOptionCB = qt.QCheckBox(
|
tomwer/gui/test/test_axis_gui.py
CHANGED
@@ -14,27 +14,21 @@ class TestGetNabuCorOpts(TestCaseQt):
|
|
14
14
|
"""
|
15
15
|
axis_params = QAxisRP()
|
16
16
|
widget = AxisTabWidget(recons_params=axis_params)
|
17
|
-
assert (
|
18
|
-
axis_params.get_nabu_cor_options_as_str()
|
19
|
-
== "side='right' ; near_pos=ignore"
|
20
|
-
)
|
17
|
+
assert axis_params.get_nabu_cor_options_as_str() == "side='right'"
|
21
18
|
widget._calculationWidget._corOpts.setText("low_pass=2")
|
22
19
|
widget._calculationWidget._corOpts.editingFinished.emit()
|
23
20
|
self.qapp.processEvents()
|
24
|
-
assert (
|
25
|
-
axis_params.get_nabu_cor_options_as_str()
|
26
|
-
== "side='right' ; near_pos=ignore ; low_pass=2"
|
27
|
-
)
|
21
|
+
assert axis_params.get_nabu_cor_options_as_str() == "side='right' ; low_pass=2"
|
28
22
|
widget._calculationWidget._corOpts.setText("low_pass=2 ; high_pass=10")
|
29
23
|
widget._calculationWidget._corOpts.editingFinished.emit()
|
30
24
|
self.qapp.processEvents()
|
31
25
|
assert axis_params.get_nabu_cor_options_as_str() == (
|
32
|
-
"side='right' ;
|
26
|
+
"side='right' ; low_pass=2 ; high_pass=10"
|
33
27
|
)
|
34
28
|
widget._calculationWidget._sideCB.setCurrentText("left")
|
35
29
|
widget._calculationWidget._corOpts.editingFinished.emit()
|
36
30
|
self.qapp.processEvents()
|
37
31
|
assert (
|
38
32
|
axis_params.get_nabu_cor_options_as_str()
|
39
|
-
== "side='left' ;
|
33
|
+
== "side='left' ; low_pass=2 ; high_pass=10"
|
40
34
|
)
|
@@ -15,7 +15,7 @@ from tomoscan.esrf.volume.hdf5volume import HDF5Volume
|
|
15
15
|
from tomoscan.factory import Factory
|
16
16
|
from tomoscan.identifier import VolumeIdentifier
|
17
17
|
from tomoscan.volumebase import VolumeBase
|
18
|
-
from tomoscan.io import HDF5File
|
18
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
19
19
|
|
20
20
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
21
21
|
from tomwer.gui.visualization.reconstructionparameters import ReconstructionParameters
|
@@ -300,7 +300,7 @@ class VolumeViewer(qt.QMainWindow):
|
|
300
300
|
self._close_h5_file()
|
301
301
|
if isinstance(volume, HDF5Volume):
|
302
302
|
self._h5_file = HDF5File(
|
303
|
-
filename=volume.data_url.file_path(), mode="r", swmr=
|
303
|
+
filename=volume.data_url.file_path(), mode="r", swmr=get_swmr_mode()
|
304
304
|
)
|
305
305
|
if volume.data_url.data_path() in self._h5_file:
|
306
306
|
data = self._h5_file[volume.data_url.data_path()]
|
@@ -380,30 +380,32 @@ class VolumeViewer(qt.QMainWindow):
|
|
380
380
|
f"Volume should be an instance of a Volume, a VolumeIdentifier or a string refering to a VolumeIdentifier. {type(volume)} provided"
|
381
381
|
)
|
382
382
|
|
383
|
+
# warning: load metadata before data because can get some conflict with the HDF5 reader flag if done after
|
384
|
+
try:
|
385
|
+
# warning: limitation expected for .vol as it gets two configuration file. The default one is vol.info and does not contains
|
386
|
+
# any of the metadata 'distance', 'pixel size'... but it is here for backward compatiblity
|
387
|
+
self._reconsWidget.setVolumeMetadata(
|
388
|
+
volume.metadata or volume.load_metadata()
|
389
|
+
)
|
390
|
+
except Exception as e:
|
391
|
+
_logger.info(
|
392
|
+
f"Unable to set reconstruction parameters from {volume.data_url}. Not handled for pyhst reconstructions. Error is {e}"
|
393
|
+
)
|
394
|
+
|
383
395
|
data, state = self._get_data_volume(volume)
|
384
396
|
# set volume dataset
|
385
397
|
if state == "loading":
|
386
398
|
self._waitingOverlay.show()
|
387
|
-
pass
|
388
399
|
elif state == "loaded":
|
389
400
|
self._waitingOverlay.hide()
|
390
401
|
if data is not None:
|
391
402
|
self._set_volume(data)
|
403
|
+
|
392
404
|
elif state == "failed":
|
393
405
|
_logger.warning(
|
394
406
|
f"Failed to load data from {volume.get_identifier().to_str()}"
|
395
407
|
)
|
396
|
-
|
397
|
-
try:
|
398
|
-
# warning: limitation expected for .vol as it gets two configuration file. The default one is vol.info and does not contains
|
399
|
-
# any of the metadata 'distance', 'pixel size'... but it is here for backward compatiblity
|
400
|
-
self._reconsWidget.setVolumeMetadata(
|
401
|
-
volume.metadata or volume.load_metadata()
|
402
|
-
)
|
403
|
-
except Exception as e:
|
404
|
-
_logger.info(
|
405
|
-
f"Unable to set reconstruction parameters from {volume.data_url}. Not handled for pyhst reconstructions. Error is {e}"
|
406
|
-
)
|
408
|
+
return
|
407
409
|
|
408
410
|
def _set_volume(self, volume: Union[numpy.ndarray, h5py.Dataset]):
|
409
411
|
self._centralWidget.setData(volume)
|
tomwer/io/utils/h5pyutils.py
CHANGED
@@ -35,7 +35,7 @@ import contextlib
|
|
35
35
|
|
36
36
|
import h5py
|
37
37
|
from silx.io.url import DataUrl
|
38
|
-
from tomoscan.io import HDF5File
|
38
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
39
39
|
|
40
40
|
|
41
41
|
class _BaseReader(contextlib.AbstractContextManager):
|
@@ -61,7 +61,7 @@ class EntryReader(_BaseReader):
|
|
61
61
|
|
62
62
|
def __enter__(self):
|
63
63
|
self._file_handler = HDF5File(
|
64
|
-
filename=self._url.file_path(), mode="r", swmr=
|
64
|
+
filename=self._url.file_path(), mode="r", swmr=get_swmr_mode()
|
65
65
|
)
|
66
66
|
entry = self._file_handler[self._url.data_path()]
|
67
67
|
if not isinstance(entry, h5py.Group):
|
@@ -74,7 +74,7 @@ class DatasetReader(_BaseReader):
|
|
74
74
|
|
75
75
|
def __enter__(self):
|
76
76
|
self._file_handler = HDF5File(
|
77
|
-
filename=self._url.file_path(), mode="r", swmr=
|
77
|
+
filename=self._url.file_path(), mode="r", swmr=get_swmr_mode()
|
78
78
|
)
|
79
79
|
entry = self._file_handler[self._url.data_path()]
|
80
80
|
if not isinstance(entry, h5py.Dataset):
|
tomwer/io/utils/utils.py
CHANGED
@@ -39,7 +39,7 @@ import numpy.lib.npyio
|
|
39
39
|
from PIL import Image
|
40
40
|
from tomoscan.esrf import has_glymur
|
41
41
|
from tomoscan.esrf.scan.utils import get_data as tomoscan_get_data
|
42
|
-
from tomoscan.io import HDF5File
|
42
|
+
from tomoscan.io import HDF5File, get_swmr_mode
|
43
43
|
from typing import Union
|
44
44
|
|
45
45
|
from tomwer.core.utils import ftseriesutils
|
@@ -201,7 +201,7 @@ def get_linked_files_with_entry(hdf5_file: str, entry: str) -> set:
|
|
201
201
|
if item in treated_items:
|
202
202
|
continue
|
203
203
|
dirname = os.path.dirname(abs_file_path)
|
204
|
-
with HDF5File(abs_file_path, mode="r", swmr=
|
204
|
+
with HDF5File(abs_file_path, mode="r", swmr=get_swmr_mode()) as h5f:
|
205
205
|
node = h5f.get(data_path, getlink=True)
|
206
206
|
if isinstance(node, h5py.ExternalLink):
|
207
207
|
ext_file_path = node.filename
|
@@ -252,7 +252,7 @@ def get_linked_files_with_vds(hdf5_file: str, dataset_path: str) -> set:
|
|
252
252
|
if item in treated_items:
|
253
253
|
continue
|
254
254
|
dirname = os.path.dirname(abs_file_path)
|
255
|
-
with HDF5File(abs_file_path, mode="r", swmr=
|
255
|
+
with HDF5File(abs_file_path, mode="r", swmr=get_swmr_mode()) as h5f:
|
256
256
|
dataset = h5f[dataset_path]
|
257
257
|
if dataset.is_virtual:
|
258
258
|
for vs_info in dataset.virtual_sources():
|
tomwer/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tomwer
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.0rc10
|
4
4
|
Summary: "tomography workflow tools"
|
5
5
|
Home-page: https://gitlab.esrf.fr/tomotools/tomwer
|
6
6
|
Author: data analysis unit
|
@@ -26,7 +26,7 @@ Requires-Dist: setuptools
|
|
26
26
|
Requires-Dist: psutil
|
27
27
|
Requires-Dist: silx[full] >=2.0
|
28
28
|
Requires-Dist: tomoscan >=2.0.0a11
|
29
|
-
Requires-Dist: nxtomo >=1.
|
29
|
+
Requires-Dist: nxtomo >=1.2.3rc1
|
30
30
|
Requires-Dist: nxtomomill >=1.0dev
|
31
31
|
Requires-Dist: processview >=1.3
|
32
32
|
Requires-Dist: ewoks >=0.1.1
|
@@ -75,7 +75,7 @@ Requires-Dist: resource ; extra == 'dev'
|
|
75
75
|
Requires-Dist: tifffile ; extra == 'dev'
|
76
76
|
Requires-Dist: hdf5plugin ; extra == 'dev'
|
77
77
|
Requires-Dist: pyicat-plus ; extra == 'dev'
|
78
|
-
Requires-Dist: nabu[full] >=2023.3.
|
78
|
+
Requires-Dist: nabu[full] >=2023.3.1dev ; extra == 'dev'
|
79
79
|
Requires-Dist: pycuda ; extra == 'dev'
|
80
80
|
Requires-Dist: scikit-cuda ; extra == 'dev'
|
81
81
|
Requires-Dist: black ; extra == 'dev'
|
@@ -100,7 +100,7 @@ Requires-Dist: resource ; extra == 'dev_no_cuda'
|
|
100
100
|
Requires-Dist: tifffile ; extra == 'dev_no_cuda'
|
101
101
|
Requires-Dist: hdf5plugin ; extra == 'dev_no_cuda'
|
102
102
|
Requires-Dist: pyicat-plus ; extra == 'dev_no_cuda'
|
103
|
-
Requires-Dist: nabu >=2023.3.
|
103
|
+
Requires-Dist: nabu >=2023.3.1dev ; extra == 'dev_no_cuda'
|
104
104
|
Requires-Dist: black ; extra == 'dev_no_cuda'
|
105
105
|
Requires-Dist: flake8 ; extra == 'dev_no_cuda'
|
106
106
|
Requires-Dist: timeout-decorator ; extra == 'dev_no_cuda'
|
@@ -123,7 +123,7 @@ Requires-Dist: resource ; extra == 'doc'
|
|
123
123
|
Requires-Dist: tifffile ; extra == 'doc'
|
124
124
|
Requires-Dist: hdf5plugin ; extra == 'doc'
|
125
125
|
Requires-Dist: pyicat-plus ; extra == 'doc'
|
126
|
-
Requires-Dist: nabu >=2023.3.
|
126
|
+
Requires-Dist: nabu >=2023.3.1dev ; extra == 'doc'
|
127
127
|
Requires-Dist: Sphinx >=4.0.0 ; extra == 'doc'
|
128
128
|
Requires-Dist: nbsphinx ; extra == 'doc'
|
129
129
|
Requires-Dist: pandoc ; extra == 'doc'
|
@@ -149,7 +149,7 @@ Requires-Dist: resource ; extra == 'full'
|
|
149
149
|
Requires-Dist: tifffile ; extra == 'full'
|
150
150
|
Requires-Dist: hdf5plugin ; extra == 'full'
|
151
151
|
Requires-Dist: pyicat-plus ; extra == 'full'
|
152
|
-
Requires-Dist: nabu[full] >=2023.3.
|
152
|
+
Requires-Dist: nabu[full] >=2023.3.1dev ; extra == 'full'
|
153
153
|
Requires-Dist: pycuda ; extra == 'full'
|
154
154
|
Requires-Dist: scikit-cuda ; extra == 'full'
|
155
155
|
Provides-Extra: full_no_cuda
|
@@ -170,7 +170,7 @@ Requires-Dist: resource ; extra == 'full_no_cuda'
|
|
170
170
|
Requires-Dist: tifffile ; extra == 'full_no_cuda'
|
171
171
|
Requires-Dist: hdf5plugin ; extra == 'full_no_cuda'
|
172
172
|
Requires-Dist: pyicat-plus ; extra == 'full_no_cuda'
|
173
|
-
Requires-Dist: nabu >=2023.3.
|
173
|
+
Requires-Dist: nabu >=2023.3.1dev ; extra == 'full_no_cuda'
|
174
174
|
Provides-Extra: full_no_nabu
|
175
175
|
Requires-Dist: orange-canvas-core ; extra == 'full_no_nabu'
|
176
176
|
Requires-Dist: orange-widget-base ; extra == 'full_no_nabu'
|
@@ -194,7 +194,7 @@ Requires-Dist: setuptools ; extra == 'setup_requires'
|
|
194
194
|
Requires-Dist: numpy >=1.12 ; extra == 'setup_requires'
|
195
195
|
Provides-Extra: test
|
196
196
|
Requires-Dist: pytest-asyncio ; extra == 'test'
|
197
|
-
Requires-Dist: tomoscan[test] >=2.0.
|
197
|
+
Requires-Dist: tomoscan[test] >=2.0.2rc17 ; extra == 'test'
|
198
198
|
|
199
199
|
tomwer
|
200
200
|
======
|