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

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