source: branches/trigger_burst_research/plot_basic_ratescan_info.py@ 18300

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