Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
hooks:
- id: pydocstyle
files: ^src/
args: ["--add-ignore=D107"]
args: ["--add-ignore=D107,D105"]
additional_dependencies:
- toml
- repo: https://github.com/pre-commit/pre-commit
Expand Down
75 changes: 37 additions & 38 deletions src/eko/gamma.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
r"""
This module contains the QCD gamma function coefficients.
r"""The |QCD| gamma function coefficients.

See :doc:`pQCD ingredients </theory/pQCD>`.
"""
Expand All @@ -10,75 +9,75 @@

@nb.njit(cache=True)
def gamma_qcd_as1():
"""
Computes the first coefficient of the QCD gamma function.
r"""Compute the first coefficient of the |QCD| gamma function.

Implements Eq. (15) of :cite:`Vermaseren:1997fq`.
Implements :eqref:`15` of :cite:`Vermaseren:1997fq`.

Returns
-------
gamma_0 : float
first coefficient of the QCD gamma function :math:`\\gamma_{m,0}^{n_f}`
gamma_0 : float
first coefficient of the |QCD| gamma function :math:`\gamma_{m,0}^{n_f}`

"""
return 4.0


@nb.njit(cache=True)
def gamma_qcd_as2(nf):
"""
Computes the second coefficient of the QCD gamma function.
r"""Compute the second coefficient of the |QCD| gamma function.

Implements Eq. (15) of :cite:`Vermaseren:1997fq`.
Implements :eqref:`15` of :cite:`Vermaseren:1997fq`.

Parameters
----------
nf : int
number of active flavors
nf : int
number of active flavors

Returns
-------
gamma_1 : float
second coefficient of the QCD gamma function :math:`\\gamma_{m,1}^{n_f}`
gamma_1 : float
second coefficient of the |QCD| gamma function :math:`\gamma_{m,1}^{n_f}`

"""
return 202.0 / 3.0 - 20.0 / 9.0 * nf


@nb.njit(cache=True)
def gamma_qcd_as3(nf):
"""
Computes the third coefficient of the QCD gamma function.
r"""Compute the third coefficient of the |QCD| gamma function.

Implements Eq. (15) of :cite:`Vermaseren:1997fq`.
Implements :eqref:`15` of :cite:`Vermaseren:1997fq`.

Parameters
----------
nf : int
number of active flavors
nf : int
number of active flavors

Returns
-------
gamma_2 : float
third coefficient of the QCD gamma function :math:`\\gamma_{m,2}^{n_f}`
gamma_2 : float
third coefficient of the |QCD| gamma function :math:`\gamma_{m,2}^{n_f}`

"""
return 1249.0 - (2216.0 / 27.0 + 160.0 / 3.0 * zeta3) * nf - 140.0 / 81.0 * nf**2


@nb.njit(cache=True)
def gamma_qcd_as4(nf):
"""
Computes the fourth coefficient of the QCD gamma function.
r"""Compute the fourth coefficient of the |QCD| gamma function.

Implements Eq. (15) of :cite:`Vermaseren:1997fq`.
Implements :eqref:`15` of :cite:`Vermaseren:1997fq`.

Parameters
----------
nf : int
number of active flavors
nf : int
number of active flavors

Returns
-------
gamma_3 : float
fourth coefficient of the QCD gamma function :math:`\\gamma_{m,3}^{n_f}`
gamma_3 : float
fourth coefficient of the |QCD| gamma function :math:`\gamma_{m,3}^{n_f}`

"""
return (
4603055.0 / 162.0
Expand All @@ -98,20 +97,20 @@ def gamma_qcd_as4(nf):

@nb.njit(cache=True)
def gamma(order, nf):
"""
Compute the value of a gamma coefficient
"""Compute the value of a |QCD| gamma coefficient.

Parameters
----------
order: int
perturbative order
nf : int
number of active flavors
order: int
perturbative order
nf : int
number of active flavors

returns
Returns
-------
gamma: float
QCD gamma function coefficient
gamma : float
|QCD| gamma function coefficient

"""
_gamma = 0.0

Expand All @@ -124,5 +123,5 @@ def gamma(order, nf):
elif order == 4:
_gamma = gamma_qcd_as4(nf)
else:
raise ValueError("QCD Gamma coefficients beyond N3LO are not implemented!")
raise ValueError("QCD gamma coefficients beyond N3LO are not implemented!")
return _gamma
14 changes: 12 additions & 2 deletions src/eko/interpolation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Library providing all necessary tools for PDF interpolation.
"""Library providing all necessary tools for PDF interpolation.

This library also provides a class to generate the interpolator :class:`InterpolatorDispatcher`.
Upon construction the dispatcher generates a number of functions
Expand Down Expand Up @@ -409,6 +408,7 @@ def __iter__(self):
yield from self.areas

def __call__(self, *args, **kwargs):
"""Evaluate function."""
args = list(args)
args.append(self.areas_representation)
return self.callable(*args, **kwargs)
Expand Down Expand Up @@ -450,24 +450,34 @@ def __eq__(self, other) -> bool:

@property
def raw(self) -> np.ndarray:
"""Untransformed grid."""
return self.grid if not self.log else self._raw

@property
def size(self) -> int:
"""Number of pointrs."""
return self.grid.size

def tolist(self) -> list:
"""Raw grid as Python list."""
return self.raw.tolist()

def dump(self) -> dict:
"""Representation as dictionary."""
return dict(grid=self.tolist(), log=self.log)

@classmethod
def load(cls, doc: dict):
"""Create object from dictinary."""
return cls(doc["grid"], log=doc["log"])

@classmethod
def fromcard(cls, value: list, log: bool):
"""Create object from theory card config.

The config can invoke other grid generation methods.

"""
if len(value) == 0:
raise ValueError("Empty xgrid!")

Expand Down
4 changes: 1 addition & 3 deletions src/eko/kernels/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""
This module defines all anomalous dimensions in all sectors and at all orders.
"""
"""The solutions to the |DGLAP| equations."""
22 changes: 11 additions & 11 deletions src/eko/kernels/utils.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
"""Some utility functions"""
"""Utility functions."""

import numba as nb
import numpy as np


@nb.njit(cache=True)
def geomspace(start, end, num):
"""
Numba port of :func:`numpy.geomspace`.
"""Numba port of :func:`numpy.geomspace`.

Parameters
----------
start : float
initial value
end : float
final value
num : int
steps
start : float
initial value
end : float
final value
num : int
steps

Returns
-------
geomspace : numpy.ndarray
logarithmic spaced list between `start` and `end`
geomspace : numpy.ndarray
logarithmic spaced list between `start` and `end`

"""
return np.exp(np.linspace(np.log(start), np.log(end), num))
Loading