lhapdf

view testpdfs @ 1110:2ba52dbf2312

Add release instructions for new sets
author Andy Buckley <andy@insectnation.org>
date Tue, 17 Oct 2017 17:12:04 +0100
parents 6ed9bcdd5c50
children
line source
1 #! /usr/bin/env python
3 """\
4 Usage: %prog <PDF1> [<PDF2> [...]]
6 Test PDF xf, alpha_s, and metadata values for the named LHAPDF6 sets.
7 """
9 import optparse, sys
10 op = optparse.OptionParser(usage=__doc__)
11 op.add_option("--xmin", dest="XMIN", metavar="NUM", help="minimum x value [default: %default]", type=float, default=1e-10)
12 op.add_option("--qmax", dest="QMAX", metavar="NUM", help="maximum Q value in GeV [default: %default]", type=float, default=1e4)
13 opts, args = op.parse_args()
14 if not args:
15 print __doc__
16 sys.exit(1)
19 ## Get sampling points in x,Q
20 from math import log10
21 import numpy as np
22 xs = np.logspace(log10(opts.XMIN), 0, 10)
23 qs = np.logspace(0, log10(opts.QMAX), 10)
24 xs_few = [1e-5, 1e-3, 1e-2, 1e-1]
25 qs_few = [10, 100, 1000, 10000]
28 ## Test each PDF's metadata, alpha_s, and xf values
29 for pname in args:
30 import lhapdf, pprint
32 p = lhapdf.mkPDF(pname)
33 pset = p.set()
34 ps = pset.mkPDFs()
35 del ps
37 ## Metadata
38 print "\n", "%s (version %d) [%d] - %d members" % (pset.name, pset.dataversion, pset.lhapdfID, pset.size)
39 print "Set type = %s, %g%% CL" % (pset.errorType, pset.errorConfLevel)
41 ## alpha_s
42 alphas = {q:p.alphasQ(q) for q in qs}
43 print "\n", "alpha_s =\n", pprint.pformat(alphas)
45 ## xf
46 for pid in xrange(-6, 7):
47 xfs = np.array([[p.xfxQ(pid, x,q) for x in xs] for q in qs])
48 print "\n", ("xf_%d =\n" % pid), xfs
49 print