"--parallel", action="store", dest="pal", type="int", default=1, help="multiprocessing for agg") op.add_option("--debug", action="store_true", dest="debug", default=False, help="set logging level to DEBUG") (options, args) = op.parse_args() conf = config.open_config(options.conf) lv = logging.DEBUG if options.debug else logging.INFO config.set_common_logging(conf, _logger, ["fourier", "evfilter"], lv=lv) if len(args) == 0: test_log2event(conf) mode = args.pop(0) if mode == "agg": sys.exit("This function is outdated") if len(args) < 1: sys.exit("give me filename of statistical event output") filename = args[0] import pc_log l_args = [list(args) + [filename] for args in pc_log.pc_all_args(conf)] agg_mprocess(l_args, filename, options.pal) elif mode == "test": test_log2event(conf)
""".strip().format(sys.argv[0]) import optparse op = optparse.OptionParser(usage) op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") op.add_option("-r", action="store_true", dest="recur", default=False, help="search log file recursively") op.add_option("--debug", action="store_true", dest="debug", default=False, help="set logging level to DEBUG") options, args = op.parse_args() conf = config.open_config(options.conf) lv = logging.DEBUG if options.debug else logging.INFO config.set_common_logging(conf, _logger, ["lt_common", "lt_shiso", "lt_va", "lt_import"], lv = lv) if len(args) == 0: sys.exit(usage) mode = args.pop(0) if mode == "make": targets = _get_targets(conf, args, options.recur) timer = common.Timer("log_db make", output = _logger) timer.start() process_files(conf, targets, True) timer.stop() elif mode == "make-init": targets = _get_targets(conf, args, options.recur) timer = common.Timer("log_db make-init", output = _logger) timer.start() process_init_data(conf, targets)
default=False, help="remake area definition") op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") op.add_option("-f", action="store_true", dest="format", default=False, help="format db and reconstruct") op.add_option("-m", action="store_true", dest="migrate", default=False, help="change existing db into recent version") op.add_option("-r", action="store_true", dest="recur", default=False, help="search log file recursively") op.add_option("-g", "--group", action="store_true", dest="gflag", default=False, help=gflag_help) options, args = op.parse_args() conf = config.open_config(options.conf) config.set_common_logging(conf, _logger, ["lt_common", "lt_shiso"]) if options.aflag: remake_area(conf) elif options.gflag: remake_ltgroup(conf) elif options.migrate: migrate(conf) else: process_files(conf, args, options.recur, options.format)
def show_self_corr(conf): sc = CalculateSelfCorr(conf, False) if sc.loaded(): print sc.show_result() if __name__ == "__main__": import optparse usage = "usage: {0} [options] mode".format(sys.argv[0]) op = optparse.OptionParser(usage) op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") op.add_option("-f", action="store_true", dest="fflag", default=False, help="format indata and recalculate") op.add_option("-t", "--threshold", action="store", dest="threshold", type="float", default=None, help="Threshold") (options, args) = op.parse_args() if len(args) == 0: sys.exit(usage) conf = config.open_config(options.conf) config.set_common_logging(conf, _logger) if args[0] == "self-corr": mkfilter_self_corr(conf, options.fflag, options.threshold) elif args[0] == "show-self-corr": show_self_corr(conf)
top_dt, end_dt) else: raise NotImplementedError assert len(edict) == len(evmap) for eid in edict.keys(): print("Event {0} : {1}".format(eid, evmap.info_str(eid))) if evmap.info(eid).type == EventDefinitionMap.type_normal: print(evmap.info_repr(ld, eid)) else: print("\n".join([str(dt) for dt in edict[eid]])) print("\n".join(["#" + w for w in evmap.info_repr(ld, eid).split("\n")])) print if __name__ == "__main__": usage = "usage: {0} [options]".format(sys.argv[0]) import optparse op = optparse.OptionParser(usage) op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") (options, args) = op.parse_args() conf = config.open_config(options.conf) config.set_common_logging(conf, _logger, ["pc_log", "evfilter"]) test_log2event(conf)
tid, dummy = ltgen.process_line(l_w, l_s) if tid is None: print line.rstrip("\n") _logger.info("lt_import job for ({0}) done".format(fn)) if __name__ == "__main__": import sys import optparse import config import log_db usage = "usage: {0} [options] fn".format(sys.argv[0]) op = optparse.OptionParser(usage) op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") op.add_option("-r", action="store_true", dest="recur", default=False, help="search log file recursively") op.add_option("--debug", action="store_true", dest="debug", default=False, help="set logging level to DEBUG") options, args = op.parse_args() conf = config.open_config(options.conf) lv = logging.DEBUG if options.debug else logging.INFO config.set_common_logging(conf, _logger, [], lv = lv) targets = log_db._get_targets(conf, args, options.recur) search_exception(conf, targets)
if __name__ == "__main__": usage = """ usage: {0} [options] args... args: make : make / update changepoint detection object graph : generate graphs for loaded changepoint detection object """.strip().format(sys.argv[0]) import optparse op = optparse.OptionParser(usage) op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") options, args = op.parse_args() conf = config.open_config(options.conf) config.set_common_logging(conf, _logger, ["log_db",]) dirname = conf.get("changepoint", "temp_cp_data") if len(args) == 0: sys.exit(usage) mode = args.pop(0) if mode == "make": cpd = ChangePointData(dirname) binsize = conf.getdur("changepoint", "cf_bin") cf_r = conf.getfloat("changepoint", "cf_r") cf_smooth = conf.getint("changepoint", "cf_smooth") cpd.init(binsize, cf_r, cf_smooth) common.mkdir(cpd.dirname) common.rm_dirchild(cpd.dirname) cpd.update(conf) cpd.dump()
# default=False, help="using pcalg library in R") op.add_option("--test", action="store_true", dest="test", default=False, help="test pc_log; do with first term") op.add_option("--debug", action="store_true", dest="debug", default=False, help="set logging level to DEBUG") (options, args) = op.parse_args() conf = config.open_config(options.conf) lv = logging.DEBUG if options.debug else logging.INFO config.set_common_logging(conf, _logger, ["evfilter", "log2event"], lv=lv) common.mkdir(conf.get("dag", "output_dir")) if options.date is None: l_args = pc_all_args(conf) else: l_args = pc_arg_date(conf, options.date) if options.test: test_pc(l_args) sys.exit() elif options.make_event: if len(args) < 1: sys.exit("give me filename of statistical event output") filename = args[0] import pc_log l_args = [list(args) + [filename] for args in pc_log.pc_all_args(conf)]
help="configuration file path") op.add_option("-e", action="store_true", dest="make_event", default=False, help="only making event set") op.add_option("-p", "--parallel", action="store", dest="pal", type="int", default=1, help="multithreading") #op.add_option("-r", action="store_true", dest="rflag", # default=False, help="using pcalg library in R") op.add_option("--test", action="store_true", dest="test", default=False, help="test pc_log; do with first term") op.add_option("--debug", action="store_true", dest="debug", default=False, help="set logging level to DEBUG") (options, args) = op.parse_args() conf = config.open_config(options.conf) lv = logging.DEBUG if options.debug else logging.INFO config.set_common_logging(conf, _logger, ["evfilter"], lv = lv) common.mkdir(conf.get("dag", "output_dir")) l_args = pc_all_args(conf) if options.test: test_pc(l_args); sys.exit() elif options.make_event: test_edict(l_args); sys.exit() if options.pal == 1: pc_sthread(l_args) else: pc_mthread(l_args, options.pal)
graph : generate graphs for loaded changepoint detection object """.strip().format(sys.argv[0]) import optparse op = optparse.OptionParser(usage) op.add_option("-c", "--config", action="store", dest="conf", type="string", default=config.DEFAULT_CONFIG_NAME, help="configuration file path") options, args = op.parse_args() conf = config.open_config(options.conf) config.set_common_logging(conf, _logger, [ "log_db", ]) dirname = conf.get("changepoint", "temp_cp_data") if len(args) == 0: sys.exit(usage) mode = args.pop(0) if mode == "make": cpd = ChangePointData(dirname) binsize = conf.getdur("changepoint", "cf_bin") cf_r = conf.getfloat("changepoint", "cf_r") cf_smooth = conf.getint("changepoint", "cf_smooth") cpd.init(binsize, cf_r, cf_smooth) common.mkdir(cpd.dirname) common.rm_dirchild(cpd.dirname) cpd.update(conf)