Commit 53823c63 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Merge CLI default configurations

parent e0dcd577
from os import path
from .utils import parse_params_values
from .conf_bootstrap import BootstrapConfig
from .cli_configs import BootstrapConfig
from import generate_nabu_configfile
from ..validators import convert_to_bool
# Default configuration for CLI tools
# Default configuration for "bootstrap" command
BootstrapConfig = {
"bootstrap": {
"help": "Bootstrap a configuration file from scratch.",
......@@ -22,3 +28,32 @@ BootstrapConfig = {
"const": 1,
# Default configuration for "validate" command
ValidateConfig = {
"input_file": {
"help": "Nabu input file",
"mandatory": True,
# Default configuration for "reconstruct" command
ReconstructConfig = {
"input_file": {
"help": "Nabu input file",
"mandatory": True,
"compute": {
"help": "Computation distribution method. Can be 'local' or 'slurm'",
"default": "local",
"nodes": {
"help": "Number of computing nodes to use. Ignored if --compute is set to 'local'.",
"default": 1,
"type": int,
#!/usr/bin/env python
""" Entry point for performing tomographic reconstructions.
The user needs to provide:
- A parameter file ("nabu.conf")
- Optionally, the description on how the computations are to be distributed.
import os
from .utils import parse_params_values
from .cli_configs import ReconstructConfig
def parse_args():
args = parse_params_values(
parser_description="Perform a tomographic reconstruction."
if __name__ == "__main__":
......@@ -4,7 +4,14 @@ def parse_params_values(Params, parser_description=None):
parser = ArgumentParser(description=parser_description)
for param_name, vals in Params.items():
parser.add_argument("--" + param_name, **vals)
optional = True
if "mandatory" in vals:
if vals["mandatory"]:
optional = False
if optional:
param_name = "--" + param_name
parser.add_argument(param_name, **vals)
args = parser.parse_args()
args_dict = args.__dict__
#!/usr/bin/env python
Validate: tool for validating a configuration file.
This tool will inspect each entry of the configuration file and ensure that
- The dataset can be accessed (and the output location is writeable)
- The relevant metadata can be accessed (pixel size, energy, angles, ...)
- Each value of the configuration file is correct (eg. invalid values)
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