An example of the argparser usage.
The snippet can be accessed without any authentication.
Authored by
Marek Cieślar
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='A multiprocessing script for the computation of the 24h-sensitivity averaged |h|.')
parser._action_groups.pop() #supress the -h desc.
required = parser.add_argument_group('required arguments')
required.add_argument('-i', action='store', dest='pop_file_name', help="the Indri's hdf population file", required=True)
required.add_argument('-o', action='store', dest='out_file_name', help="the output hdf file", required=True)
optional = parser.add_argument_group('optional arguments')
optional.add_argument('-n', action='store', dest='NS_num', type=int, default=10000000, help="the number of NSs to cut from the input file")
optional.add_argument('-t', action='store', dest='NS_per_thread', type=int, default=10000, help="the number of NSs to be computed in eah thread.")
optional.add_argument('-p', action='store', dest='processes_count', type=int, default=20, help="the number of processes to use.")
optional.add_argument("-r", action='store', dest='phase_resolution', type=int, default=1000, help="The resolution of the phase average.")
args = parser.parse_args()
NS_num = args.NS_num
NS_per_thread = args.NS_per_thread
g_phase_resolution = args.phase_resolution
processes_count = args.processes_count
File= args.pop_file_name
OutFile = args.out_file_name
print (NS_num, NS_per_thread, processes_count, g_phase_resolution)
print (File, OutFile)
exit()
Please register or sign in to comment