def main(argv): endless_loop = False debug = False outfile = None infile = None dict = None plot = False wave = False error = False print("sopare " + __version__) if (len(argv) > 0): try: opts, args = getopt.getopt(argv, "ahelpv~cous:w:r:t:d:", [ "analysis", "help", "error", "loop", "plot", "verbose", "wave", "create", "overview", "unit", "show=", "write=", "read=", "train=", "delete=" ]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if (opt in ("-h", "--help")): usage() sys.exit(0) if (opt in ("-e", "--error")): error = True if (opt in ("-l", "--loop")): endless_loop = True if (opt in ("-p", "--plot")): if (endless_loop == False): plot = True else: print("Plotting only works without loop option!") sys.exit(0) if (opt in ("-v", "--verbose")): debug = True if (opt in ("-~", "--wave")): wave = True if opt in ("-c", "--create"): recreate_dict(debug) sys.exit(0) if opt in ("-o", "--overview"): show_dict_ids(debug) sys.exit(0) if opt in ("-a", "--analysis"): show_dict_analysis(debug) sys.exit(0) if opt in ("-s", "--show"): show_word_entries(arg, debug) sys.exit(0) if opt in ("-w", "--write"): outfile = arg if opt in ("-r", "--read"): infile = arg if opt in ("-t", "--train"): dict = arg if opt in ("-d", "--delete"): delete_word(arg, debug) sys.exit(0) if opt in ("-u", "--unit"): unit_tests(debug) sys.exit(0) hatched = hatch.hatch() hatched.add("endless_loop", endless_loop) hatched.add("debug", debug) hatched.add("plot", plot) hatched.add("wave", wave) hatched.add("outfile", outfile) hatched.add("infile", infile) hatched.add("dict", dict) logger = log.log(debug, error) hatched.add("logger", logger) recorder.recorder(hatched)
def main(argv): endless_loop = False debug = False outfile = None infile = None dict = None plot = False wave = False error = False cfg_ini = None length = 0.0 delta = 0.0 mv = 0.0 mc = 0.0 recreate = False unit = False print("sopare " + __version__) if (len(argv) > 0): try: opts, args = getopt.getopt(argv, "ahelpv~cous:w:r:e:t:d:i:", [ "analysis", "help", "error", "loop", "plot", "verbose", "wave", "create", "overview", "unit", "show=", "write=", "read=", "evaluate=", "train=", "delete=", "ini=" ]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if (opt in ("-h", "--help")): usage() sys.exit(0) if (opt in ("-e", "--error")): error = True if (opt in ("-l", "--loop")): endless_loop = True if (opt in ("-p", "--plot")): if (endless_loop == False): plot = True else: print("Plotting only works without loop option!") sys.exit(0) if (opt in ("-v", "--verbose")): debug = True if (opt in ("-~", "--wave")): wave = True if opt in ("-c", "--create"): recreate = True if opt in ("-o", "--overview"): show_dict_ids(debug) sys.exit(0) if opt in ("-a", "--analysis"): show_dict_analysis(debug) sys.exit(0) if opt in ("-s", "--show"): show_word_entries(arg, debug) sys.exit(0) if opt in ("-w", "--write"): outfile = arg if opt in ("-r", "--read"): infile = arg if opt in ('-e', '--evaluate'): # testing requires infile, L, and Delta infile = sys.argv[2] length = sys.argv[3] delta = sys.argv[4] mv = sys.argv[5] mc = sys.argv[6] if opt in ("-t", "--train"): dict = arg if opt in ("-d", "--delete"): delete_word(arg, debug) sys.exit(0) if opt in ("-i", "--ini"): cfg_ini = arg if opt in ("-u", "--unit"): unit = True cfg = create_config(cfg_ini, endless_loop, debug, plot, wave, outfile, infile, dict, error, length, delta, mv, mc) if (recreate == True): recreate_dict(debug, cfg) sys.exit(0) if (unit == True): unit_tests(debug, cfg) sys.exit(0) recorder.recorder(cfg)