-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_pedestals.py
60 lines (45 loc) · 1.16 KB
/
plot_pedestals.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import signal
signal.signal(
signal.SIGINT, signal.SIG_DFL
) # allows to close matplotlib window with CTRL+C from terminal
import argparse
import matplotlib.pyplot as plt
import stationrc.common
import stationrc.remote_control
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",
"--channel",
type=int,
default=None,
help="Plot certain channel. If None plot all channels. (Default: None)",
)
parser.add_argument(
"--no_update",
action="store_true",
help="If set, do not run updatePedestals()",
)
parser.add_argument(
"--reset",
action="store_true",
help="Reset radiant",
)
args = parser.parse_args()
stationrc.common.setup_logging()
station = stationrc.remote_control.VirtualStation()
if args.reset:
station.reset_radiant_board()
if not args.no_update:
station.radiant_pedestal_update()
data = station.radiant_pedestal_get()
fig = plt.figure()
ax = fig.subplots()
if args.channel is None:
for ch, ped in enumerate(data):
ax.plot(ped, label=f"ch. {ch}")
else:
ax.plot(data[args.channel], label=f"ch. {args.channel}")
ax.legend()
ax.set_xlabel("Sample")
ax.set_ylabel("ADC counts")
plt.show()