Commit babb659d authored by payno's avatar payno
Browse files

[3d-xrd] fix converter from a rebase

parent ef5387bf
Pipeline #46701 passed with stages
in 4 minutes and 36 seconds
......@@ -181,6 +181,12 @@ def main(argv):
default=None,
help="z translation key in bliss HDF5 file",
)
parser.add_argument(
"--sample-detector-distance",
"--distance",
default=None,
help="sample detector distance",
)
parser.add_argument(
"--valid_camera_names",
"--valid-camera-names",
......
......@@ -590,7 +590,6 @@ class StandardAcquisition(BaseAcquisition):
detector_node["tomo_n"] = tomo_n
def _create_data_virtual_dataset(self, detector_node):
print("_create_data_virtual_dataset")
if (
self.n_frames is None
or self.dim_1 is None
......
......@@ -395,6 +395,7 @@ class _H5ToNxConverter:
)
# if necessary try to guess the type
if self.configuration.format is None:
print("was None")
if "instrument" in entry and is_xrdct_entry(
node=entry,
detectors_names=self.configuration.valid_camera_names,
......@@ -402,8 +403,9 @@ class _H5ToNxConverter:
self.configuration.format = "xrd-ct"
else:
self.configuration.format = "standard"
entry_type = get_entry_type(url=url, configuration=self.configuration)
# Handle XRD-CT dataset
if self.configuration.is_xrdc_ct:
if entry_type is AcquisitionStep.INITIALIZATION:
current_acquisition = None
......@@ -432,6 +434,38 @@ class _H5ToNxConverter:
)
else:
_logger.warning("ignore entry {}".format(entry))
# Handle 3D - XRD dataset
elif self.configuration.is_3d_xrd:
if entry_type is AcquisitionStep.INITIALIZATION:
current_acquisition = None
_logger.warning(
"Found several acquisition type "
"in the same file. Stop conversion at"
" {}".format(url)
)
break
elif (
not self._ignore_entry_frm_titles(group_name)
and current_acquisition is None
):
current_acquisition = XRD3DAcquisition(
root_url=url,
configuration=self.configuration,
detector_sel_callback=self.detector_sel_callback,
)
acquisitions.append(current_acquisition)
current_acquisition.register_step(
url, AcquisitionStep.PROJECTION
)
elif self._ignore_entry_frm_titles(group_name):
current_acquisition = None
elif not self._ignore_sub_entry(url):
current_acquisition.register_step(
url, AcquisitionStep.PROJECTION
)
else:
_logger.warning("ignore entry {}".format(entry))
# Handle "standard" tomo dataset
elif entry_type is AcquisitionStep.INITIALIZATION:
if self._ignore_entry_frm_titles(group_name):
current_acquisition = None
......@@ -453,6 +487,7 @@ class _H5ToNxConverter:
)
acquisitions.append(current_acquisition)
# continue "standard" tomo dataset handling
elif current_acquisition is not None and not self._ignore_sub_entry(
url
):
......
......@@ -423,6 +423,10 @@ class TomoHDF5Config:
def is_xrdc_ct(self):
return self._format == Format.XRD_CT
@property
def is_3d_xrd(self):
return self._format == Format.XRD_3D
@property
def single_file(self):
return self._single_file
......
......@@ -317,7 +317,6 @@ class TomoHDF5ConfigHandler(_BaseHDF5ConfigHandler):
class XRD3DHDF5ConfigHandler(_BaseHDF5ConfigHandler):
def _create_HDF5_config(self):
print("B")
if self.argparse_options.config:
return XRD3DHDF5Config.from_cfg_file(self.argparse_options.config)
else:
......@@ -345,6 +344,10 @@ class XRD3DHDF5ConfigHandler(_BaseHDF5ConfigHandler):
"y_trans_keys": ("y_trans_keys", self.get_tuple_of_keys_from_cmd),
"z_trans_keys": ("z_trans_keys", self.get_tuple_of_keys_from_cmd),
"rot_angle_keys": ("rotation_angle_keys", self.get_tuple_of_keys_from_cmd),
"sample_detector_distance": (
"sample_detector_distance",
self.get_tuple_of_keys_from_cmd,
),
"acq_expo_time_keys": (
"exposition_time_keys",
self.get_tuple_of_keys_from_cmd,
......
Supports Markdown
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