def _setup(args): params = parsing.parse_dictionary(args.params) print("params: %s" % params) try: params["randomize"] = args.randomize except: pass try: verbose = args.verbose except: verbose = False try: debug = args.debug except: debug = False np.random.seed(123) level = logging.DEBUG if debug else logging.INFO fmt = '[%(process)4d][%(asctime)s][%(levelname)-5s][%(module)s:%(lineno)d/%(funcName)s] %(message)s' logging.basicConfig(level=level, format=fmt) if verbose: logging.getLogger().addHandler(logging.StreamHandler()) return params
def setup(args): params = parsing.parse_dictionary(args.params) print("params: %s" % params) try: params["randomize"] = args.randomize except: pass try: verbose = args.verbose except: verbose = False try: debug = args.debug except: debug = False np.random.seed(123) level = logging.DEBUG if debug else logging.INFO if args.output is None: args.output = "%s_%i.tsv" % (os.path.basename(__file__), os.getpid()) fmt = '[%(process)4d][%(asctime)s][%(levelname)-5s][%(module)s:%(lineno)d/%(funcName)s] %(message)s' if args.output is not None: logfile = "%s.log" % (args.output) logging.basicConfig(filename=logfile, level=level, format=fmt) print("logging to %s\n" % logfile) else: logging.basicConfig(level=level, format=fmt) if verbose: logging.getLogger().addHandler(logging.StreamHandler()) return params
def prepare_params(args): params = parsing.parse_dictionary(args.params) try: verbose = args.verbose except: verbose = False try: debug = args.debug except: debug = False fmt = '[%(process)4d][%(asctime)s][%(levelname)-5s][%(module)s:%(lineno)d/%(funcName)s] %(message)s' if args.output is not None: if args.logfile: if not debug and not verbose: errfile = args.output+".err.log" sys.stderr = open(errfile, 'w') print("logging errs to %s" % (errfile)) logfile = "%s.log" % (args.output) logging.basicConfig(filename=logfile, level=logging.DEBUG, format=fmt) print("logging to %s" % (logfile)) else: logging.basicConfig(format=fmt) else: logging.basicConfig(level=logging.DEBUG, format=fmt) level = logging.DEBUG if debug else (logging.INFO if verbose else logging.WARN) if verbose or debug: print_handler = logging.StreamHandler() print_handler.setLevel(level) logging.getLogger().addHandler(print_handler) logging.getLogger("output").setLevel(level) if args.output is None: args.output = "%s_%i" % (os.path.basename(__file__), os.getpid()) params["verbose"] = verbose or debug params["debug"] = debug params["experiment_id"] = os.getpid() return params
"--debug", dest='debug', help="print debug information", action="store_true", default=False) parser.add_argument("-minr", "--minratio", dest='minratio', help="min value of ratio=a1/a0 to plot", required=False, default=1.01, type=float) args = parser.parse_args(sys.argv[1:]) params = parsing.parse_dictionary(args.params) output = args.input logging.basicConfig(level=logging.INFO) if args.debug: logging.basicConfig(level=logging.DEBUG) ############################################################################################## df, ratios, badge_time = load_data(args, params) ############################################################################################## ############################################################################################## ############################################################################################## print("Empirical vs theoretic p-values rejections") for l0, ldf in df.groupby("l0"):