def add_parser(tool_subparsers, **kwargs): """ Adds subparser for this analysis to a nascent argument parser **Arguments:** :*tool_subparsers*: Argparse subparsers object to add subparser :*args*: Passed to tool_subparsers.add_parser(...) :*\*\*kwargs*: Passed to tool_subparsers.add_parser(...) .. todo: - Implement nested subparser (should be 'amber log', not just 'log') """ from MDclt import overridable_defaults subparser = primary.add_parser(tool_subparsers, name = "log", help = "Load AMBER logs") arg_groups = {ag.title:ag for ag in subparser._action_groups} arg_groups["input"].add_argument( "-frames_per_file", type = int, required = False, help = "Number of frames in each file; used to check if new data " + "is present") arg_groups["input"].add_argument( "-start_time", type = float, required = False, help = "Time of first frame (ns) (optional)") arg_groups["output"].add_argument( "-output", type = str, required = True, nargs = "+", action = overridable_defaults(nargs = 2, defaults = {1: "/log"}), help = "H5 file and optionally address in which to output data " + "(default address: /log)") subparser.set_defaults(analysis = command_line)
def add_parser(tool_subparsers, **kwargs): """ Adds subparser for this analysis to a nascent argument parser **Arguments:** :*tool_subparsers*: argparse subparsers object to add subparser :*args*: Passed to tool_subparsers.add_parser(...) :*kwargs*: Passed to tool_subparsers.add_parser(...) """ from MDclt import overridable_defaults subparser = primary.add_parser(tool_subparsers, name = "raw", help = "Load raw text files") arg_groups = {ag.title: ag for ag in subparser._action_groups} arg_groups["input"].add_argument( "-frames_per_file", type = int, required = False, help = "Number of frames in each file; used to check if new data " + "is present") arg_groups["input"].add_argument( "-dimensions", type = int, required = False, nargs = "*", help = "Additional dimensions in dataset; if multidimensional " + "(optional)") arg_groups["output"].add_argument( "-output", type = str, required = True, nargs = "+", action = overridable_defaults(nargs = 2, defaults = {1: "/dataset"}), help = "H5 file and optionally address in which to output data " + "(default address: /dataset)") subparser.set_defaults(analysis = command_line)