Commit 9237f01b authored by Pierre Paleo's avatar Pierre Paleo

Add support for hdf5 entry in nabu config

parent b9020e41
Pipeline #37929 passed with stages
in 5 minutes and 48 seconds
......@@ -62,6 +62,7 @@ class DatasetAnalyzer(object):
"force_flatfield": False,
"output_dir": None,
"exclude_projections": None,
"hdf5_entry": None,
}
advanced_options.update(extra_options)
self.extra_options = advanced_options
......@@ -82,6 +83,8 @@ class DatasetAnalyzer(object):
}
if filetype not in scanners.keys():
raise ValueError("No scanner for file type: %s" % filetype)
if filetype == "hdf5" and self.extra_options["hdf5_entry"] is not None:
kwargs["entry"] = self.extra_options["hdf5_entry"]
scanner = scanners[filetype]
self.dataset_scanner = scanner(
self.location,
......
......@@ -23,6 +23,12 @@ nabu_config = {
"validator": dataset_location_validator,
"type": "required",
},
"hdf5_entry": {
"default": "",
"help": "Entry in the HDF5 file, if applicable. Default is the first available entry.",
"validator": optional_string_validator,
"type": "advanced",
},
"binning": {
"default": "1",
"help": "Binning factor in the horizontal dimension when reading the data.\nThe final slices dimensions will be divided by 'slices_binning'",
......
......@@ -70,7 +70,7 @@ class ProcessConfig:
"force_flatfield": self.nabu_config["preproc"]["flatfield_enabled"] == "forced",
"exclude_projections": self.nabu_config["dataset"]["exclude_projections"],
"output_dir": self.nabu_config["output"]["location"],
"hdf5_entry": self.nabu_config["dataset"]["hdf5_entry"],
},
logger=self.logger
)
......
......@@ -92,6 +92,11 @@ def name_range_checker(name, valid_names, descr, replacements=None):
# ---------------------------- Validators --------------------------------------
# ------------------------------------------------------------------------------
@validator
def optional_string_validator(val):
if len(val.strip()) == 0:
return None
return val
@validator
def file_name_validator(name):
......
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