Commit 3b68f7d0 authored by Pierre Paleo's avatar Pierre Paleo

LocalReconstruction: Prevent issue when out_dir empty and dataset is a local path

parent e451ad18
......@@ -327,8 +327,14 @@ class LocalReconstruction:
of nabu config will be taken.
"""
out_cfg = self.process_config.nabu_config["output"]
out_dir = out_cfg["location"]
# prevent issue when out_dir is empty, which happens only if dataset/location is a relative path.
# this should be prevented earlier
if out_dir is None or len(out_dir.strip()) == 0:
out_dir = dirname(dirname(self.results[list(self.results.keys())[0]]))
#
if output_file is None:
output_file = join(out_cfg["location"], out_cfg["file_prefix"]) + ".hdf5"
output_file = join(out_dir, out_cfg["file_prefix"]) + ".hdf5"
if isfile(output_file):
msg = str("File %s already exists" % output_file)
if out_cfg["overwrite_results"]:
......@@ -360,7 +366,7 @@ class LocalReconstruction:
"nabu_config": self.process_config.nabu_config,
"processing_options": self.process_config.processing_options,
},
base_dir=out_cfg["location"],
base_dir=out_dir,
overwrite=out_cfg["overwrite_results"]
)
self.merge_histograms(output_file=output_file)
......
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