plot_config["x_unit"] = str(rebin_config["n_binning_unit"]) + " " + str(rebin_config["binning_unit"]) ## manage plot configuration that involves bools if "logscale_eta" in plot_config: plot_config["logscale_eta"] = config.getboolean("plot","logscale_eta") else: plot_config["logscale_eta"] = False if "use_x_var" in plot_config: plot_config["use_x_var"] = config.getboolean("plot","use_x_var") else: plot_config["use_x_var"] = True if "plot_eta" in plot_config: plot_config["plot_eta"] = config.getboolean("plot","plot_eta") else: plot_config["plot_eta"] = True if args.plot_title is not None: plot_config["plot_title"] = args.plot_title if args.verbose is True: logr.setLevel(logging.DEBUG) serializer = importlib.import_module(args.serializer) model = getattr(models,model_name)(config=model_config) if args.analyzed_data_file is not None: plotable_data = serializer.load(open(args.analyzed_data_file))[rule_name] else: generator = serializer.load(open(args.input_file_name))[rule_name] plotable_data = analyze(generator,model,None,None,logr) plot(plotable_data,plot_config)
plot_config["x_unit"] = str(rebin_config["n_binning_unit"]) + " " + str(rebin_config["binning_unit"]) ## manage plot configuration that involves bools if "logscale_eta" in plot_config: plot_config["logscale_eta"] = config.getboolean("plot","logscale_eta") else: plot_config["logscale_eta"] = False if "use_x_var" in plot_config: plot_config["use_x_var"] = config.getboolean("plot","use_x_var") else: plot_config["use_x_var"] = True if "plot_eta" in plot_config: plot_config["plot_eta"] = config.getboolean("plot","plot_eta") else: plot_config["plot_eta"] = True try: plot_config["dual_axis"] = config.getboolean("plot","dual_axis") except configparser.NoOptionError: plot_config["dual_axis"] = True if args.verbose is True: logr.setLevel(logging.DEBUG) if args.input_file_name is None: input_generator = csv.reader(sys.stdin) else: input_generator = csv.reader(open(args.input_file_name)) plot(input_generator,plot_config)
dest="output_file_name", default=None) parser.add_argument("-v", "--verbose", dest="verbose", action="store_true", default=False) args = parser.parse_args() config = configparser.ConfigParser() config.read(args.config_file_name) # manage config parameters that can be overwritten with cmd-line options if args.plot_title is not None: config.set("plot", "plot_title", args.plot_title) if args.output_file_name is not None: # strip off extension if len(args.output_file_name.split('.')) > 1: args.output_file_name = '.'.join(args.output_file_name.split('.')[:-1]) config.set("plot", 'plot_file_name', args.output_file_name) if args.verbose is True: logger.setLevel(logging.DEBUG) if args.input_file_name is None: input_generator = csv.reader(sys.stdin) else: input_generator = csv.reader(open(args.input_file_name)) plot(input_generator, config)