Detailed package info
This is a comprehensive documentation of the code for developers and power users. It is automatically generated from documentation strings embedded in the code itself.
Note
For all code examples it is assumed that gepard package is first imported as:
import gepard as g
1. Theory framework
theory module
Definition of theory frameworks.
- class gepard.theory.Theory(**kwargs)[source]
Bases:
object
Class of theory frameworks for calculation of observables.
- Parameters:
name – short unique model name
texname – TeX model name for (e.g. for plot annotation)
description – longer description of the model
This is a base class for a complete theory framework. It implements the generic routines for calculation of observables and uncertainty propagation.
- chisq_single(points: DataSet, asym: bool = False, **kwargs) float [source]
Return total chi-square.
- Parameters:
points – measurements with uncertainties, observable is named in observable attribute of each DataPoint, value is val and uncertainty is err.
asym – if measurements provide asymmetric uncertainties errplus and errminus, this enables their usage
**kwargs – keyword arguments
- Returns:
Total chi^square for points.
Notes
If the theory or model provide uncertainties, they are ignored - only experimental uncertainties are taken into account.
- chisq(points: DataSet, asym: bool = False, **kwargs) float
Return total chi-square.
- Parameters:
points – measurements with uncertainties, observable is named in observable attribute of each DataPoint, value is val and uncertainty is err.
asym – if measurements provide asymmetric uncertainties errplus and errminus, this enables their usage
**kwargs – keyword arguments
- Returns:
Total chi^square for points.
Notes
If the theory or model provide uncertainties, they are ignored - only experimental uncertainties are taken into account.
- predict(pt: DataPoint, uncertainty: bool = False, **kwargs) float [source]
Give prediction for DataPoint pt.
- Parameters:
pt – instance of DataPoint
uncertainty – if available, produce tuple (mean, uncertainty)
**kwargs – keyword arguments
- Keyword Arguments:
observable – string. Default is pt.observable. It is acceptable also to pass CFF or x-space GPD as observable, e.g., observable = ‘ImH’
parameters – dictionary which will temporarily update model’s parameters
orig_conventions – give prediction using original conventions of the given DataPoint (e.g. for plotting)
- Returns:
Predicted value for observable. If uncertainty is requested, tuple (value, uncertainty) is returned.
model module
Base classes for models of “soft” hadronic structure functions.
Elastic electromagnetic form factors
Generalized parton distribution functions (GPDs)
Compton form factors (for DVCS)
Actual implementations are in other files. Here only generic treatment of generalized parametrized model is coded.
Todo
Model defined by grid of numbers
Flavored models
- class gepard.model.Model(**kwargs)[source]
Bases:
Theory
Base class for all models.
Instance of this class specifies structure of relevant hadrons. Methods provided are typically GPDs, CFFs, elastic FFs, DVMP transition TFFs, DAs, etc. Main subclasses are:
ParameterModel which depends on real parameters (some of which can be provided by minimization routine in the fitting procedure).
NeuralModel where structure functions are represented as neural nets (not yet implemented)
GridModel where values of structure functions are represented as grids of numbers, which may be interpolated (not yet implemented)
These are then further subclassed to model actual structure functions.
- __init__(**kwargs) None [source]
- class gepard.model.ParameterModel(**kwargs)[source]
Bases:
Model
Base class for all parametrized models.
- parameters
dict {‘par0’: float, …}. Actual value of parameter.
- parameters_fixed
dict {‘par0’: bool, …}. Is parameter value fixed? Considered False if non-existent. Once Fitter object is created, user should manipulate this dict only via Fitter methods.
- parameters_limits
dict {‘par0: (float, float), …}. Allowed range for fitting. Considered (-inf, inf) if non-existent. Once Fitter object is created, user should manipulate this dict only via Fitter methods.
- __init__(**kwargs) None [source]
- add_parameters(newpars: dict)[source]
Append newpars to parameters.
- add_parameters_limits(newlimits: dict)[source]
Append newlimits to parameters_limits.
- _release_parameters(*pars: str)[source]
Release parameters for fitting.
- Parameters:
*pars – Names of parameters to be released
Notes
User should relase and fix parameters using methods of Fitter instance. This then calls this private ParameterModel method.
- _fix_parameters(*pars: str)[source]
Fix parameters so they are not fitting variables.
- Parameters:
*pars – Names of parameters to be fixed. If first name is ‘ALL’ then fix all parameters.
Notes
User should relase and fix parameters using methods of Fitter instance. This then calls this private ParameterModel method.
- free_parameters() List[str] [source]
Return list of names of free fitting parameters.
- print_parameters()[source]
Print fitting parameters and their errors.
dvcs module
Deeply Virtual Compton Scattering (DVCS) observables.
- class gepard.dvcs.DVCS(**kwargs)[source]
Bases:
Theory
DVCS observables base class.
Implements cross-section for electroproduction of polarized real photon, on polarized nucleon target, as well as derived cross-sections and asymmetries. Subclasses should, as their methods, implement expressions for squared BH, interference and squared DVCS amplitudes: - TBH2unp, TINTunp, TDVCS2unp (for unpolarized target) - TBH2LP, TINTLP, TDVCS2LP (for longitudinally polarized target) - TBH2TP, TINTTP, TDVCS2TP (for transversally polarized target)
Implemented subclasses are:
BMK - From Belitsky, Mueller and Kirchner arXiv:hep-ph/0112108
hotfixedBMK - simple valence xB region improvement by Dieter
BM10ex
BM10 - Belitsky, Mueller and Ji
BM10tw2 - BM10 with higher twists set to zero
- PreFacSigma(pt: DataPoint) float [source]
Overall prefactor of 4-fold XS.
- Parameters:
pt – instance of DataPoint
- Returns:
Overal prefactor from Eq. (22) of BMK, times 2pi because of proton Phi integration and times y/Q2 because of dy -> dQ2. Converted to nanobarns.
- XS(pt: DataPoint, **kwargs) float [source]
Differential 4-fold e p –> e p gamma cross section.
- Parameters:
pt – DataPoint instance
**kwargs – keyword arguments
- Keyword Arguments:
vars (dict) – dict which can override pt kinematics, e.g., vars={‘phi’: 0}
flip (string, list) – flip the sign of pt attribute, e.g., flip=’in1polarization’
- Returns:
Cross section.
This is for calculation of fully beam and target polarized cross-section. Most of the usually measured cross-sections and asymmetries are derived from this one.
Todo
transversal target BMK/Trento switching
- _XGAMMA_DVCS_t_Approx(pt)[source]
Partial DVCS (gamma* p -> gamma p) cross section differential in t.
- Parameters:
pt – instance of DataPoint
- Returns:
Cross section. Approx. formula used in NPB10 paper.
- _XGAMMA_DVCS_t_Ex(pt)[source]
Partial DVCS (gamma* p -> gamma p) cross section differential in t.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
Cross section
Todo
Htilde is missing here. Small at low-x, but bigger than some terms that are retained.
- _XGAMMA_DVCS_t(pt)
Partial DVCS (gamma* p -> gamma p) cross section differential in t.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
Cross section
Todo
Htilde is missing here. Small at low-x, but bigger than some terms that are retained.
- XSintphi(pt: DataPoint, **kwargs) float [source]
XS integrated over azimuthal angle.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
Cross section (unpolarized)
Todo
This is unnecessary function. Should be changed to XUU.
- _XCLU(pt, **kwargs)[source]
4-fold beam charge-spin cross section difference.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
D_{CS,U}/2, as measured by COMPASS.
- XCLU(pt, **kwargs)[source]
4-fold beam charge-spin cross section difference.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
D_{CS,U}/2, as measured by COMPASS. (NOT TESTED.)
- _XCUU(pt, **kwargs)[source]
4-fold beam charge-spin cross section sum.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
S_{CS,U}/2, as measured by COMPASS.
- XCUU(pt, **kwargs)[source]
4-fold beam charge-spin cross section sum.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
S_{CS,U}/2, as measured by COMPASS. (NOT TESTED.)
- _ALUapprox(pt, **kwargs)[source]
Calculate beam spin asymmetry.
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
Beam spin asymmetry A_LU. For harmonics, fast approximate formula is used.
- ALU(pt, **kwargs)
Calculate beam spin asymmetry.
- TSA(pt, **kwargs)[source]
Calculate target spin asymmetry (AUL or AUT).
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
Target spin asymmetry. Whether AUL or AUT is calculated is determined by the pt.in2polarizationvector being ‘L’ or ‘T’.
- BTSA(pt, **kwargs)[source]
Calculate beam-target spin asymmetry (ALL or ALT).
- Parameters:
pt – instance of DataPoint
**kwargs – keyword arguments
- Returns:
Beam-target spin asymmetry. Whether ALL or ALT is calculated is determined by the pt.in2polarizationvector being ‘L’ or ‘T’.
- _AUTI(pt, **kwargs)[source]
Calculate trans. target asymmetry, defined by HERMES 0802.2499 Eq. (15).
- AUTI(pt, **kwargs)[source]
Calculate trans. target asymmetry, defined by HERMES 0802.2499 Eq. (15).
- _AUTDVCS(pt, **kwargs)[source]
Calculate trans. target asymmetry, defined by HERMES 0802.2499 Eq. (14).
- AUTDVCS(pt, **kwargs)[source]
Calculate trans. target asymmetry, defined by HERMES 0802.2499 Eq. (14).
cff module
Definitions of Compton Form Factors.
- class gepard.cff.CFF(**kwargs)[source]
Bases:
ParameterModel
Base class for CFFs.
CFFs are set to be zero here. Actual models are built by subclassing this.
- allCFFs = ['ImH', 'ReH', 'ImE', 'ReE', 'ImHt', 'ReHt', 'ImEt', 'ReEt']
- allCFFsb = ['ImH', 'ReH', 'ImE', 'ReE', 'ImHt', 'ReHt', 'ImEt', 'ReEb']
- allCFFeffs = ['ImHeff', 'ReHeff', 'ImEeff', 'ReEeff', 'ImHteff', 'ReHteff', 'ImEteff', 'ReEteff']
- print_CFFs(pt: DataPoint, format: str = None)[source]
Print values of CFFs at given kinematic point.
- Parameters:
pt – DataPoint instance
format – ‘mma’ to get output pastable into Mathematica
- cff(pt: DataPoint) ndarray [source]
Return array(ReH, ImH, ReE, …) for kinematic point.
- Parameters:
pt – DataPoint instance
- Returns:
Eight CFFs (ReH, ImH, ReE, …, ImEt).
This is generic top-class method that only gathers results of dedicated ReH(), ImH(), etc. functions. The idea is that this method can be implemented more efficiently in subclases where components of CFFs can be calculated at the same time or in parallel.
- is_within_model_kinematics(pt: DataPoint)[source]
Check if kinematics is sensible.
- Parameters:
pt – DataPoint instance
- Returns:
True if pt kinematics is inside the model validity range.
- ImE(pt)
- ImEeff(pt)
- ImEt(pt)
- ImEteff(pt)
- ImH(pt)
- ImHeff(pt)
- ImHt(pt)
- ImHteff(pt)
- ReE(pt)
- ReEeff(pt)
- ReEt(pt)
- ReEteff(pt)
- ReH(pt)
- ReHeff(pt)
- ReHt(pt)
- ReHteff(pt)
- name = 'ReEteff'
- class gepard.cff.MellinBarnesCFF(**kwargs)[source]
Bases:
CFF
Class of models built by Mellin-Barnes integration.
- class gepard.cff.DispersionCFF(**kwargs)[source]
Bases:
CFF
Use dispersion relations for real parts of CFFs.
methods: ReH, ReE, ReHt, ReEt, subtraction Subclass should implement ansaetze for ImH, ImE, ImHt, ImEt and subtraction. This class implements just dispersion integrals.
- dispargV(x, fun, pt)[source]
Integrand of the dispersion integral (vector case).
- Parameters:
x – integration variable, longitudinal momentum fraction
fun – function providing imaginary part of CFF
pt – DataPoint instance
- Returns:
Integrand of dispersion integral. With variable change x->x^(1/(1-ga))=u in order to tame the singularity at x=0.
- dispargA(x, fun, pt)[source]
Integrand of the dispersion integral (axial-vector case).
- Parameters:
x – integration variable, longitudinal momentum fraction
fun – function providing imaginary part of CFF
pt – DataPoint instance
- Returns:
Integrand of dispersion integral. With variable change x->x^(1/(1-ga))=u in order to tame the singularity at x=0.
- _ReV(pt, imfun, subsign)[source]
Real part of vector CFFs H and E.
- Parameters:
pt – DataPoint instance
imfun – function providing imaginary part of CFF
subsign – sign of subtraction constant (-1 for H, +1 for E)
- Returns:
Dispersion integral over imfun minus/plus subtraction constant.
- class gepard.cff.DispersionFixedPoleCFF(**kwargs)[source]
Bases:
DispersionCFF
,PionPole
Model for CFFs as in arXiv:0904.0458.
- class gepard.cff.DispersionFreePoleCFF(**kwargs)[source]
Bases:
DispersionFixedPoleCFF
Model for CFFs as in arXiv:0904.0458. + free pion pole.
- class gepard.cff.HybridCFF(**kwargs)[source]
Bases:
MellinBarnesCFF
,DispersionFixedPoleCFF
,CFF
Combines MB model for small xB and DR model for valence xB.
Todo
Check general consistency for xi != pt.xi for imag CFFs.
gpd module
GPD models in conformal moment j-space.
- param j:
complex-space conformal moment
- param t:
momentum transfer squared
par: dictionary {‘parmeter1_name’: value1, …}
- returns:
conformal moments of GPD as npts x 4 array, where npts is number of points on Mellin-Barnes contour and 4 flavors are: (1) – singlet quark (2) – gluon (3) – u_valence (4) – d_valence
Valence here means “valence-like GPD”. See hep-ph/0703179 for description.
- gepard.gpd.qj(j: ndarray, t: float, poch: int, norm: float, al0: float, alp: float, alpf: float = 0, val: int = 0) ndarray [source]
GPD building block Q_j with reggeized t-dependence.
- Parameters:
j – complex conformal moment
t – momentum transfer
poch – pochhammer (beta+1)
norm – overall normalization
al0 – Regge intercept
alp – Regge slope (leading pole)
alpf – Regge slope (full)
val – 0 for sea, 1 for valence partons
- Returns:
conformal moment of GPD with Reggeized t-dependence,
Examples
>>> qj(0.5+0.3j, 0., 4, 3, 0.5, -0.8) (5.668107685...-4.002820...j)
Notes
There are two implementations of Regge t dependence, one uses alpf \(\alpha'\) parameter (alp should be set to zero)
\[Q_j = N \frac{B(1-\alpha(t)+j, \beta+1)}{B(2-\alpha_0, \beta+1)}\]This is then equal to Eq. (41) of arXiv:hep-ph/0605237 without residual \(F(\Delta^2)\).
The default uses alp parameter, and expression is from Eq. (40) or (41) of arXiv:0904.0458, which takes into account only the leading pole:
\[Q_j = N \frac{B(1-\alpha_0+j, \beta+1)}{B(2-\alpha_0, \beta+1)} \frac{1+j-\alpha_0}{1+j-\alpha(t)}\]and is again defined without residual beta(t) from Eq. (19).
- gepard.gpd.betadip(j: ndarray, t: float, m02: float, delm2: float, pp: int) ndarray [source]
GPD residual dipole t-dependence function.
- Parameters:
j – conformal moment
t – momentum transfer
m02 – mass param
delm2 – mass param - interplay with j
pp – exponent (=2 for dipole)
- Returns:
Dipole residual t-dependence (beta from Eq. (19) of 0904.0458)
- gepard.gpd.betaexp(t: float, m02: float) float [source]
GPD residual exponential t-dependence function.
- Parameters:
t – momentum transfer
m02 – mass parameter
- Returns:
Exponential residual t-dependence (beta from Eq. (19) of 0904.0458)
- gepard.gpd.toy(j: complex, *args) Tuple[complex, complex, complex, complex] [source]
Return ‘toy’ (no params) singlet GPD ansatz.
- gepard.gpd.test(j: complex, t: float, par: dict) Tuple[complex, complex, complex, complex] [source]
Return simple testing singlet GPD ansatz.
- gepard.gpd.singlet_ng_constrained(j: ndarray, t: float, par: dict, residualt: str = 'dipole') ndarray [source]
Singlet-only GPD ansatz, with ng parameter constrained by sum-rule.
- Parameters:
j – conformal moment
t – momentum transfer
par – parameters dict
residualt – residual t-dependence type (‘dipole’ or ‘exp’)
- Returns:
GPD ansatz, as numpy array
Notes
This ansatz is used for all published KM fits, for the sea parton part.
- gepard.gpd.singlet_ng_constrained_E(j: ndarray, t: float, par: dict, residualt: str = 'dipole') ndarray [source]
Singlet-only GPD ansatz, with ng parameter constrained by sum-rule.
- Parameters:
j – conformal moment
t – momentum transfer
par – parameters dict
residualt – residual t-dependence type (‘dipole’ or ‘exp’)
- Returns:
GPD ansatz, as numpy array
Notes
This ansatz is used for all published KM fits, for the sea parton part.
- gepard.gpd.ansatz07(j: ndarray, t: float, par: dict) ndarray [source]
GPD ansatz from paper hep-ph/0703179.
- gepard.gpd.ansatz07_fixed(j: ndarray, t: float, type: str) ndarray [source]
GPD ansatz from hep-ph/0703179 with fixed parameters.
- Parameters:
j – conformal moment
t – momentum transfer
type – ‘soft’, ‘hard’, ‘softNS’, ‘hardNS’
- Returns:
GPD ansatz, as numpy array
Notes
This is the same as ansatz07, only instead of passing parameter dict, user passes type string choosing particular fixed parameter choices from the paper above.
- class gepard.gpd.GPD(**kwargs)[source]
Bases:
ParameterModel
Base class of all GPD models.
- Parameters:
p – pQCD order (0 = LO, 1 = NLO, 2 = NNLO)
scheme – pQCD scheme (‘msbar’ or ‘csbar’)
nf – number of active quark flavors
Q02 – Initial Q0^2 for GPD evolution.
r20 – Initial mu0^2 for alpha_strong definition.
asp – alpha_strong/(2*pi) at scale r20 for (LO, NLO, NNLO)
residualt – residual t dependence (‘dipole’ or ‘exp’)
- class gepard.gpd.ConformalSpaceGPD(**kwargs)[source]
Bases:
GPD
,MellinBarnes
Base class of GPD models built in conformal moment space.
- Parameters:
c – intersection of Mellin-Barnes curve with real axis
phi – angle of Mellin-Barnes curve with real axis
Notes
This just takes care of initialization of Mellin-Barnes contour points, and evolved Wilson coeffs, and MB Gauss integration weights. Actual choice and code for GPDs is provided by subclasses.
- H(eta: float, t: float) ndarray [source]
Return (npts, 4) array H_j^a for all j-points and 4 flavors.
- E(eta: float, t: float) ndarray [source]
Return (npts, 4) array E_j^a for all j-points and 4 flavors.
- Hx(x: float, eta: float, t: float, Q2: float = 4.0) ndarray [source]
Return x-space GPD H.
- Parameters:
x – kinematics info
eta – kinematics info
t – kinematics info
Q2 – kinematics info
- Returns:
x-space GPD. 3-dim vector (singlet quark, gluon, non-singlet quark) is returned by transforming original conformal moment space (j-space) model.
Todo
Non-singlet component is set to zero. We need to check normalization/symmetrization first.
- Ex(x: float, eta: float, t: float, Q2: float = 4.0) ndarray [source]
Return x-space GPD E.
- Parameters:
x – kinematics info
eta – kinematics info
t – kinematics info
Q2 – kinematics info
- Returns:
x-space GPD. 3-dim vector (singlet quark, gluon, non-singlet quark) is returned by transforming original conformal moment space (j-space) model.
Todo
Code duplication. Merge with Hx
- class gepard.gpd.TestGPD(**kwargs)[source]
Bases:
ConformalSpaceGPD
Simple testing ansatz for GPDs.
- class gepard.gpd.PWNormGPD(**kwargs)[source]
Bases:
ConformalSpaceGPD
Singlet-only model for GPDs with three SO(3) partial waves.
- Parameters:
p – pQCD order (0 = LO, 1 = NLO, 2 = NNLO)
scheme – pQCD scheme (‘msbar’ or ‘csbar’)
nf – number of active quark flavors
Q02 – Initial Q0^2 for GPD evolution.
r20 – Initial mu0^2 for alpha_strong definition.
asp – alpha_strong/(2*pi) at scale r20 for (LO, NLO, NNLO)
residualt – residual t dependence (‘dipole’ or ‘exp’)
c – intersection of Mellin-Barnes curve with real axis
phi – angle of Mellin-Barnes curve with real axis
Notes
Subleading PWs are proportional to the leading one, and only their norms are fitting parameters. Norms of second PWs is given by parameers ‘secs’ (quarks) and ‘secg’ gluons, and norm of third PWs is given by ‘this’ and ‘thig’.
This is used for modelling sea partons in KM10-KM20 models.
dvmp module
Deeply Virtual Meson Production (DVMP) observables.
- class gepard.dvmp.DVMP(**kwargs)[source]
Bases:
Theory
DVMP observables.
Implements cross-section for electroproduction of meson.
- class gepard.dvmp.MellinBarnesTFF(**kwargs)[source]
Bases:
ParameterModel
DVMP Transition Form Factors modelled as Mellin-Barnes integral.
eff module
Models for Elastic (Electromagnetic) Form Factors.
- class gepard.eff.EFF[source]
Bases:
object
Dirac and Pauli elastic (electromagnetic) form factors F_1 and F_2.
2. Perturbative QCD
adim module
QCD anomalous dimensions.
Note
Functions in this module have as first argument Mellin moment n=j+1, where j is conformal moment used everywhere else. Thus, they should always be called as f(j+1, …).
- gepard.adim.non_singlet_LO(n: ndarray, nf: int, prty: int = 1) complex [source]
Non-singlet LO anomalous dimension.
- Parameters:
n (complex) – which moment (= Mellin moment for integer n)
nf (int) – number of active quark flavors
prty (int) – 1 for NS^{+}, -1 for NS^{-}, irrelevant at LO
- Returns:
Non-singlet LO anomalous dimension.
- gepard.adim.singlet_LO(n: ndarray, nf: int, prty: int = 1) ndarray [source]
Singlet LO anomalous dimensions.
- Parameters:
n (complex) – which moment (= Mellin moment for integer n)
nf (int) – number of active quark flavors
prty (int) – C parity, irrelevant at LO
- Returns:
- 2x2 complex matrix ((QQ, QG),
(GQ, GG))
- gepard.adim.non_singlet_NLO(n: complex, nf: int, prty: int) complex [source]
Non-singlet anomalous dimension.
- Parameters:
n (complex) – which moment (= Mellin moment for integer n)
nf (int) – number of active quark flavors
prty (int) – 1 for NS^{+}, -1 for NS^{-}
- Returns:
Non-singlet NLO anomalous dimension.
- gepard.adim.singlet_NLO(n: complex, nf: int, prty: int = 1) ndarray [source]
Singlet NLO anomalous dimensions matrix.
- Parameters:
n (complex) – which moment (= Mellin moment for integer n)
nf (int) – number of active quark flavors
prty (int) – C parity
- Returns:
Matrix (LO, NLO) where each is in turn 2x2 complex matrix ((QQ, QG), (GQ, GG))
- gepard.adim.block(n: complex, nf: int) ndarray [source]
LO+NLO block anomalous dimensions matrix.
- Parameters:
n (complex) – which moment (= Mellin moment for integer n)
nf (int) – number of active quark flavors
- Returns:
- block[k, p, i, j]
k is index if n is array, otherwise 0
p is pQCD order (0=LO, 1=NLO)
i, j in [Q, G, NS+, NS-], forming 4x4 complex matrix ((QQ, QG, 0, 0), (GQ, GG, 0, 0), ( 0, 0, NS+, 0), ( 0, 0, 0, NS-))
qcd module
Perturbative QCD functions.
Coefficients of beta function of QCD up to order \(\alpha_s^5\) (NNNLO), normalized by
with
Beyond NLO the QCD colour factors are hard-wired in this routine, and the numerical coefficients are truncated to six digits.
QCD coupling alpha strong is obtained by integrating the evolution equation for a fixed number of massless flavours NF. Except at leading order (LO), result is obtained using a fourth-order Runge-Kutta integration.
- gepard.qcd.beta(p: int, nf: int) float [source]
QCD beta function coefficient.
- Parameters:
p (int) – pQCD order, 0=LO, 1=NLO, 2=NNLO
nf (int) – number of active quark flavors
- Returns:
QCD beta function coefficient
- Return type:
float
Examples
>>> beta(0, 3) -9.0
- gepard.qcd.as2pf(p: int, nf: int, r2: float, as0: float, r20: float) float [source]
QCD beta function coefficient.
- Parameters:
p – pQCD order, 0=LO, 1=NLO, 2=NNLO
nf – number of active quark flavors
r2 – final momentum scale squared
as0 – initial value for a_strong/(2 Pi)
r20 – initial momentum scale squared
- Returns:
final value for a_strong/(2 Pi)
- Return type:
float
Examples
>>> as2pf(0, 3, 8., 0.3, 4.) 0.15497879500975464
evolution module
GPD evolution operator mathcal{E}.
- returns:
Numpy array evol[p, k, j] where flavor index j takes values in the evolution basis: (1) – singlet quark (2) – gluon (3) – NS(+) (4) – NS(-) (not tested!)
Notes
GPD models may be defined in different basis and should provide appropriate transformation matrix
Todo
Array indices ordering is a bit of a mess
- gepard.evolution.lambdaf(gam0: ndarray) ndarray [source]
Return eigenvalues of singlet LO anomalous dimensions matrix.
- Parameters:
gam0 – matrix of LO anomalous dimensions of shape […, 2, 2]
- Returns:
- lam[…, a], a in [+, -] where
and - are eigenvalues in singlet quark - gluon space
- gepard.evolution.projectors(gam0)[source]
Projectors on evolution quark-gluon singlet eigenaxes.
- Parameters:
gam0 – LO anomalous dimension
- Returns:
- eigenvalues of LO an. dimm matrix lam[a, k] # Eq. (123)
- pr: Projector pr[k, a, i, j] # Eq. (122)
k is MB contour point index a in [+, -] i,j in {Q, G}
- Return type:
lam
- gepard.evolution.rnlof(m) Tuple[ndarray, ndarray, ndarray] [source]
Return projected singlet NLO mu-independent P(bet*gam0 - gam1)P.
- Parameters:
m – instance of the model
- Returns:
lam: eigenvalues of LO an. dimm matrix lam[a, k] # Eq. (123) pr: Projector pr[k, a, i, j] # Eq. (122) r1proj: r1proj[a,b] = sum_ij pr[a,i,j] R1[i,j] pr[b,i,j] # Eq. (124) a,b in {+,-}; i,j in {Q, G}
- Return type:
Tuple of three arrays, namely
- gepard.evolution.rnlonsf(m, prty: int) ndarray [source]
Return NLO mu-independent part of evolution operator.
- Parameters:
m – instance of the model
j – MB contour points (overrides m.jpoints)
prty – 1 for NS^{+}, -1 for NS^{-}
- Returns:
second mu-independent factor from Eq. (117)
- Return type:
r1
- gepard.evolution.cb1(m, R, zn, zk)[source]
Non-diagonal part of singlet NLO evol op.
- Parameters:
m – instance of the model
zn – non-diagonal evolution Mellin-Barnes integration point (array)
zk – COPE Mellin-Barnes integration point (not array! - FIXME)
- Returns:
non-diagonal part of evol. op. from Eq. (140). For NS=True we get array cb1[zn=j] and dependent on zk=k. For NS=False we get array cb1[zn=j, i, j] and dependent on zk=k, where i,j are in [Q, G].
- Return type:
B_jk
Note
It’s multiplied by GAMMA(3/2) GAMMA(K+3) / (2^(K+1) GAMMA(K+5/2)) so it’s ready to be combined with diagonally evolved C_K = 1 + … where in the end everything will be multiplied by
(2^(K+1) GAMMA(K+5/2)) / ( GAMMA(3/2) GAMMA(K+3) )
- gepard.evolution.cb1ns(m, R, zn, zk)[source]
Non-diagonal part of non-singlet NLO evol op.
- Parameters:
m – instance of the model
zn – non-diagonal evolution Mellin-Barnes integration point (array)
zk – COPE Mellin-Barnes integration point (not array! - FIXME)
- Returns:
non-diagonal part of evol. op. from Eq. (140). For NS=True we get array cb1[zn=j] and dependent on zk=k. For NS=False we get array cb1[zn=j, i, j] and dependent on zk=k, where i,j are in [Q, G].
- Return type:
B_jk
Note
It’s multiplied by GAMMA(3/2) GAMMA(K+3) / (2^(K+1) GAMMA(K+5/2)) so it’s ready to be combined with diagonally evolved C_K = 1 + … where in the end everything will be multiplied by
(2^(K+1) GAMMA(K+5/2)) / ( GAMMA(3/2) GAMMA(K+3) )
- gepard.evolution.evolop(m, R: float, process_class: str) ndarray [source]
GPD evolution operator.
- Parameters:
m – instance of the model
R – ratio of astrong(mu_fact)/astrong(mu_input)
- Returns:
Array corresponding Eq. (121) of Towards DVCS paper. evolop[s, k, p, i, j] - s is index of SO(3) partial wave - k is index of point on MB contour, - p is pQCD order (0=LO, 1=NLO) - i, j in [Q, G, NSP, …] i.e. in m.evolution_basis
Todo
Argument should not be a process class but GPD vs PDF, or we should avoid it altogether somehow. This serves here only to get the correct choice of evolution scheme (msbar vs csbar).
- gepard.evolution.evolop_da(m, R: float, prty=1) ndarray [source]
DA evolution operator. Non-singlet only
- Parameters:
m –
instance of the model
- gpoints: array of Gegenbauer indices
R: ratio of astrong(mu_fact_da)/astrong(mu_input)
prty: C parity of DA
- Returns:
evola_da[g, p] - g is DA Gegenbauer index in m.gpoints - p is pQCD order (0=LO, 1=NLO)
Todo
Merge this with evolop for GPDs. Ugly code duplication of the most complex part of the evolution code.
wilson module
Wilson coefficients and evolved Wilson coefficients.
- gepard.wilson.calc_wc(m: Theory, process_class: str)[source]
Calculate Wilson coeffs.
- Parameters:
m – instance of the Theory class
process_class – ‘DIS’, ‘DVCS’ or ‘DVMP’
- Returns:
- s in range(npws), k in range(npts), p in [LO, NLO],
a in [Q, G, NSP, NSM]
- Return type:
wc[s, k, p, a]
- gepard.wilson.calc_wc_dvmp(m: Theory, g: int)[source]
Calculate Wilson coeffs for DVMP.
- Parameters:
m – instance of the Theory class
g – index of DA Gegenbauer moment (often k in published papers)
- Returns:
s in range (npws), k in range(npts), p in [LO, NLO], f in [Q,G,NSP]
- Return type:
wc[s, k, p, f]
- gepard.wilson.calc_pj(m: Theory, x: float, eta: float)[source]
Calculate gegenbauer p_j to transform GPD from j to x space.
- Parameters:
m – instance of the Theory class
x – GPD kinematical variables
eta – GPD kinematical variables
- Returns:
- s in range(npws), k in range(npts),
a in [Q, G, …] i.e. m.evolution_basis
- Return type:
p_j[s, k, a]
Todo
Check conventions for various quark combinations.
- gepard.wilson.calc_wce(m: Theory, Q2: float, process_class: str)[source]
Calculate evolved Wilson coeffs for given Q2, for all PWs.
- Parameters:
m – instance of the Theory
Q2 – process scale (so renormalization scale is Q2/m.rr2 and factorization scale is Q2/m.rf2)
process_class – ‘DIS’ or ‘DVCS’
- Returns:
s in range(npwmax), k in range(npts), b in [Q,G,NSP]
- Return type:
wce[s,k,b]
- gepard.wilson.calc_wce_dvmp(m: Theory, Q2: float)[source]
Calculate evolved DVMP Wilson coeffs for given Q2, for all PWs.
- Parameters:
m – instance of the Theory
Q2 – default renormalization and factorization scale (can be changed with m.rdvmpr2, m.rf2 and m.rdaf2)
- Returns:
- s in range(npwmax), k in range(npts),
g in gegens, j in [Q,G,NSP]
- Return type:
wce[s,k,g,j]
Todo
Code duplication, merge with calc_wce()
- gepard.wilson.calc_j2x(m: Theory, x: float, eta: float, Q2: float)[source]
Calculate j2x coeffs, combined with evolution operator.
- Parameters:
m – instance of the Theory
x – long. momentum fraction argument of GPD
eta – skewness
Q2 – final evolution scale
- Returns:
s in range(npwmax); k in range(npts); i,j in [Q,G,NSP]
- Return type:
wce[s,k,i,j]
Todo
Implement general (eta != x) j to x transform.
3. Fitting
fitter module
Implementation of fitting algorithms.
- class gepard.fitter.Fitter(**kwargs)[source]
Bases:
object
Superclass for fitting procedures/algorithms.
- class gepard.fitter.MinuitFitter(fitpoints: DataSet, theory: Theory, **kwargs)[source]
Bases:
Fitter
Fits using iminuit Python frontend to MINUIT2 C++ library.
- Parameters:
fitpoints (data.DataSet) – points to fit to
theory (theory.Theory) – theory/model to be fitted
4. Utilites
data module
Representation of experimental data.
DataPoint – class for kinematical points, possibly representing measurements DataSet – container for DataPoint instances
dset – dictionary with public datasets
- gepard.data.loaddata(resource)[source]
Return dictionary {id : DataSet, …} out of files in resource package.
- exception gepard.data.KinematicsError[source]
Bases:
Exception
Exception thrown when kinematics is unphysical.
- class gepard.data.DataPoint(kindict: dict = None, **kwargs)[source]
Bases:
dict
Kinematical point. May correspond to actual measurement.
- Parameters:
xB (float) – Bjorken x_B
t (float) – momentum transfer to target squared
Q2 (float) – Q^2
phi (float) – azimuthal angle
FTn (int) – harmonic of azimuthal angle, e.g. -1 for sin(phi)
observable (str) – name of the measured observable
val (float) – measurement value
err (float) – total uncertainty of val
units (dict) – pysical units of variables
kindict (dict) – for old, alternative passing of kinematics values, like
g.DataPoint({'xB': 0.1, 't': -0.2, 'Q2': 4.0})
There are other args as well.
Examples
>>> pt = g.DataPoint(xB=0.1, t=-0.2, Q2=4.0)
Todo
kindict is temporarily kept for backward compatibility. You should not rely on it.
- update_from_grid(gridline, dataset)[source]
Take data gridline, and update point atributes.
- Parameters:
gridline (list) – list constructed from one row of data grid in data file.
dataset (
DataSet
) – container that is to contain this DataPoint
Note
It is assumed that data gridline is of the form:
x1 x2 .... y1 y1stat y1syst
where y1syst need not be present, or can have one or two values, syst+ and syst- (Further elements are ignored.)
Todo
This passing of higher-level DataSet as argument sounds wrong! (See comment about aquisition in class docstring.)
- class gepard.data.DataSet(datapoints=None, datafile=None)[source]
Bases:
list
A container for DataPoint instances.
- Parameters:
datapoints (list) – list of
DataPoint
instancesdatafile (str) – data file to be parsed, represented as string
Either take explicit list of DataPoints or get them by parsing datafile.
Information that is common to all data of a given dataset (i.e. which is contained in a preamble of datafile is accessible via attributes:
- observable
name of observable measured
- Type:
str
- collaboration
name of experimenatal collaboration
- Type:
str
- units
pysical units of variables
- Type:
dict
- newunits
internal pysical units of variables
- Type:
dict
There are other attributes as well.
- parse(dataFile)[source]
Parse dataresource string and return tuple (preamble, data).
- Parameters:
dataFile (str) – datafile to be parsed, as string
- Return type:
(preamble, data) (tuple)
preamble is dictionary obtained by converting datafile preamble items into dictionary items like this:
y1 = AC from datafile goes into {'y1' : 'AC', ...}
data is actual numerical grid of experimental data converted into list of lists.
- gepard.data._str2num(s: str) int | float [source]
Convert string to number, taking care if it should be int or float.
- Parameters:
s – string to be converted
- Returns:
number Union[int, float]
http://mail.python.org/pipermail/tutor/2003-November/026136.html
- gepard.data._complete_xBWQ2(kin)[source]
Make trio {xB, W, Q2} complete if two of them are given in ‘kin’.
- gepard.data._fill_kinematics(kin, old={})[source]
Update kinematics in place.
Complete set of kinematical variables is {xB, t, Q2, W, s, xi, tm, phi}. Using standard identities, missing values are calculated, if possible, first solely from values given in ‘kin’, and then, second, using values in ‘old’, if provided.
- gepard.data.select(dataset: DataSet, criteria: List[str] = [], logic='AND')[source]
Filter point of dataset satisfying criteria.
- Parameters:
dataset – DataSet or any collection of DataPoints
criteria – list of strings describing selection criteria
logic – ‘AND’ or ‘OR’: how to logically combine criteria
- Returns:
DataSet of DataPoints satisfying criterion.
Example
criteria=[‘xB > 0.1’, ‘observable == ALU’]
- gepard.data.FTF(data, testdata=None, cosmax=None, sinmax=None, inverse=False)[source]
Fourier series fit to data (takes and returns pandas dataframe).
cosmax, sinmax - index of highest harmonics inverse = True - data values ARE harmonics, calculate function(phi)
- gepard.data.FTFMC(data, nsamples=100, cosmax=None, sinmax=None, inverse=False)[source]
Fourier series fit to data with MC error propagation (takes and returns pandas dataframe). :param cosmax: index of highest cosine harmonic :param sinmax: index of highest sine harmonics :param inverse: if True data values ARE harmonics, calculate function(phi) (default: False)
- gepard.data.cvsets(df_in, nfolds=3, shuffle=True)[source]
Return n-fold cross-validation sets [(train1, valid1), (train2, valid2), …].
Copies data.
- gepard.data.FTanalyse(bins, HMAX=3, nf=4, Nrep=1)[source]
Determine the number of harmonics present in bins according to n-fold cross-validation.
- Parameters:
bins – dictionary with bins
HMAX – highest harmonic used in searches
NS – number of replicas for MC error propagation
Nrep – number of CV repetitions (probably wrong to make > 1)
nf – number of folds for cross-validation
special module
Special functions of complex arguments.
poch: Pochhammer symbol dpsi: polygamma function Sn: harmonic sums
- gepard.special.pochhammer(z: complex | ndarray, m: int) complex | ndarray [source]
Pochhammer symbol.
- Parameters:
z – complex argument
m – integer index
- Returns:
pochhammer(z,m)
- Return type:
complex
- gepard.special.poch(z: complex | ndarray, m: int) complex | ndarray
Pochhammer symbol.
- Parameters:
z – complex argument
m – integer index
- Returns:
pochhammer(z,m)
- Return type:
complex
- gepard.special.dpsi_one(z: complex, m: int) complex [source]
Polygamma - m’th derivative of Euler gamma at z.
- gepard.special.S2_prime(z: complex | ndarray, prty: int) complex | ndarray [source]
Curci et al Eq. (5.25).
- gepard.special.S3_prime(z: complex | ndarray, prty: int) complex | ndarray [source]
Curci et al Eq. (5.25).
- gepard.special.delS2(z: complex | ndarray) complex | ndarray [source]
Return Harmonic sum S_2 difference.
- Parameters:
z – complex argument
- Returns:
delS2((z+1)/2) From Eq. (4.13) of 1310.5394. Note halving of the argument.
- gepard.special.deldelS2(j: complex | ndarray, k: int) complex | ndarray [source]
Return diference of harmonic sum S_2 differences.
- Parameters:
j – complex argument
k – integer index
- Returns:
Equal to delS2((j+1)/2, (k+1)/2) From Eq. (4.38) of 1310.5394. Note halving of the argument.
- gepard.special.Sm1(z: complex | ndarray, k: int) complex | ndarray [source]
Aux fun. FIXME: not tested.
- gepard.special.MellinF2(n: complex | ndarray) complex | ndarray [source]
Return Mellin transform i.e. x^(N-1) moment of Li2(x)/(1+x).
- Parameters:
n – complex argument
- Returns:
According to Eq. (33) in Bluemlein and Kurth, hep-ph/9708388
mellin module
Mellin-Barnes integrations.
Todo
Various MB routines should be integrated into one.
- class gepard.mellin.MellinBarnes(**kwargs)[source]
Bases:
object
Base class for models built by Mellin-Barnes integration.
- _mellin_barnes_integral_HE(xi, wce, H, E)[source]
Return convolution of evolved Wilson coefs and GPDs H and E.
- _dis_mellin_barnes_integral(xi, wce, pdf)[source]
Return convolution of evolved Wilson coefs and PDFs.
quadrature module
Quadrature formulas, abscissas and weights.
Also numerical derivative routine.
- gepard.quadrature.mellin_barnes(c, phi, accuracy: int = 3, extended: bool = False) Tuple[ndarray, ndarray] [source]
Construct basic MB array.
- Parameters:
c – point of crossing the real axis
phi – angle with the real axis
accuracy – 2*accuracy points per interval
- Returns:
(complex coordinates of MB contour, integration weighths)
- gepard.quadrature.nd_mellin_barnes(accuracy: int = 3) Tuple[ndarray, ndarray] [source]
Construct MB array for non-diagonal evolution operator.
- Parameters:
accuracy – 2*accuracy points per interval
- Returns:
(complex coordinates of MB contour, integration weighths)
Note
Code should be merged with standard mellin_barnes.
- gepard.quadrature.quadSciPy81(func, a, b, args=())[source]
Compute a definite integral using 81-order Gaussian quadrature.
- gepard.quadrature.quadSciPy35(func, a, b, args=())[source]
Compute a definite integral using 35-order Gaussian quadrature.
- gepard.quadrature.quadSciPy18transposed(func, a, b, args=())[source]
Compute a definite integral using 18-order Gaussian quadrature.
- gepard.quadrature.quadSciPy10(func, a, b, args=())[source]
Compute a definite integral using tenth-order Gaussian quadrature.
- gepard.quadrature.quadSciPy10transposed(func, a, b, args=())[source]
Compute a definite integral using fifth-order Gaussian quadrature.
- gepard.quadrature.quad10(func, a, b, args=())[source]
Compute a definite integral using tenth-order Gaussian quadrature.
- gepard.quadrature.quadSciPy5(func, a, b, args=())[source]
Compute a definite integral using fifth-order Gaussian quadrature.
- gepard.quadrature.quadSciPy5transposed(func, a, b, args=())[source]
Compute a definite integral using fifth-order Gaussian quadrature.
- gepard.quadrature.quadSciPy4(func, a, b, args=())[source]
Compute a definite integral using fifth-order Gaussian quadrature.
- gepard.quadrature.PVquadrature(func, a, b, args=())
Compute a definite integral using 18-order Gaussian quadrature.
- gepard.quadrature.Hquadrature(func, a, b, args=())
Compute a definite integral using fifth-order Gaussian quadrature.
- gepard.quadrature.tquadrature(func, a, b, args=())
Compute a definite integral using fifth-order Gaussian quadrature.
- gepard.quadrature.bquadrature(func, a, b, args=())
Compute a definite integral using tenth-order Gaussian quadrature.
- gepard.quadrature.rthtquadrature(func, a, b, args=())
Compute a definite integral using tenth-order Gaussian quadrature.
constants module
Constants, with their numerical values, not to be changed by user.
Also, fixed dictionaries.