cli — Command-line#
This module contain the basic command-line interface for the package, in the
form of the CliArgumentParser class.
This is a hierarchical argument parser mapping sub-commands to specific
functionalities of the package.
Module documentation#
Main command-line interface.
- class hexsample.cli._Formatter(prog, indent_increment=2, max_help_position=24, width=None)[source]#
Do nothing class combining our favorite formatting for the command-line options, i.e., the newlines in the descriptions are preserved and, at the same time, the argument defaults are printed out when the –help options is passed.
The inspiration for this is coming from one of the comments in https://stackoverflow.com/questions/3853722
- class hexsample.cli.CliArgumentParser[source]#
Application-wide argument parser.
- _DESCRIPTION = None#
- _EPILOG = None#
- _FORMATTER_CLASS#
alias of
_Formatter
- static add_num_events(parser: ArgumentParser, default: int, intent: str = 'generated') None[source]#
Add an option for the number of events.
- static add_output_file(parser: ArgumentParser, default: str) None[source]#
Add an option for the output file.
Note that we cast the default to a string—this prevents having pathlib.Path instances around, which would then needed to be handled properly in specific places (such as adding metadata to the output HDF5 file headers).
- static add_random_seed(parser: ArgumentParser, default: int) None[source]#
Add an option for the random seed of a simulation.
- static add_suffix(parser: ArgumentParser, default: str) None[source]#
Add an option for the output suffix.
- static add_zero_sup_threshold(parser: ArgumentParser, default: int) None[source]#
Add an option for the zero-suppression threshold.
- static add_source_options(parser: ArgumentParser) None[source]#
Add an option group for to a given (sub-)parser to define the basic properties of the X-ray source to be used in a simulation.
This is clearly suboptimal, as different source spectra and/or beams require different sets of parameters, while we are listing all of the in no particular order. A more sophisticated approach would require multiple parsing stages, which is out of scope for the time being.
- static add_sensor_options(parser: ArgumentParser) None[source]#
Add an option group for the sensor properties.
- static add_readout_options(parser: ArgumentParser) None[source]#
Add an option group for the readout properties.
- add_recon_options(parser: ArgumentParser) None[source]#
Add an option group for the reconstruction properties.