source: branches/trigger_burst_research/plot_basic_ratescan_info.py@ 18298

Last change on this file since 18298 was 18298, checked in by dneise, 9 years ago
debugging
File size: 2.0 KB
Line 
1import sys
2from pylab import *
3import pandas as pd
4from astropy.io import fits
5from calculate_burst_ratio_file import get_trigger_rates, fjd
6plt.ion()
7
8night_string = sys.argv[1]
9night_int = int(night_string)
10OFFSET=719163
11
12runs = pd.DataFrame.from_csv(
13 'foo.bar',
14 infer_datetime_format=True,
15 parse_dates=['fRunStart', 'fRunStop']
16 ).dropna()
17
18runs = runs.loc[runs.fNight==night_int]
19
20trigger_rates = get_trigger_rates(night_int)
21
22fig, ax1 = plt.subplots(figsize=(16, 12))
23ax1.set_xlabel("Time")
24ax1.set_yscale('log')
25ax1.set_ylabel("Rate [Hz]")
26ax1.grid()
27
28plt.title("basic Ratescan information from: " + night_string)
29
30plot_0 = ax1.plot_date(
31 trigger_rates['Time']+OFFSET,
32 np.median(trigger_rates['BoardRate'], axis=1),
33 'r.',
34 label="median BoardRate"
35 )
36
37plot_1 = ax1.plot_date(
38 trigger_rates['Time']+OFFSET,
39 trigger_rates['TriggerRate'],
40 'g.',
41 label="Camera TriggerRate"
42 )
43
44for runs_index in range(len(runs)):
45 this_run = runs.iloc[runs_index]
46 run_number = this_run['fRunID']
47
48 a = fjd(this_run['fRunStart'])+OFFSET
49 e = fjd(this_run['fRunStop'])+OFFSET
50
51 ax1.axvline(a, color='g', linestyle='dashed')
52 ax1.axvline(e, color='r', linestyle='dashed')
53 ax1.text(a + (e-a)/2., 900,
54 "{0}".format(run_number),
55 horizontalalignment='center',
56 verticalalignment='center',
57 )
58
59 med = this_run['median_of_board_rates']
60 std_dev = this_run['std_dev_of_board_rates']
61
62 ax1.plot_date(
63 [a, e],
64 [med+3*std_dev, med+3*std_dev],
65 'm-')
66
67
68
69plt.xlim((
70 fact.fjd(runs.iloc[0]['fRunStart'])+OFFSET,
71 fact.fjd(runs.iloc[-1]['fRunStop'])+OFFSET
72 ))
73
74plt.legend(
75 handles=[plot_0[0], plot_1[0]],
76 loc='lower left')
77plt.savefig("board_rate_overview_"+night_string+'.png', dpi=300)
78#plt.figure()
79#plt.title("fHighBoardTriggerRateRatio distribution from {0}".format(night_int))
80#plt.hist(ratio, bins=np.linspace(0,0.3,16), log=True )
81#plt.grid()
82#plt.xlabel("fHighBoardTriggerRateRatio")
Note: See TracBrowser for help on using the repository browser.