date_exp_start = datetime_from_string(args.exp_start) date_exp_end = datetime_from_string(args.exp_end) # make sure the run2 is larger than run1 if run2 < run1 : smaller = run2 run2 = run1 run1 = smaller xmin = run1 xmax = run2 runs = db.select_runs("@is_production and event_count > 1000000",run1,run2) if (len(runs) == 0): sys.exit("No runs found !") # default start time date_run1 = runs[0].start_time if (len(runs) == 0): print "No runs in RCDB between",run1," and ",run2 sys.exit() else: print "Selected ",len(runs)," runs from ",runs[0]," to",runs[len(runs)-1] # All conditions of this run by name. # conditions_by_name = runs[0].get_conditions_by_name() # conditions = conditions_by_name.keys()
""" rplot_rcdb3_WB.py python script to plot information in the rcdb, especially integrated triggers vs run number, or time based on Elton Smith's and Mark Daltons scripts. """ import rcdb from rcdb.provider import RCDBProvider import sys import numpy as np import matplotlib as mpl mpl.use('Agg') #this backend is needed for interactive mode from matplotlib import pyplot as plt from datetime import datetime, date, time, timedelta import argparse as AG # get db db = RCDBProvider("mysql://[email protected]/rcdb") #--------------------------------------------------------- general parameters ------------- # default run numbers # run1_def = 10331 # spring 2016 # run2_def = 13000 # run1_def = 21968 # fall 2016 # run2_def = 22167 #run1 = 30000 # spring 2017 #run1_def = 30278 # spring 2017 #run2_def = 31000 #run1 = 40000 # spring 2018
run1 = args.start_run run2 = args.end_run min_current = args.min_current # make sure the run2 is larger than run1 if run2 < run1: smaller = run2 run2 = run1 run1 = smaller xmin = run1 xmax = run2 runs = db.select_runs( "@is_production and @status_approved and event_count > 1000000 ", run1, run2) #and @status_approved if (len(runs) == 0): print "No runs in RCDB between", run1, " and ", run2 sys.exit() else: print "Selected ", len(runs), " runs from ", runs[0], " to", runs[len(runs) - 1] # All conditions of this run by name. # conditions_by_name = runs[0].get_conditions_by_name() # conditions = conditions_by_name.keys() # print "List of conditions=",conditions exp_duration = date_exp_end - date_exp_start