Unverified Commit 6b96a586 authored by Henri Payno's avatar Henri Payno
Browse files

[h52nx] improve robustness when check if some parameter as already be defined

parent 7b21e382
......@@ -541,8 +541,15 @@ class StandardAcquisition(BaseAcquisition):
def _write_beam(self, root_node, request_input, input_callback):
instrument_node = root_node.require_group("instrument")
beam_node = instrument_node.require_group("beam")
if "energy" in self.configuration.param_already_defined:
energy = float(self.configuration.param_already_defined["energy"])
if (
TomoHDF5Config.EXTRA_PARAMS_ENERGY_DK
in self.configuration.param_already_defined
):
energy = float(
self.configuration.param_already_defined[
TomoHDF5Config.EXTRA_PARAMS_ENERGY_DK
]
)
unit = "kev"
else:
energy, unit = self._get_energy(
......@@ -583,9 +590,14 @@ class StandardAcquisition(BaseAcquisition):
# write x and y pixel size
# if magnified pixel size is found then we right this value.
# otherwise will take pixel size (if found)
if "x_pixel_size" in self.configuration.param_already_defined:
if (
TomoHDF5Config.EXTRA_PARAMS_X_PIXEL_SIZE_DK
in self.configuration.param_already_defined
):
x_pixel_size = float(
self.configuration.param_already_defined["x_pixel_size"]
self.configuration.param_already_defined[
TomoHDF5Config.EXTRA_PARAMS_X_PIXEL_SIZE_DK
]
)
unit = "m"
else:
......@@ -594,9 +606,14 @@ class StandardAcquisition(BaseAcquisition):
detector_node["x_pixel_size"] = x_pixel_size
detector_node["x_pixel_size"].attrs["unit"] = unit
if "y_pixel_size" in self.configuration.param_already_defined:
if (
TomoHDF5Config.EXTRA_PARAMS_Y_PIXEL_SIZE_DK
in self.configuration.param_already_defined
):
y_pixel_size = float(
self.configuration.param_already_defined["y_pixel_size"]
self.configuration.param_already_defined[
TomoHDF5Config.EXTRA_PARAMS_Y_PIXEL_SIZE_DK
]
)
unit = "m"
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment