def handle_commandline(): ''' Set up commandline parser, check and return options. ''' p = get_commandline_parser() options, args = p.parse_args() # custom checks: marker_dms = check_marker_option(options, args, p) delays_file = check_delays_option(options, args, p) odir = check_odir_option(options, args, p) return options, args, marker_dms, delays_file, odir
output_files.append((plot_i, searchoutdir, fn)) return output_files if __name__ == '__main__': print 'Called with:', sys.argv p = get_commandline_parser() options, args = p.parse_args() if len(args) == 0: p.print_usage() p.print_help() # Some custom checks: delays_file = check_delays_option(options, args, p) check_type_option(options, args, p) output_files = check_directories(options, args, p) for plot_i, searchoutdir, fn in output_files: print plot_i, searchoutdir, fn # Do some setting up and calculations: cv = SVGCanvas(1250, 760) try: print 'Scanning for .singlepulse and .inf files ...' spr = SinglePulseReaderCondensed(searchoutdir, options.s, options.e, delays_file, options.lo, options.hi) print '... done' except: raise datapath = os.path.abspath(searchoutdir)