tomwer 1.0.3__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orangecontrib/tomwer/tutorials/EBS_tomo_listener.ows +39 -0
- orangecontrib/tomwer/tutorials/cast_volume.ows +34 -0
- orangecontrib/tomwer/tutorials/simple_slice_reconstruction.ows +39 -0
- orangecontrib/tomwer/tutorials/simple_volume_local_reconstruction.ows +49 -0
- orangecontrib/tomwer/tutorials/simple_volume_to_slurm_reconstruction.ows +59 -0
- orangecontrib/tomwer/tutorials/using_saaxis_to_find_cor.ows +44 -0
- orangecontrib/tomwer/widgets/cluster/FutureSupervisorOW.py +1 -1
- orangecontrib/tomwer/widgets/cluster/SlurmClusterOW.py +14 -4
- orangecontrib/tomwer/widgets/cluster/__init__.py +1 -1
- orangecontrib/tomwer/widgets/control/DataListOW.py +12 -5
- orangecontrib/tomwer/widgets/control/DataListenerOW.py +18 -9
- orangecontrib/tomwer/widgets/control/DataSelectorOW.py +13 -6
- orangecontrib/tomwer/widgets/control/DataTransfertOW.py +3 -5
- orangecontrib/tomwer/widgets/control/DataValidatorOW.py +8 -4
- orangecontrib/tomwer/widgets/control/DataWatcherOW.py +4 -6
- orangecontrib/tomwer/widgets/control/EDF2NXTomomillOW.py +49 -62
- orangecontrib/tomwer/widgets/control/FilterOW.py +2 -4
- orangecontrib/tomwer/widgets/control/NXTomomillMixIn.py +93 -0
- orangecontrib/tomwer/widgets/control/NXTomomillOW.py +135 -129
- orangecontrib/tomwer/widgets/control/NotifierOW.py +34 -9
- orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +3 -5
- orangecontrib/tomwer/widgets/control/TomoObjSerieOW.py +19 -13
- orangecontrib/tomwer/widgets/control/VolumeSelector.py +12 -4
- orangecontrib/tomwer/widgets/control/VolumeSymLinkOW.py +11 -7
- orangecontrib/tomwer/widgets/control/icons/notification.svg +4 -4
- orangecontrib/tomwer/widgets/control/icons/nxtomomill.png +0 -0
- orangecontrib/tomwer/widgets/control/icons/nxtomomill.svg +8 -5
- orangecontrib/tomwer/widgets/control/icons/tomoobjserie.png +0 -0
- orangecontrib/tomwer/widgets/control/icons/tomoobjserie.svg +73 -78
- orangecontrib/tomwer/widgets/edit/DarkFlatPatchOW.py +16 -4
- orangecontrib/tomwer/widgets/edit/NXtomoEditorOW.py +100 -0
- orangecontrib/tomwer/widgets/edit/icons/image_key_editor.png +0 -0
- orangecontrib/tomwer/widgets/edit/icons/image_key_upgrader.png +0 -0
- orangecontrib/tomwer/widgets/edit/icons/nx_tomo_editor.png +0 -0
- orangecontrib/tomwer/widgets/edit/icons/nx_tomo_editor.svg +123 -0
- orangecontrib/tomwer/widgets/edit/test/test_dark_flat_patch.py +21 -1
- orangecontrib/tomwer/widgets/edit/test/test_image_key_editor.py +1 -1
- orangecontrib/tomwer/widgets/edit/test/test_image_key_upgrader.py +1 -1
- orangecontrib/tomwer/widgets/edit/test/test_nxtomo_editor.py +25 -0
- orangecontrib/tomwer/widgets/other/PythonScriptOW.py +19 -11
- orangecontrib/tomwer/widgets/reconstruction/AxisOW.py +20 -14
- orangecontrib/tomwer/widgets/reconstruction/CastNabuVolumeOW.py +24 -10
- orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +26 -21
- orangecontrib/tomwer/widgets/reconstruction/NabuOW.py +29 -12
- orangecontrib/tomwer/widgets/reconstruction/NabuVolumeOW.py +44 -17
- orangecontrib/tomwer/widgets/reconstruction/SAAxisOW.py +28 -20
- orangecontrib/tomwer/widgets/reconstruction/SADeltaBetaOW.py +24 -18
- orangecontrib/tomwer/widgets/reconstruction/SinoNormOW.py +6 -6
- orangecontrib/tomwer/widgets/reconstruction/TofuOW.py +4 -2
- orangecontrib/tomwer/widgets/reconstruction/icons/nabu_2d.png +0 -0
- orangecontrib/tomwer/widgets/reconstruction/icons/nabu_2d.svg +11 -8
- orangecontrib/tomwer/widgets/visualization/DataViewerOW.py +10 -4
- orangecontrib/tomwer/widgets/visualization/DiffViewerOW.py +1 -1
- orangecontrib/tomwer/widgets/visualization/NXtomoMetadataViewerOW.py +69 -0
- orangecontrib/tomwer/widgets/visualization/SampleMovedOW.py +2 -4
- orangecontrib/tomwer/widgets/visualization/icons/nx_tomo_metadata_viewer.png +0 -0
- orangecontrib/tomwer/widgets/visualization/icons/nx_tomo_metadata_viewer.svg +105 -0
- tomwer/__main__.py +10 -5
- tomwer/app/canvas_launcher/config.py +10 -10
- tomwer/app/canvas_launcher/mainwindow.py +68 -6
- tomwer/app/canvas_launcher/widgetsscheme.py +1 -3
- tomwer/app/darkref.py +16 -12
- tomwer/app/imagekeyeditor.py +2 -2
- tomwer/app/imagekeyupgrader.py +104 -0
- tomwer/app/intensitynormalization.py +0 -1
- tomwer/app/nxtomoeditor.py +103 -0
- tomwer/app/rsync.py +1 -1
- tomwer/core/cluster/cluster.py +1 -1
- tomwer/core/futureobject.py +1 -0
- tomwer/core/process/control/datalistener/datalistener.py +7 -1
- tomwer/core/process/control/datalistener/rpcserver.py +3 -4
- tomwer/core/process/control/datawatcher/datawatcher.py +18 -18
- tomwer/core/process/control/datawatcher/datawatcherobserver.py +5 -8
- tomwer/core/process/control/datawatcher/datawatcherprocess.py +2 -3
- tomwer/core/process/control/datawatcher/edfdwprocess.py +2 -2
- tomwer/core/process/control/nxtomomill.py +33 -58
- tomwer/core/process/control/scanlist.py +2 -1
- tomwer/core/process/control/scanselector.py +7 -0
- tomwer/core/process/control/scantransfer.py +2 -2
- tomwer/core/process/control/scanvalidator.py +6 -5
- tomwer/core/process/control/singletomoobj.py +2 -1
- tomwer/core/process/control/timer.py +2 -1
- tomwer/core/process/control/tomoobjserie.py +8 -2
- tomwer/core/process/control/volumeselector.py +2 -1
- tomwer/core/process/control/volumesymlink.py +2 -1
- tomwer/core/process/edit/darkflatpatch.py +2 -1
- tomwer/core/process/edit/imagekeyeditor.py +4 -3
- tomwer/core/process/reconstruction/axis/axis.py +29 -32
- tomwer/core/process/reconstruction/axis/mode.py +3 -2
- tomwer/core/process/reconstruction/axis/params.py +35 -16
- tomwer/core/process/reconstruction/darkref/darkrefs.py +90 -707
- tomwer/core/process/reconstruction/darkref/darkrefscopy.py +44 -16
- tomwer/core/process/reconstruction/darkref/params.py +62 -67
- tomwer/core/process/reconstruction/lamino/tofu.py +1 -2
- tomwer/core/process/reconstruction/nabu/castvolume.py +21 -26
- tomwer/core/process/reconstruction/nabu/nabucommon.py +36 -38
- tomwer/core/process/reconstruction/nabu/nabuscores.py +28 -13
- tomwer/core/process/reconstruction/nabu/nabuslices.py +41 -14
- tomwer/core/process/reconstruction/nabu/nabuvolume.py +21 -12
- tomwer/core/process/reconstruction/nabu/utils.py +32 -3
- tomwer/core/process/reconstruction/normalization/normalization.py +9 -8
- tomwer/core/process/reconstruction/saaxis/saaxis.py +46 -20
- tomwer/core/process/reconstruction/sadeltabeta/sadeltabeta.py +38 -12
- tomwer/core/process/reconstruction/test/__init__.py +0 -39
- tomwer/core/process/reconstruction/test/test_axis_params.py +25 -3
- tomwer/core/process/reconstruction/test/test_darkref_copy.py +117 -1
- tomwer/core/process/script/python.py +16 -12
- tomwer/core/process/task.py +3 -7
- tomwer/core/process/test/test_axis.py +1 -1
- tomwer/core/process/test/test_dark_and_flat.py +41 -111
- tomwer/core/process/test/test_data_listener.py +0 -29
- tomwer/core/process/test/test_data_transfer.py +10 -14
- tomwer/core/process/test/test_nabu.py +1 -1
- tomwer/core/process/test/test_normalization.py +1 -1
- tomwer/core/process/visualization/liveslice.py +6 -0
- tomwer/core/scan/blissscan.py +37 -2
- tomwer/core/scan/edfscan.py +19 -8
- tomwer/core/scan/hdf5scan.py +10 -4
- tomwer/core/scan/scanbase.py +35 -29
- tomwer/core/scan/scanfactory.py +3 -17
- tomwer/core/scan/test/test_h5.py +1 -1
- tomwer/core/scan/test/test_process_registration.py +0 -11
- tomwer/core/scan/test/test_scan.py +32 -30
- tomwer/core/settings.py +2 -2
- tomwer/core/test/test_utils.py +1 -1
- tomwer/core/tomwer_object.py +19 -0
- tomwer/core/utils/__init__.py +0 -45
- tomwer/core/utils/char.py +2 -0
- tomwer/core/utils/gpu.py +5 -5
- tomwer/core/utils/nxtomoutils.py +2 -2
- tomwer/core/utils/scanutils.py +50 -0
- tomwer/core/utils/volumeutils.py +13 -0
- tomwer/core/volume/edfvolume.py +4 -0
- tomwer/core/volume/hdf5volume.py +4 -0
- tomwer/core/volume/jp2kvolume.py +4 -0
- tomwer/core/volume/rawvolume.py +22 -5
- tomwer/core/volume/tiffvolume.py +4 -0
- tomwer/core/volume/volumebase.py +19 -12
- tomwer/core/volume/volumefactory.py +20 -1
- tomwer/gui/cluster/slurm.py +1 -1
- tomwer/gui/cluster/supervisor.py +0 -2
- tomwer/gui/cluster/test/test_cluster.py +2 -2
- tomwer/gui/control/datalist.py +109 -36
- tomwer/gui/control/datatransfert.py +1 -1
- tomwer/gui/control/datawatcher/configuration.py +0 -2
- tomwer/gui/control/datawatcher/datawatcher.py +23 -13
- tomwer/gui/control/datawatcher/datawatcherobserver.py +1 -1
- tomwer/gui/control/observations.py +0 -3
- tomwer/gui/control/selectorwidgetbase.py +42 -12
- tomwer/gui/control/serie/seriecreator.py +967 -0
- tomwer/{web/__init__.py → gui/control/serie/seriewaiter.py} +5 -7
- tomwer/gui/control/singletomoobj.py +15 -4
- tomwer/gui/control/test/test_datalist.py +1 -1
- tomwer/gui/control/test/test_datalistener.py +1 -1
- tomwer/gui/control/test/test_inputwidget.py +1 -1
- tomwer/gui/control/test/test_process_manager.py +1 -13
- tomwer/gui/control/test/test_scanselector.py +1 -1
- tomwer/gui/control/test/test_scanvalidator.py +1 -1
- tomwer/gui/control/test/test_single_tomo_obj.py +1 -1
- tomwer/gui/control/test/test_volume_dialog.py +19 -7
- tomwer/gui/control/test/test_volumeselector.py +4 -4
- tomwer/gui/debugtools/datasetgenerator.py +1 -9
- tomwer/gui/edit/dkrfpatch.py +2 -3
- tomwer/gui/edit/imagekeyeditor.py +12 -11
- tomwer/gui/edit/nxtomoeditor.py +475 -0
- tomwer/gui/edit/test/test_dkrf_patch.py +2 -14
- tomwer/gui/edit/test/test_image_key_editor.py +2 -2
- tomwer/gui/edit/test/test_nx_editor.py +155 -0
- tomwer/gui/icons.py +0 -1
- tomwer/gui/qfolderdialog.py +11 -0
- tomwer/gui/reconstruction/axis/CompareImages.py +27 -29
- tomwer/gui/reconstruction/axis/axis.py +2 -0
- tomwer/gui/reconstruction/axis/radioaxis.py +70 -14
- tomwer/gui/reconstruction/darkref/darkrefcopywidget.py +7 -9
- tomwer/gui/reconstruction/darkref/darkrefwidget.py +22 -24
- tomwer/gui/reconstruction/lamino/tofu/projections.py +1 -1
- tomwer/gui/reconstruction/lamino/tofu/tofu.py +3 -3
- tomwer/gui/reconstruction/lamino/tofu/tofuexpert.py +4 -4
- tomwer/gui/reconstruction/lamino/tofu/tofuoutput.py +10 -5
- tomwer/gui/reconstruction/nabu/castvolume.py +103 -24
- tomwer/gui/reconstruction/nabu/check.py +1 -1
- tomwer/gui/reconstruction/nabu/nabuconfig/ctf.py +352 -0
- tomwer/gui/reconstruction/nabu/nabuconfig/nabuconfig.py +0 -9
- tomwer/gui/reconstruction/nabu/nabuconfig/output.py +1 -1
- tomwer/gui/reconstruction/nabu/nabuconfig/phase.py +18 -19
- tomwer/gui/reconstruction/nabu/nabuconfig/preprocessing.py +30 -7
- tomwer/gui/reconstruction/nabu/nabuconfig/reconstruction.py +26 -15
- tomwer/gui/reconstruction/nabu/slices.py +10 -4
- tomwer/gui/reconstruction/nabu/slurm.py +1 -1
- tomwer/gui/reconstruction/nabu/volume.py +13 -7
- tomwer/gui/reconstruction/normalization/intensity.py +1 -5
- tomwer/gui/reconstruction/saaxis/corrangeselector.py +10 -37
- tomwer/gui/reconstruction/saaxis/saaxis.py +11 -7
- tomwer/gui/reconstruction/saaxis/sliceselector.py +11 -26
- tomwer/gui/reconstruction/sadeltabeta/saadeltabeta.py +13 -8
- tomwer/gui/reconstruction/scores/scoreplot.py +67 -62
- tomwer/gui/reconstruction/test/test_axis.py +2 -2
- tomwer/gui/reconstruction/test/test_lamino.py +2 -2
- tomwer/gui/reconstruction/test/test_nabu.py +14 -1
- tomwer/gui/reconstruction/test/test_saaxis.py +8 -17
- tomwer/gui/reconstruction/test/test_sadeltabeta.py +7 -13
- tomwer/gui/stackplot.py +11 -28
- tomwer/gui/test/test_axis_gui.py +4 -4
- tomwer/gui/test/test_qfolder_dialog.py +12 -0
- tomwer/gui/utils/inputwidget.py +42 -22
- tomwer/gui/utils/lineselector/lineselector.py +13 -21
- tomwer/gui/utils/scandescription.py +2 -4
- tomwer/gui/utils/slider.py +1 -102
- tomwer/gui/utils/unitsystem.py +48 -11
- tomwer/gui/visualization/dataviewer.py +24 -17
- tomwer/gui/visualization/diffviewer/diffviewer.py +2 -11
- tomwer/gui/visualization/nxtomometadata.py +21 -0
- tomwer/gui/visualization/scanoverview.py +0 -1
- tomwer/gui/visualization/test/test_nx_tomo_metadata_viewer.py +72 -0
- tomwer/gui/visualization/test/test_stacks.py +1 -1
- tomwer/gui/visualization/tomoobjoverview.py +49 -0
- tomwer/gui/visualization/volumeoverview.py +64 -0
- tomwer/gui/visualization/volumeviewer.py +1 -1
- tomwer/io/utils/utils.py +2 -2
- tomwer/resources/gui/icons/multi-document-save.png +0 -0
- tomwer/resources/gui/icons/multi-document-save.svg +101 -0
- tomwer/resources/gui/illustrations/ctf_z1.png +0 -0
- tomwer/resources/gui/illustrations/ctf_z1.svg +471 -0
- tomwer/synctools/axis.py +0 -1
- tomwer/synctools/darkref.py +0 -1
- tomwer/synctools/datalistener.py +5 -1
- tomwer/synctools/imageloaderthread.py +2 -2
- tomwer/synctools/saaxis.py +0 -1
- tomwer/synctools/sadeltabeta.py +0 -1
- tomwer/synctools/stacks/edit/imagekeyeditor.py +1 -1
- tomwer/synctools/stacks/processingstack.py +2 -2
- tomwer/synctools/stacks/reconstruction/castvolume.py +1 -0
- tomwer/synctools/stacks/reconstruction/dkrefcopy.py +1 -1
- tomwer/synctools/stacks/reconstruction/lamino.py +1 -3
- tomwer/synctools/stacks/reconstruction/sadeltabeta.py +0 -2
- tomwer/synctools/test/test_darkRefs.py +32 -149
- tomwer/synctools/test/test_foldertransfer.py +1 -1
- tomwer/synctools/test/test_scanstages.py +2 -2
- tomwer/tests/conftest.py +51 -0
- tomwer/{test → tests}/test_scripts.py +1 -1
- tomwer/tests/test_utils.py +10 -0
- tomwer/{test → tests}/utils/utilstest.py +0 -11
- tomwer/version.py +3 -3
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/METADATA +14 -16
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/RECORD +255 -235
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/WHEEL +1 -1
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/entry_points.txt +6 -0
- orangecontrib/tomwer/setup.py +0 -45
- orangecontrib/tomwer/widgets/setup.py +0 -49
- tomwer/app/process.py +0 -153
- tomwer/core/process/reconstruction/nabu/slurm.py +0 -36
- tomwer/core/process/reconstruction/utils/nabu_slice_exec.py +0 -10
- tomwer/core/utils/laminoutils.py +0 -80
- tomwer/gui/utils/lineselector/lineselection.py +0 -76
- tomwer/setup.py +0 -52
- tomwer/slurm/executor.py +0 -36
- tomwer/slurm/job.py +0 -349
- tomwer/slurm/utils.py +0 -44
- tomwer/web/client.py +0 -43
- tomwer/web/config.py +0 -36
- tomwer/web/test/test_graylog_connection.py +0 -59
- {tomwer/slurm → orangecontrib/tomwer/tutorials}/__init__.py +0 -0
- /tomwer/{test → gui/control/serie}/__init__.py +0 -0
- /tomwer/{web/test → tests}/__init__.py +0 -0
- /tomwer/{test → tests}/utils/__init__.py +0 -0
- /tomwer-1.0.3-py3.8-nspkg.pth → /tomwer-1.1.0-py3.9-nspkg.pth +0 -0
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/LICENSE +0 -0
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/namespace_packages.txt +0 -0
- {tomwer-1.0.3.dist-info → tomwer-1.1.0.dist-info}/top_level.txt +0 -0
@@ -36,18 +36,28 @@ from processview.core.manager.manager import ProcessManager
|
|
36
36
|
|
37
37
|
from tomwer.core.futureobject import FutureTomwerObject
|
38
38
|
from tomwer.core.utils.slurm import is_slurm_available
|
39
|
+
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
39
40
|
|
40
41
|
try:
|
41
|
-
from nabu.pipeline.fullfield.
|
42
|
-
|
42
|
+
from nabu.pipeline.fullfield.reconstruction import ( # noqa F401
|
43
|
+
FullFieldReconstructor,
|
43
44
|
)
|
44
45
|
except (ImportError, OSError) as e:
|
45
|
-
# import of cufft library can bring an OSError if cuda not install
|
46
|
-
has_nabu = False
|
47
46
|
_err_import_nabu = e
|
47
|
+
try:
|
48
|
+
from nabu.pipeline.fullfield.local_reconstruction import ( # noqa F401
|
49
|
+
ChunkedReconstructor,
|
50
|
+
)
|
51
|
+
except (ImportError, OSError):
|
52
|
+
# import of cufft library can bring an OSError if cuda not install
|
53
|
+
has_nabu = False
|
54
|
+
else:
|
55
|
+
has_nabu = True
|
56
|
+
_err_import_nabu = None
|
48
57
|
else:
|
49
58
|
has_nabu = True
|
50
59
|
_err_import_nabu = None
|
60
|
+
|
51
61
|
from silx.utils.enum import Enum as _Enum
|
52
62
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
53
63
|
from tomwer.core.scan.hdf5scan import HDF5TomoScan
|
@@ -128,6 +138,9 @@ def run_slices_reconstruction(
|
|
128
138
|
"job on cluster requested but no access to slurm cluster found"
|
129
139
|
)
|
130
140
|
|
141
|
+
# beam shape is not directly used by nabu (uses ctf_geometry directly)
|
142
|
+
config.get("phase", {}).pop("beam_shape", None)
|
143
|
+
|
131
144
|
# if scan contains some center of position copy it to nabu
|
132
145
|
if scan.axis_params is not None and scan.axis_params.relative_cor_value is not None:
|
133
146
|
if "reconstruction" in config:
|
@@ -258,7 +271,7 @@ class NabuSlices(
|
|
258
271
|
self._dry_run = inputs.get("dry_run", False)
|
259
272
|
|
260
273
|
def run(self):
|
261
|
-
scan = self.inputs.data
|
274
|
+
scan = data_identifier_to_scan(self.inputs.data)
|
262
275
|
self.outputs.nabu_params = None
|
263
276
|
if scan is None:
|
264
277
|
self.outputs.data = None
|
@@ -298,9 +311,6 @@ class NabuSlices(
|
|
298
311
|
if "dry_run" in configuration:
|
299
312
|
self.set_dry_run(bool(configuration["dry_run"]))
|
300
313
|
|
301
|
-
def pathReceived(self, scan):
|
302
|
-
return self.process(scan=scan)
|
303
|
-
|
304
314
|
# TODO: those get / set configuration should be removed now that Task is used
|
305
315
|
def get_configuration(self):
|
306
316
|
return self._settings
|
@@ -423,9 +433,9 @@ def interpret_tomwer_configuration(
|
|
423
433
|
slices = []
|
424
434
|
|
425
435
|
if "phase" in config and "delta_beta" in config["phase"]:
|
426
|
-
pag_dbs =
|
427
|
-
|
428
|
-
|
436
|
+
pag_dbs = config["phase"]["delta_beta"]
|
437
|
+
if isinstance(pag_dbs, str):
|
438
|
+
pag_dbs = utils.retrieve_lst_of_value_from_str(pag_dbs, type_=float)
|
429
439
|
if len(pag_dbs) == 0:
|
430
440
|
pag_dbs = (None,)
|
431
441
|
else:
|
@@ -511,6 +521,11 @@ class SingleSliceRunner(_NabuBaseReconstructor):
|
|
511
521
|
raise ValueError(
|
512
522
|
f"slice index is expected to an int or 'middle' and not {type(self.slice_index)}"
|
513
523
|
)
|
524
|
+
elif (
|
525
|
+
isinstance(self.slice_index, float)
|
526
|
+
and int(self.slice_index) == self.slice_index
|
527
|
+
):
|
528
|
+
self._slice_index = int(self.slice_index)
|
514
529
|
elif not isinstance(self.slice_index, (int, type(None))):
|
515
530
|
raise TypeError(
|
516
531
|
f"slice index is expected to an int or 'middle' or None and not {type(self.slice_index)}"
|
@@ -628,7 +643,9 @@ class SingleSliceRunner(_NabuBaseReconstructor):
|
|
628
643
|
return super()._get_futures_slurm_callback(config_to_dump)
|
629
644
|
|
630
645
|
@staticmethod
|
631
|
-
def get_file_basename_reconstruction(
|
646
|
+
def get_file_basename_reconstruction(
|
647
|
+
scan, pag, ctf, db, slice_index: Union[str, int]
|
648
|
+
):
|
632
649
|
if pag:
|
633
650
|
assert db is not None, "if paganin defined, db should not be None"
|
634
651
|
if slice_index == "middle":
|
@@ -642,6 +659,8 @@ class SingleSliceRunner(_NabuBaseReconstructor):
|
|
642
659
|
if slice_index is None:
|
643
660
|
if pag:
|
644
661
|
return "_".join((basename + "pag", "db" + str(db).zfill(4)))
|
662
|
+
elif ctf:
|
663
|
+
return "_".join((basename + "ctf", "db" + str(db).zfill(4)))
|
645
664
|
else:
|
646
665
|
return basename
|
647
666
|
else:
|
@@ -653,11 +672,19 @@ class SingleSliceRunner(_NabuBaseReconstructor):
|
|
653
672
|
"db" + str(db).zfill(4),
|
654
673
|
)
|
655
674
|
)
|
675
|
+
elif ctf:
|
676
|
+
return "_".join(
|
677
|
+
(
|
678
|
+
basename + "slice_ctf",
|
679
|
+
str(slice_index).zfill(4),
|
680
|
+
"db" + str(db).zfill(4),
|
681
|
+
)
|
682
|
+
)
|
656
683
|
else:
|
657
684
|
return "_".join((basename + "slice", str(slice_index).zfill(4)))
|
658
685
|
|
659
686
|
@docstring(_NabuBaseReconstructor)
|
660
|
-
def _get_file_basename_reconstruction(self, pag, db):
|
687
|
+
def _get_file_basename_reconstruction(self, pag, db, ctf):
|
661
688
|
"""
|
662
689
|
|
663
690
|
:param TomwerScanBase scan: scan reconstructed
|
@@ -669,7 +696,7 @@ class SingleSliceRunner(_NabuBaseReconstructor):
|
|
669
696
|
:return: basename of the file reconstructed (without any extension)
|
670
697
|
"""
|
671
698
|
return self.get_file_basename_reconstruction(
|
672
|
-
scan=self.scan, db=db, pag=pag, slice_index=self.slice_index
|
699
|
+
scan=self.scan, db=db, pag=pag, slice_index=self.slice_index, ctf=ctf
|
673
700
|
)
|
674
701
|
|
675
702
|
|
@@ -36,6 +36,7 @@ from tomwer.core.futureobject import FutureTomwerObject
|
|
36
36
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
37
37
|
from tomwer.core.scan.hdf5scan import HDF5TomoScan
|
38
38
|
from tomwer.core.scan.scanfactory import ScanFactory
|
39
|
+
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
39
40
|
from . import utils
|
40
41
|
from . import settings
|
41
42
|
from nabu.pipeline.config import generate_nabu_configfile
|
@@ -94,15 +95,18 @@ def run_volume_reconstruction(
|
|
94
95
|
else:
|
95
96
|
target = Target.SLURM
|
96
97
|
|
98
|
+
# beam shape is not directly used by nabu (uses ctf_geometry directly)
|
99
|
+
config.get("phase", {}).pop("beam_shape", None)
|
100
|
+
|
97
101
|
config_volume = copy.copy(config)
|
98
102
|
config_nabu_slices = copy.deepcopy(scan.nabu_recons_params)
|
99
103
|
if "tomwer_slices" in config_nabu_slices:
|
100
104
|
del config_nabu_slices["tomwer_slices"]
|
101
105
|
|
102
106
|
if "phase" in config_nabu_slices and "delta_beta" in config_nabu_slices["phase"]:
|
103
|
-
pag_dbs =
|
104
|
-
|
105
|
-
|
107
|
+
pag_dbs = config_nabu_slices["phase"]["delta_beta"]
|
108
|
+
if isinstance(pag_dbs, str):
|
109
|
+
pag_dbs = utils.retrieve_lst_of_value_from_str(pag_dbs, type_=float)
|
106
110
|
if len(pag_dbs) > 1:
|
107
111
|
raise ValueError(
|
108
112
|
"Several value of delta / beta found for volume reconstruction"
|
@@ -336,7 +340,7 @@ class VolumeRunner(_NabuBaseReconstructor):
|
|
336
340
|
return config_s, extra_opts
|
337
341
|
|
338
342
|
@docstring(_NabuBaseReconstructor)
|
339
|
-
def _get_file_basename_reconstruction(self, pag, db):
|
343
|
+
def _get_file_basename_reconstruction(self, pag, db, ctf):
|
340
344
|
"""
|
341
345
|
|
342
346
|
:param TomwerScanBase scan: scan reconstructed
|
@@ -348,6 +352,7 @@ class VolumeRunner(_NabuBaseReconstructor):
|
|
348
352
|
:return: basename of the file reconstructed (without any extension)
|
349
353
|
"""
|
350
354
|
assert type(db) in (int, type(None))
|
355
|
+
assert not pag == ctf == True, "cannot ask for both pag and ctf active"
|
351
356
|
if isinstance(self.scan, HDF5TomoScan):
|
352
357
|
basename, _ = os.path.splitext(self.scan.master_file)
|
353
358
|
basename = os.path.basename(basename)
|
@@ -355,14 +360,19 @@ class VolumeRunner(_NabuBaseReconstructor):
|
|
355
360
|
basename = os.path.basename(self.scan.path)
|
356
361
|
if pag:
|
357
362
|
return "_".join((basename + "pag", "db" + str(db).zfill(4), "vol"))
|
363
|
+
elif ctf:
|
364
|
+
return "_".join((basename + "ctf", "db" + str(db).zfill(4), "vol"))
|
358
365
|
else:
|
359
366
|
return "_".join((basename, "vol"))
|
360
367
|
|
361
368
|
|
362
369
|
class NabuVolume(
|
363
370
|
Task,
|
364
|
-
input_names=("data",
|
365
|
-
optional_input_names=(
|
371
|
+
input_names=("data",),
|
372
|
+
optional_input_names=(
|
373
|
+
"nabu_params",
|
374
|
+
"nabu_volume_params",
|
375
|
+
),
|
366
376
|
output_names=("data", "volumes"),
|
367
377
|
):
|
368
378
|
def __init__(
|
@@ -379,12 +389,13 @@ class NabuVolume(
|
|
379
389
|
self._dry_run = inputs.get("dry_run", False)
|
380
390
|
|
381
391
|
def run(self):
|
382
|
-
scan = self.inputs.data
|
383
|
-
if self.inputs.nabu_params is None:
|
384
|
-
raise ValueError("nabu params should be provided")
|
392
|
+
scan = data_identifier_to_scan(self.inputs.data)
|
385
393
|
if scan is None:
|
386
394
|
self.outputs.data = None
|
387
395
|
return
|
396
|
+
nabu_params = self.inputs.nabu_params
|
397
|
+
if nabu_params is None:
|
398
|
+
nabu_params = scan.nabu_params
|
388
399
|
if isinstance(scan, TomwerScanBase):
|
389
400
|
scan = scan
|
390
401
|
elif isinstance(scan, dict):
|
@@ -398,6 +409,7 @@ class NabuVolume(
|
|
398
409
|
'registered. Did you process "Nabu slices" '
|
399
410
|
"already ?"
|
400
411
|
)
|
412
|
+
print("configuration params to be used are", scan.nabu_recons_params)
|
401
413
|
|
402
414
|
run_volume_reconstruction(
|
403
415
|
scan=scan,
|
@@ -440,9 +452,6 @@ class NabuVolume(
|
|
440
452
|
def dry_run(self):
|
441
453
|
return self._dry_run
|
442
454
|
|
443
|
-
def pathReceived(self, scan):
|
444
|
-
return self.process(scan=scan)
|
445
|
-
|
446
455
|
@staticmethod
|
447
456
|
def retrieve_last_relative_cor(scan):
|
448
457
|
with EntryReader(scan.process_file_url) as h5f:
|
@@ -78,7 +78,10 @@ def retrieve_lst_of_value_from_str(my_string: str, type_) -> tuple:
|
|
78
78
|
:param str mystring:
|
79
79
|
:return: list of single value
|
80
80
|
"""
|
81
|
-
|
81
|
+
if not isinstance(my_string, str):
|
82
|
+
raise TypeError(
|
83
|
+
f"my_string is expected to be a string. {type(my_string)} provided"
|
84
|
+
)
|
82
85
|
res = []
|
83
86
|
my_string = my_string.replace("(", "")
|
84
87
|
my_string = my_string.replace(")", "")
|
@@ -177,7 +180,20 @@ def get_recons_volume_identifier(
|
|
177
180
|
file_name = "_".join((file_prefix, str(slice_index).zfill(4)))
|
178
181
|
else:
|
179
182
|
file_name = file_prefix
|
180
|
-
|
183
|
+
# on 2022.3.x the location seems invalid for nabu. Add this second location to
|
184
|
+
# handle most of the case.
|
185
|
+
fix_nabu = os.path.join(file_prefix, file_name)
|
186
|
+
|
187
|
+
file_name = ".".join((file_name, file_format))
|
188
|
+
file_path = os.path.join(location, file_name)
|
189
|
+
|
190
|
+
file_name_fix_nabu = ".".join((fix_nabu, file_format))
|
191
|
+
file_path_fix_nabu = os.path.join(location, file_name_fix_nabu)
|
192
|
+
|
193
|
+
volumes = (
|
194
|
+
RawVolume(file_path=file_path_fix_nabu),
|
195
|
+
RawVolume(file_path=file_path),
|
196
|
+
)
|
181
197
|
elif file_format in ("jp2", "jp2k", "edf", "tiff"):
|
182
198
|
if file_format in ("jp2k", "jp2"):
|
183
199
|
constructor = JP2KVolume
|
@@ -347,12 +363,20 @@ class _NabuPhaseMethod(_Enum):
|
|
347
363
|
"""
|
348
364
|
|
349
365
|
PAGANIN = "Paganin"
|
366
|
+
CTF = "CTF"
|
350
367
|
NONE = "None"
|
351
368
|
|
352
369
|
@classmethod
|
353
370
|
def from_value(cls, value):
|
354
371
|
if value in (None, ""):
|
355
372
|
return _NabuPhaseMethod.NONE
|
373
|
+
elif isinstance(value, str):
|
374
|
+
if value.lower() == "paganin":
|
375
|
+
return _NabuPhaseMethod.PAGANIN
|
376
|
+
elif value.lower() == "none":
|
377
|
+
return _NabuPhaseMethod.NONE
|
378
|
+
elif value.lower() == "ctf":
|
379
|
+
return _NabuPhaseMethod.CTF
|
356
380
|
else:
|
357
381
|
return super().from_value(value=value)
|
358
382
|
|
@@ -386,7 +410,12 @@ def nabu_std_err_has_error(errs: typing.Optional[bytes]):
|
|
386
410
|
"""
|
387
411
|
|
388
412
|
def ignore(line) -> bool:
|
389
|
-
return
|
413
|
+
return (
|
414
|
+
"warning" in line
|
415
|
+
or "Warning" in line
|
416
|
+
or line.replace(" ", "") == ""
|
417
|
+
or "unable to load" in line
|
418
|
+
)
|
390
419
|
|
391
420
|
if errs is None:
|
392
421
|
return False
|
@@ -34,22 +34,23 @@ __license__ = "MIT"
|
|
34
34
|
__date__ = "25/06/2021"
|
35
35
|
|
36
36
|
|
37
|
+
import numpy
|
38
|
+
import logging
|
39
|
+
import functools
|
40
|
+
from silx.io.url import DataUrl
|
41
|
+
import tomwer.version
|
37
42
|
from tomwer.core.process.task import Task
|
43
|
+
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
38
44
|
from .params import (
|
39
45
|
SinoNormalizationParams,
|
40
46
|
_ValueCalculationFct,
|
41
47
|
_ValueSource,
|
42
48
|
)
|
43
49
|
from tomoscan.normalization import Method as NormMethod
|
44
|
-
from processview.core.superviseprocess import SuperviseProcess
|
45
|
-
from silx.io.url import DataUrl
|
46
|
-
from processview.core.dataset import DatasetIdentifier
|
47
50
|
import tomoscan.esrf.scan.utils
|
48
|
-
import tomwer.version
|
49
51
|
from tomoscan.esrf.scan.utils import get_data
|
50
|
-
import
|
51
|
-
import
|
52
|
-
import logging
|
52
|
+
from processview.core.dataset import DatasetIdentifier
|
53
|
+
from processview.core.superviseprocess import SuperviseProcess
|
53
54
|
|
54
55
|
|
55
56
|
_logger = logging.getLogger(__name__)
|
@@ -94,7 +95,7 @@ class SinoNormalizationTask(
|
|
94
95
|
self.set_properties(configuration)
|
95
96
|
|
96
97
|
def run(self):
|
97
|
-
scan = self.inputs.data
|
98
|
+
scan = data_identifier_to_scan(self.inputs.data)
|
98
99
|
if scan is None:
|
99
100
|
return
|
100
101
|
extra_infos = scan.intensity_normalization.get_extra_infos()
|
@@ -32,15 +32,26 @@ __license__ = "MIT"
|
|
32
32
|
__date__ = "10/02/2021"
|
33
33
|
|
34
34
|
|
35
|
+
import os
|
36
|
+
import copy
|
37
|
+
import h5py
|
38
|
+
import numpy
|
39
|
+
import logging
|
40
|
+
from typing import Iterable, Optional
|
35
41
|
from silx.io.url import DataUrl
|
42
|
+
from tomoscan.io import HDF5File
|
43
|
+
from processview.core.manager import ProcessManager, DatasetState
|
44
|
+
from processview.core.superviseprocess import SuperviseProcess
|
45
|
+
from nabu.pipeline.config import get_default_nabu_config
|
46
|
+
from nabu.pipeline.fullfield.nabu_config import (
|
47
|
+
nabu_config as nabu_fullfield_default_config,
|
48
|
+
)
|
36
49
|
from tomwer.core.scan.edfscan import EDFTomoScan
|
37
50
|
from tomwer.core.scan.scanfactory import ScanFactory
|
38
51
|
from tomwer.core.process.reconstruction.nabu.nabuslices import (
|
39
52
|
SingleSliceRunner,
|
40
53
|
interpret_tomwer_configuration,
|
41
54
|
)
|
42
|
-
from typing import Iterable, Optional
|
43
|
-
|
44
55
|
from tomwer.core.utils.slurm import is_slurm_available
|
45
56
|
from tomwer.core.volume.volumefactory import VolumeFactory
|
46
57
|
from tomwer.io.utils.utils import get_slice_data
|
@@ -50,25 +61,18 @@ from .params import ReconstructionMode
|
|
50
61
|
from .params import SAAxisParams
|
51
62
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
52
63
|
from tomwer.core.utils import logconfig
|
53
|
-
from processview.core.manager import ProcessManager, DatasetState
|
54
|
-
from processview.core.superviseprocess import SuperviseProcess
|
55
64
|
from tomwer.core.process.task import Task
|
56
65
|
from tomwer.core.scan.hdf5scan import HDF5TomoScan
|
57
|
-
from tomoscan.io import HDF5File
|
58
66
|
import tomwer.version
|
59
|
-
import numpy
|
60
67
|
from tomwer.core.progress import Progress
|
61
68
|
from tomwer.core.process.reconstruction.axis import AxisRP
|
62
|
-
import os
|
63
|
-
import logging
|
64
|
-
import copy
|
65
|
-
import h5py
|
66
69
|
from tomwer.core.process.reconstruction.scores import compute_score
|
67
70
|
from tomwer.core.process.reconstruction.scores import ComputedScore
|
68
71
|
from tomwer.core.process.reconstruction.scores import get_disk_mask_radius, apply_roi
|
69
72
|
from tomwer.core.process.reconstruction.nabu.nabuscores import (
|
70
73
|
run_nabu_one_slice_several_config,
|
71
74
|
)
|
75
|
+
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
72
76
|
|
73
77
|
|
74
78
|
_logger = logging.getLogger(__name__)
|
@@ -145,12 +149,16 @@ def one_slice_several_cor(
|
|
145
149
|
output_dir = os.path.join(scan.path, DEFAULT_RECONS_FOLDER)
|
146
150
|
|
147
151
|
db = None
|
148
|
-
pag =
|
152
|
+
pag = False
|
153
|
+
ctf = False
|
149
154
|
if "phase" in nabu_config:
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
155
|
+
phase_method = nabu_config["phase"].get("method", "").lower()
|
156
|
+
if phase_method in ("pag", "paganin"):
|
157
|
+
pag = True
|
158
|
+
elif phase_method in ("ctf",):
|
159
|
+
ctf = True
|
160
|
+
if "delta_beta" in nabu_config["phase"]:
|
161
|
+
db = round(float(nabu_config["phase"]["delta_beta"]))
|
154
162
|
|
155
163
|
for cor, future_tomo_obj in future_tomo_objs.items():
|
156
164
|
future_tomo_obj.results()
|
@@ -159,7 +167,11 @@ def one_slice_several_cor(
|
|
159
167
|
continue
|
160
168
|
else:
|
161
169
|
_file_name = SingleSliceRunner.get_file_basename_reconstruction(
|
162
|
-
scan=scan,
|
170
|
+
scan=scan,
|
171
|
+
slice_index=slice_index,
|
172
|
+
pag=pag,
|
173
|
+
db=db,
|
174
|
+
ctf=ctf,
|
163
175
|
)
|
164
176
|
file_prefix = "cor_{}_{}".format(_file_name, cor)
|
165
177
|
|
@@ -256,7 +268,7 @@ def one_slice_several_cor(
|
|
256
268
|
urls = tuple(volume.browse_data_urls())
|
257
269
|
if len(urls) != 1:
|
258
270
|
raise ValueError(
|
259
|
-
"volume is expected to have at most one url (single slice volume)"
|
271
|
+
f"volume is expected to have at most one url (single slice volume). get {len(urls)}"
|
260
272
|
)
|
261
273
|
url = urls[0]
|
262
274
|
if not isinstance(url, (DataUrl, str)):
|
@@ -463,7 +475,7 @@ class SAAxisProcess(
|
|
463
475
|
)
|
464
476
|
|
465
477
|
@staticmethod
|
466
|
-
def autofocus(scan):
|
478
|
+
def autofocus(scan) -> Optional[float]:
|
467
479
|
scores = scan.saaxis_params.scores
|
468
480
|
if scores is None:
|
469
481
|
return
|
@@ -482,9 +494,10 @@ class SAAxisProcess(
|
|
482
494
|
scan.axis_params = AxisRP()
|
483
495
|
scan.axis_params.frame_width = scan.dim_1
|
484
496
|
scan.axis_params.set_relative_value(best_cor)
|
497
|
+
return best_cor
|
485
498
|
|
486
499
|
def run(self):
|
487
|
-
scan = self.inputs.data
|
500
|
+
scan = data_identifier_to_scan(self.inputs.data)
|
488
501
|
if scan is None:
|
489
502
|
self.outputs.data = None
|
490
503
|
return
|
@@ -535,7 +548,20 @@ class SAAxisProcess(
|
|
535
548
|
process_id=self.process_id,
|
536
549
|
)
|
537
550
|
scan.saaxis_params.scores = cors_res
|
538
|
-
self.autofocus(scan=scan)
|
551
|
+
best_relative_cor = self.autofocus(scan=scan)
|
552
|
+
|
553
|
+
# store nabu settings to be used later like in the volume reconstruction
|
554
|
+
config = self.get_configuration()["nabu_params"]
|
555
|
+
# beam shape is not directly used by nabu (uses ctf_geometry directly)
|
556
|
+
config.get("phase", {}).pop("beam_shape", None)
|
557
|
+
|
558
|
+
# update nabu recons_params used
|
559
|
+
sc_config = get_default_nabu_config(nabu_fullfield_default_config)
|
560
|
+
sc_config.update(config)
|
561
|
+
scan.nabu_recons_params = sc_config
|
562
|
+
if best_relative_cor is not None:
|
563
|
+
scan.axis_params.relative_cor_values = best_relative_cor
|
564
|
+
|
539
565
|
self._process_end(scan=scan, cors_res=cors_res, score_rois=rois)
|
540
566
|
self.outputs.data = scan
|
541
567
|
|
@@ -32,7 +32,18 @@ __license__ = "MIT"
|
|
32
32
|
__date__ = "28/10/2021"
|
33
33
|
|
34
34
|
|
35
|
+
import os
|
36
|
+
import logging
|
37
|
+
import h5py
|
38
|
+
import numpy
|
35
39
|
from copy import copy
|
40
|
+
from typing import Optional, Union
|
41
|
+
from nabu.pipeline.config import get_default_nabu_config
|
42
|
+
from nabu.pipeline.fullfield.nabu_config import (
|
43
|
+
nabu_config as nabu_fullfield_default_config,
|
44
|
+
)
|
45
|
+
from processview.core.manager import ProcessManager, DatasetState
|
46
|
+
from processview.core.superviseprocess import SuperviseProcess
|
36
47
|
from tomwer.core.process.reconstruction.nabu.nabucommon import (
|
37
48
|
ResultSlurmRun,
|
38
49
|
ResultsLocalRun,
|
@@ -42,8 +53,6 @@ from tomwer.core.scan.scanfactory import ScanFactory
|
|
42
53
|
from .params import SADeltaBetaParams
|
43
54
|
from tomwer.core.scan.scanbase import TomwerScanBase
|
44
55
|
from tomwer.core.utils import logconfig
|
45
|
-
from processview.core.manager import ProcessManager, DatasetState
|
46
|
-
from processview.core.superviseprocess import SuperviseProcess
|
47
56
|
from tomwer.core.process.task import Task
|
48
57
|
from tomwer.core.scan.hdf5scan import HDF5TomoScan
|
49
58
|
from tomoscan.io import HDF5File
|
@@ -54,11 +63,6 @@ from tomwer.core.process.reconstruction.nabu.nabuslices import (
|
|
54
63
|
)
|
55
64
|
from tomwer.core.process.reconstruction.nabu.nabucommon import ResultsRun
|
56
65
|
from tomwer.core.progress import Progress
|
57
|
-
from typing import Optional, Union
|
58
|
-
import os
|
59
|
-
import logging
|
60
|
-
import h5py
|
61
|
-
import numpy
|
62
66
|
from ..nabu import utils as nabu_utils
|
63
67
|
from tomwer.core.process.reconstruction.scores import compute_score
|
64
68
|
from tomwer.core.process.reconstruction.scores import ScoreMethod
|
@@ -66,6 +70,7 @@ from tomwer.core.process.reconstruction.scores import ComputedScore
|
|
66
70
|
from tomwer.core.process.reconstruction.scores import get_disk_mask_radius, apply_roi
|
67
71
|
from tomwer.core.process.reconstruction.nabu.nabuslices import SingleSliceRunner
|
68
72
|
from tomwer.core.volume.volumefactory import VolumeFactory
|
73
|
+
from tomwer.core.utils.scanutils import data_identifier_to_scan
|
69
74
|
|
70
75
|
_logger = logging.getLogger(__name__)
|
71
76
|
|
@@ -156,7 +161,9 @@ def one_slice_several_db(
|
|
156
161
|
config["output"]["file_format"] = "hdf5"
|
157
162
|
if "phase" not in config:
|
158
163
|
config["phase"] = {}
|
159
|
-
config["phase"]["delta_beta"] =
|
164
|
+
config["phase"]["delta_beta"] = (
|
165
|
+
db,
|
166
|
+
) # warning: at this tage delta_beta expects a list of value
|
160
167
|
config["phase"]["method"] = "Paganin"
|
161
168
|
res = run_single_slice_reconstruction(
|
162
169
|
nabu_config=config,
|
@@ -185,9 +192,13 @@ def one_slice_several_db(
|
|
185
192
|
advancement.increaseAdvancement(1)
|
186
193
|
|
187
194
|
pag = False
|
195
|
+
ctf = False
|
188
196
|
if "phase" in config:
|
189
|
-
|
197
|
+
phase_method = config["phase"].get("method", "").lower()
|
198
|
+
if phase_method in ("pag", "paganin"):
|
190
199
|
pag = True
|
200
|
+
elif phase_method in ("ctf",):
|
201
|
+
ctf = True
|
191
202
|
|
192
203
|
# treat future.
|
193
204
|
for db, future_tomo_obj_list in future_tomo_objs.items():
|
@@ -203,6 +214,7 @@ def one_slice_several_db(
|
|
203
214
|
slice_index=slice_index,
|
204
215
|
pag=pag,
|
205
216
|
db=int(db) if db is not None else None,
|
217
|
+
ctf=ctf,
|
206
218
|
)
|
207
219
|
# retrieve url
|
208
220
|
volume_identifier = nabu_utils.get_recons_volume_identifier(
|
@@ -371,7 +383,7 @@ class SADeltaBetaProcess(
|
|
371
383
|
)
|
372
384
|
|
373
385
|
@staticmethod
|
374
|
-
def autofocus(scan):
|
386
|
+
def autofocus(scan) -> Optional[float]:
|
375
387
|
scores = scan.sa_delta_beta_params.scores
|
376
388
|
if scores is None:
|
377
389
|
return
|
@@ -387,9 +399,10 @@ class SADeltaBetaProcess(
|
|
387
399
|
best_db, best_score = cor, score
|
388
400
|
scan.sa_delta_beta_params.autofocus = best_db
|
389
401
|
scan.sa_delta_beta_params.value = best_db
|
402
|
+
return best_db
|
390
403
|
|
391
404
|
def run(self):
|
392
|
-
scan = self.inputs.data
|
405
|
+
scan = data_identifier_to_scan(self.inputs.data)
|
393
406
|
if scan is None:
|
394
407
|
self.outputs.data = scan
|
395
408
|
return
|
@@ -418,7 +431,20 @@ class SADeltaBetaProcess(
|
|
418
431
|
process_id=self.process_id,
|
419
432
|
)
|
420
433
|
scan.sa_delta_beta_params.scores = db_res
|
421
|
-
self.autofocus(scan=scan)
|
434
|
+
best_db = self.autofocus(scan=scan)
|
435
|
+
# store nabu recons parameters to be used within the nabu volume for example.
|
436
|
+
config = self.get_configuration()["nabu_params"]
|
437
|
+
# beam shape is not directly used by nabu (uses ctf_geometry directly)
|
438
|
+
config.get("phase", {}).pop("beam_shape", None)
|
439
|
+
sc_config = get_default_nabu_config(nabu_fullfield_default_config)
|
440
|
+
sc_config.update(config)
|
441
|
+
if best_db is not None:
|
442
|
+
sc_config["phase"]["delta_beta"] = (
|
443
|
+
best_db,
|
444
|
+
) # warning: at this tage delta_beta expects a list of value
|
445
|
+
scan.nabu_recons_params = sc_config
|
446
|
+
|
447
|
+
# end processing
|
422
448
|
self._process_end(scan=scan, db_res=db_res, score_rois=rois)
|
423
449
|
self.outputs.data = scan
|
424
450
|
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# /*##########################################################################
|
3
|
-
#
|
4
|
-
# Copyright (c) 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/08/2017"
|
29
|
-
|
30
|
-
import unittest
|
31
|
-
|
32
|
-
from . import test_saaxis
|
33
|
-
|
34
|
-
|
35
|
-
def suite():
|
36
|
-
test_suite = unittest.TestSuite()
|
37
|
-
test_suite.addTest(test_saaxis.suite())
|
38
|
-
|
39
|
-
return test_suite
|