Skip to content

Commit

Permalink
propagate polarized and time-like from op card to op.__init__
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni authored and felixhekhorn committed Jan 17, 2023
1 parent febd415 commit bb6af22
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 7 deletions.
38 changes: 34 additions & 4 deletions src/eko/evolution_operator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import numpy as np
from scipy import integrate

import ekore.anomalous_dimensions.unpolarized.space_like as ad
import ekore.anomalous_dimensions.polarized.space_like as ad_ps
import ekore.anomalous_dimensions.polarized.time_like as ad_pt
import ekore.anomalous_dimensions.unpolarized.space_like as ad_us
import ekore.anomalous_dimensions.unpolarized.time_like as ad_ut

from .. import basis_rotation as br
from .. import interpolation, mellin
from .. import scale_variations as sv
Expand Down Expand Up @@ -130,6 +134,8 @@ def quad_ker(
ev_op_max_order,
sv_mode,
is_threshold,
is_polarized,
is_time_like,
):
"""Raw evolution kernel inside quad.
Expand Down Expand Up @@ -168,7 +174,11 @@ def quad_ker(
sv_mode: int, `enum.IntEnum`
scale variation mode, see `eko.scale_variations.Modes`
is_threshold : boolean
is this an itermediate threshold operator?
is this an intermediate threshold operator?
is_polarized : boolean
is polarized evolution ?
is_time_like : boolean
is time-like evolution ?
Returns
-------
Expand All @@ -182,7 +192,16 @@ def quad_ker(

# compute the actual evolution kernel
if ker_base.is_singlet:
gamma_singlet = ad.gamma_singlet(order, ker_base.n, nf)
if is_polarized:
if is_time_like:
gamma_singlet = ad_pt.gamma_singlet(order, ker_base.n, nf)
else:
gamma_singlet = ad_ps.gamma_singlet(order, ker_base.n, nf)
else:
if is_time_like:
gamma_singlet = ad_ut.gamma_singlet(order, ker_base.n, nf)
else:
gamma_singlet = ad_us.gamma_singlet(order, ker_base.n, nf)
# scale var exponentiated is directly applied on gamma
if sv_mode == sv.Modes.exponentiated:
gamma_singlet = sv.exponentiated.gamma_variation(
Expand All @@ -205,7 +224,16 @@ def quad_ker(
) @ np.ascontiguousarray(ker)
ker = select_singlet_element(ker, mode0, mode1)
else:
gamma_ns = ad.gamma_ns(order, mode0, ker_base.n, nf)
if is_polarized:
if is_time_like:
gamma_ns = ad_pt.gamma_ns(order, mode0, ker_base.n, nf)
else:
gamma_ns = ad_ps.gamma_ns(order, mode0, ker_base.n, nf)
else:
if is_time_like:
gamma_ns = ad_ut.gamma_ns(order, mode0, ker_base.n, nf)
else:
gamma_ns = ad_us.gamma_ns(order, mode0, ker_base.n, nf)
if sv_mode == sv.Modes.exponentiated:
gamma_ns = sv.exponentiated.gamma_variation(gamma_ns, order, nf, L)
ker = ns.dispatcher(
Expand Down Expand Up @@ -382,6 +410,8 @@ def quad_ker(self, label, logx, areas):
ev_op_max_order=tuple(self.config["ev_op_max_order"]),
sv_mode=self.sv_mode,
is_threshold=self.is_threshold,
is_polarized=self.config["polarized"],
is_time_like=self.config["time_like"],
)

def initialize_op_members(self):
Expand Down
2 changes: 2 additions & 0 deletions src/eko/evolution_operator/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def __init__(
config["n_integration_cores"] = configs.n_integration_cores
config["debug_skip_singlet"] = debug.skip_singlet
config["debug_skip_non_singlet"] = debug.skip_non_singlet
config["polarized"] = configs.polarized
config["time_like"] = configs.time_like

if method not in [
"iterate-exact",
Expand Down
5 changes: 5 additions & 0 deletions src/eko/io/runcards.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class Configs(DictLike):
r"""Whether to use polynomials in :math:`\log(x)`.
If `false`, polynomials are in :math:`x`.
"""
polarized: bool
"""If `true` do polarized evolution."""
time_like: bool
"""If `true` do time-like evolution."""
scvar_method: Optional[ScaleVariationsMethod]
""""""
inversion_method: Optional[InversionMethod]
Expand Down Expand Up @@ -326,6 +330,7 @@ def new_operator(self):
"interpolation_is_log",
"ev_op_iterations",
"n_integration_cores",
"polarized",
):
new["configs"][k] = old[k]
max_order = old["ev_op_max_order"]
Expand Down
2 changes: 2 additions & 0 deletions src/ekobox/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
scvar_method=None,
inversion_method=None,
n_integration_cores=0,
polarized=False,
time_like=False,
),
debug=dict(
skip_singlet=False,
Expand Down
2 changes: 2 additions & 0 deletions src/ekomark/data/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ class Operator(Base): # pylint: disable=too-few-public-methods
ev_op_iterations = Column(Integer)
Q2grid = Column(Text)
backward_inversion = Column(Text)
polarized = Column(Boolean)
time_like = Column(Boolean)
2 changes: 2 additions & 0 deletions src/ekomark/data/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
targetgrid=None,
inputpids=None,
targetpids=None,
polarized=False,
time_like=False,
).items()
)
)
Expand Down
2 changes: 2 additions & 0 deletions src/ekomark/navigator/navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def fill_operators(self, op, obj):
obj["iters"] = op["ev_op_iterations"]
obj["skip_ns"] = op["debug_skip_non_singlet"]
obj["skip_s"] = op["debug_skip_singlet"]
obj["pol"] = op["polarized"]
obj["time"] = op["time_like"]

def fill_cache(self, cac, obj):
"""
Expand Down
Empty file.
21 changes: 21 additions & 0 deletions src/ekore/anomalous_dimensions/polarized/space_like/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
r"""The polarized, space-like Altarelli-Parisi splitting kernels.
Normalization is given by
.. math::
\mathbf{P}(x) = \sum\limits_{j=0} a_s^{j+1} \mathbf P^{(j)}(x)
with :math:`a_s = \frac{\alpha_S(\mu^2)}{4\pi}`.
"""

import numba as nb


@nb.njit(cache=True)
def gamma_ns(_order, _mode, _n, _nf):
raise NotImplementedError("Polarised, space-like is not yet implemented")


@nb.njit(cache=True)
def gamma_singlet(_order, _n, _nf):
raise NotImplementedError("Polarised, space-like is not yet implemented")
21 changes: 21 additions & 0 deletions src/ekore/anomalous_dimensions/polarized/time_like/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
r"""The polarized, time-like Altarelli-Parisi splitting kernels.
Normalization is given by
.. math::
\mathbf{P}(x) = \sum\limits_{j=0} a_s^{j+1} \mathbf P^{(j)}(x)
with :math:`a_s = \frac{\alpha_S(\mu^2)}{4\pi}`.
"""

import numba as nb


@nb.njit(cache=True)
def gamma_ns(_order, _mode, _n, _nf):
raise NotImplementedError("Polarised, time-like is not yet implemented")


@nb.njit(cache=True)
def gamma_singlet(_order, _n, _nf):
raise NotImplementedError("Polarised, time-like is not yet implemented")
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
r"""
This module contains the Altarelli-Parisi splitting kernels.
r"""The unpolarized, space-like Altarelli-Parisi splitting kernels.
Normalization is given by
Expand All @@ -20,7 +19,8 @@
import numpy as np

from .... import harmonics
from . import as1, as2, as3, as4, aem1, aem2
from . import aem1, aem2, as1, as2, as3, as4


@nb.njit(cache=True)
def gamma_ns(order, mode, n, nf):
Expand Down
21 changes: 21 additions & 0 deletions src/ekore/anomalous_dimensions/unpolarized/time_like/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
r"""The unpolarized, time-like Altarelli-Parisi splitting kernels.
Normalization is given by
.. math::
\mathbf{P}(x) = \sum\limits_{j=0} a_s^{j+1} \mathbf P^{(j)}(x)
with :math:`a_s = \frac{\alpha_S(\mu^2)}{4\pi}`.
"""

import numba as nb


@nb.njit(cache=True)
def gamma_ns(_order, _mode, _n, _nf):
raise NotImplementedError("Polarised is not yet implemented")


@nb.njit(cache=True)
def gamma_singlet(_order, _n, _nf):
raise NotImplementedError("Polarised is not yet implemented")
12 changes: 12 additions & 0 deletions tests/eko/evolution_operator/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_quad_ker(monkeypatch):
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
is_polarized=False,
is_time_like=False,
)
np.testing.assert_allclose(res_ns, 0.0)
res_s = quad_ker(
Expand All @@ -64,6 +66,8 @@ def test_quad_ker(monkeypatch):
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
is_polarized=False,
is_time_like=False,
)
np.testing.assert_allclose(res_s, 1.0)
res_s = quad_ker(
Expand All @@ -84,6 +88,8 @@ def test_quad_ker(monkeypatch):
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
is_polarized=False,
is_time_like=False,
)
np.testing.assert_allclose(res_s, 0.0)
for label in [(br.non_singlet_pids_map["ns+"], 0), (100, 100)]:
Expand All @@ -106,6 +112,8 @@ def test_quad_ker(monkeypatch):
ev_op_max_order=(1, 0),
sv_mode=sv,
is_threshold=False,
is_polarized=False,
is_time_like=False,
)
np.testing.assert_allclose(res_sv, 1.0)

Expand All @@ -128,6 +136,8 @@ def test_quad_ker(monkeypatch):
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
is_polarized=False,
is_time_like=False,
)
np.testing.assert_allclose(res_ns, 0.0)

Expand Down Expand Up @@ -342,6 +352,8 @@ def quad_ker_pegasus(
10,
0,
False,
False,
False,
),
epsabs=1e-12,
epsrel=1e-5,
Expand Down

0 comments on commit bb6af22

Please sign in to comment.