5 from mpl_toolkits.axes_grid1
import make_axes_locatable
6 import matplotlib
as mpl
12 inputfile =
'r5387_e89634.h5' 22 if args[0] ==
'-f' and len(args) > 1:
25 elif args[0] ==
'-w0' and len(args) > 1:
28 elif args[0] ==
'-w1' and len(args) > 1:
31 elif args[0] ==
'-t0' and len(args) > 1:
34 elif args[0] ==
'-t1' and len(args) > 1:
37 elif args[0] ==
'-sc' and len(args) > 1:
40 elif args[0] ==
'-save':
44 print(
'Unknown option %s' % args[0])
47 f = h5py.File(inputfile,
'r') 51 mpl.rcParams.update({
'font.size' : (w1-w0)/sc/1.6})
78 n1 = np.array(f[
"wiresigs/adc"][:])
79 evttime = np.array(f[
"evtids/evttime"][:])
80 run = np.array(f[
"evtids/eid"][:])
81 from datetime
import datetime
82 timestamp =
int(evttime[0])
83 dt_object = datetime.fromtimestamp(timestamp)
85 import matplotlib.pyplot
as plt
86 fig, ax = plt.subplots()
87 y = np.reshape(n1, (n1.shape[0]//6000, 6000))
88 z = np.flip(y.transpose(),0)
99 z1 = z[6000-t1:6000-t0, w0:w1]
102 im = ax.imshow(z1, extent=[w0, w1, t0, t1], aspect=
'auto', vmax=10.0, vmin=-2.5)
104 divider = make_axes_locatable(plt.gca())
105 cax = divider.append_axes(
"right",
"3%", pad=
"2%")
106 cb = plt.colorbar(im, cax=cax)
109 cb.set_label(
"Charge/tick/channel (ke)")
110 fig.set_size_inches((w1-w0+1)*0.479/sc, (t1-t0+1)*0.5*0.16/sc)
113 ax.set_xlabel(
"Wire number")
114 ax.set_ylabel(
"Ticks (0.5 $\mu$s)")
115 ax.set_title(
"ProtoDUNE-SP Run {} Event {} @{} UTC".
format(run[0][0], run[0][2], dt_object))
119 plt.savefig(
"R{}_E{}_T1T5T9_w{}_{}_t{}_{}_sc{}.png".
format(run[0][0],run[0][2],w0,w1,t0,t1,sc))
120 plt.savefig(
"R{}_E{}_T1T5T9_w{}_{}_t{}_{}_sc{}.pdf".
format(run[0][0],run[0][2],w0,w1,t0,t1,sc))
123 if __name__ ==
'__main__':
124 sys.exit(
main(sys.argv))
static bool format(QChar::Decomposition tag, QString &str, int index, int len)