ATLAS Offline Software
Loading...
Searching...
No Matches
plot_av_times.py
Go to the documentation of this file.
1# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2from plot_times import times
3import pylab as pl
4import sys
5import glob
6
7if len(sys.argv) < 3:
8 print('Please supply an input file name stub to glob on the command line, and an output file name')
9 sys.exit(0)
10
11
12stub = sys.argv[1]
13outname = sys.argv[2]
14if not outname.endswith('.pdf'): outname += '.pdf'
15
16fns = glob.glob(stub)
17print('glob found %d files: %s for stub %s' % (len(fns), str(fns), stub))
18if not fns:
19 print('no files found for stub', stub)
20 sys.exit()
21
22def get_av(fn):
23 t = times(fn)
24 return sum(t)/float(len(t))
25
26av_times = [get_av(fn) for fn in fns]
27
28def get_nbkgd(fn):
29 print(fn)
30 x = fn.split('.')[0] # remove .log
31 toks = x.split('_')
32 x = [t for t in toks if t.startswith('b')][0]
33 x = x[1:] # remove 'b'
34 print(x)
35 return float(x)
36
37n_bkgd = [get_nbkgd(fn) for fn in fns]
38
39# print x
40pl.plot(n_bkgd, av_times, 'o')
41pl.suptitle(outname[:-4])
42pl.xlabel('n background')
43pl.ylabel('av exec time (ns)')
44pl.savefig(outname)
45pl.show()
void print(char *figname, TCanvas *c1)