lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF 6.5.4
Loading...
Searching...
No Matches
/examples/pythonexample.py
1#! /usr/bin/env python
2
3
4
5import lhapdf
6
7
8p = lhapdf.mkPDF("CT10nlo", 0)
9p = lhapdf.mkPDF("CT10nlo/0")
10
11
12print(p.xfxQ2(21, 1e-3, 1e4))
13
14
15for pid in p.flavors():
16 print(p.xfxQ(pid, 0.01, 91.2))
17
18# TODO: demonstrate looping over PDF set members
19pset = lhapdf.getPDFSet("CT10nlo")
20print(pset.description)
21pcentral = pset.mkPDF(0)
22pdfs1 = pset.mkPDFs()
23pdfs2 = lhapdf.mkPDFs("CT10nlo") # a direct way to get all the set's PDFs
24
25
26import numpy as np
27xs = [x for x in np.logspace(-7, 0, 5)]
28qs = [q for q in np.logspace(1, 4, 4)]
29gluon_xfs = np.empty([len(xs), len(qs)])
30for ix, x in enumerate(xs):
31 for iq, q in enumerate(qs):
32 gluon_xfs[ix,iq] = p.xfxQ(21, x, q)
33print(gluon_xfs)
34
35
36print(lhapdf.version())
37print(lhapdf.__version__)
38lhapdf.pathsPrepend("/path/to/extra/pdfsets")
39print(lhapdf.paths())
40# ...