Skip to content

Commit

Permalink
Merge branch 'read-legacy' of github.com:NNPDF/eko into read-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
Eva Groenendijk authored and Eva Groenendijk committed Jan 20, 2025
2 parents f62afe2 + eb347df commit 2b37aea
Show file tree
Hide file tree
Showing 27 changed files with 146 additions and 417 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/unittests-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ jobs:
- name: Download test data
if: steps.cache-test-data.outputs.cache-hit != 'true'
run: |
cd crates/dekoder/tests/data
./download.sh
./tests/data/assets.sh
- uses: actions/setup-python@v5
- name: Install task runner
run: pip install poethepoet
Expand Down
21 changes: 11 additions & 10 deletions benchmarks/eko/benchmark_evol_to_unity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pathlib
from dataclasses import dataclass

import numpy as np
import pytest
Expand All @@ -10,11 +10,17 @@
from eko.io.runcards import OperatorCard, TheoryCard
from eko.matchings import Segment
from eko.quantities.couplings import CouplingsInfo
from eko.runner.legacy import Runner
from eko.runner.parts import _evolve_configs, _managers

# from ekore.matching_conditions.operator_matrix_element import OperatorMatrixElement


@dataclass(frozen=True)
class FakeEKO:
theory_card: TheoryCard
operator_card: OperatorCard


def update_cards(theory: TheoryCard, operator: OperatorCard):
theory.couplings = CouplingsInfo(
alphas=0.35,
Expand All @@ -40,20 +46,15 @@ def test_operator_grid(
self,
theory_card: TheoryCard,
operator_card: OperatorCard,
tmp_path: pathlib.Path,
):
"""Test that eko_forward @ eko_backward gives ID matrix or zeros."""
update_cards(theory_card, operator_card)
g = Runner(
theory_card=theory_card,
operators_card=operator_card,
path=tmp_path / "eko.tar",
).op_grid
f = FakeEKO(theory_card, operator_card)

seg = Segment(30, 50, 4)
seg_back = Segment(50, 30, 4)
o = Operator(g.config, g.managers, seg)
o_back = Operator(g.config, g.managers, seg_back)
o = Operator(_evolve_configs(f), _managers(f), seg)
o_back = Operator(_evolve_configs(f), _managers(f), seg_back)
o.compute()
o_back.compute()

Expand Down
3 changes: 0 additions & 3 deletions crates/dekoder/tests/data/download.sh

This file was deleted.

12 changes: 0 additions & 12 deletions doc/source/code/Operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ The classes are nested as follows:
PhysicalOperator [label="PhysicalOperator"];
Operator [label="Operator" ];
OME [label="OME" ];
OperatorGrid [label="OperatorGrid"];

OperatorGrid -> Operator;
OperatorGrid -> OME;
Operator -> PhysicalOperator [weight=100,style=dashed];
PhysicalOperator -> ndarray [style=dashed];
OME -> MatchingCondition [weight=100,style=dashed];
Expand All @@ -31,17 +28,8 @@ The classes are nested as follows:
OpMember -> PhysicalOperator [dir=back];
OME -> OpMember;
OpMember -> MatchingCondition [dir=back];

OperatorGrid -> OpMember -> ndarray [style=invis];
}

- :class:`~eko.evolution_operator.grid.OperatorGrid`

* is the master class which administrates all operator tasks
* is instantiated once for each run
* holds all necessary :doc:`configurations </code/IO>`
* holds all necessary instances of the :doc:`/code/Utilities`

- :class:`~eko.evolution_operator.Operator`

* represents a configuration for a fixed final scale :math:`Q_1^2`
Expand Down
3 changes: 2 additions & 1 deletion doc/source/overview/tutorials/alpha_s.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/source/overview/tutorials/dglap.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions doc/source/overview/tutorials/pdf.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions doc/source/theory/N3LO_ad.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ since in Mellin space they include harmonics sum up to weight 7, for which an
analytical expression is not available.

We provide two different types of approximations, depending on the key ``use_fhmruvv``.
The theory card parameter ``n3lo_ad_variation=(gg, gq, qg, qq, nsp, nsm, nsv)``,
The theory card parameter ``n3lo_ad_variation=(gg, gq, qg, qq, nsp, nsm, nsv)``,
which is set to ``(0,0,0,0,0,0,0)`` as default, can be varied to obtain parametrization uncertainties.

In particular:

* ``use_fhmruvv = True`` (default option) adopts the parametrizations as provided
in :cite:`Moch:2017uml,Falcioni:2023luc,Falcioni:2023vqq,Falcioni:2024xyt,Falcioni:2024qpd`.
For each of the 7 splitting functions, the approximation error can be obtained by varying
the entries of ``n3lo_ad_variation`` in the range: ``0``,
* ``use_fhmruvv = True`` (default option) adopts the parametrizations as provided
in :cite:`Moch:2017uml,Falcioni:2023luc,Falcioni:2023vqq,Falcioni:2024xyt,Falcioni:2024qpd`.
For each of the 7 splitting functions, the approximation error can be obtained by varying
the entries of ``n3lo_ad_variation`` in the range: ``0``,
cental value (default), ``1`` down variation, ``2`` up variation.

* ``use_fhmruvv = False`` adopts an in-house parametrization, constructed as described below.
In this case only variations of the singlet sector are available. Currently one
In this case only variations of the singlet sector are available. Currently one
can vary ``n3lo_ad_variation`` in the range: ``0-19`` for ``gg``, ``0-15`` for ``gg``,
``0-15`` for ``qg``, ``0-6`` for ``qq``.
Note these approximations will be no longer updated and are now deprecated.
Note these approximations will be no longer updated and are now deprecated.


In house approximation
Expand Down Expand Up @@ -294,7 +294,6 @@ The difference between the known moments and the known limits is parametrized
in Mellin space using different basis, in order to estimate the uncertainties of
our determination.


Uncertainties estimation
^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
7 changes: 3 additions & 4 deletions doc/source/theory/pQCD.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ can be specified at ``scale_ref`` along with ``nf_ref`` and, the computed result
depend on the number of flavors at the target scale, see :meth:`eko.couplings.Couplings.a_s`
An example how the evolution path is determined is given :doc:`here</code/Utilities/>`.


QCD Splitting Functions
-----------------------

Expand Down Expand Up @@ -86,8 +85,8 @@ At |NLO|, the singlet entry of the quark-quark anomalous dimension can be decomp
\gamma^{(1)}_{qq} =\gamma^{(1)}_{ps} + \gamma^{(1)}_{ns,+}
The non-singlet sector in the polarized case swaps the plus and minus non-singlet relative to the unpolarized case.
This is because the polarized non-singlet splitting functions are defined as the difference between the probability of the polarized parton splitting
into daughter partons of the same flavour and same helicity and daughters of a different flavours and opposite helicity.
This is because the polarized non-singlet splitting functions are defined as the difference between the probability of the polarized parton splitting
into daughter partons of the same flavour and same helicity and daughters of a different flavours and opposite helicity.
The first moments of the anomalous dimensions are:

.. math ::
Expand All @@ -103,7 +102,7 @@ At |NNLO| the non-singlet is further decomposed into the helicity difference qua
where :math:`\gamma^{(2)}_{ns,-}` is the minus flavour asymmetry non-singlet and :math:`\gamma^{(2)}_{ns,s}` the sea-like polarized non-singlet.
The singlet entry :math:`\gamma^{(2)}_{qq}` is defined as above in the |NLO| case.

Finally the violation of the axial current conservation :math:`\bar{\psi} \gamma_\mu \gamma_5 \bar{\psi}` only through
Finally the violation of the axial current conservation :math:`\bar{\psi} \gamma_\mu \gamma_5 \bar{\psi}` only through
loop corrections impose the following relations to the singlet splittings at all orders :cite:`Moch:2014sna` :

.. math ::
Expand Down
8 changes: 0 additions & 8 deletions download-test-assets.sh

This file was deleted.

23 changes: 20 additions & 3 deletions src/eko/evolution_operator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import logging
import os
import time
from dataclasses import dataclass
from multiprocessing import Pool
from typing import Dict, Tuple

Expand All @@ -21,14 +22,16 @@
from .. import basis_rotation as br
from .. import interpolation, mellin
from .. import scale_variations as sv
from ..couplings import Couplings
from ..interpolation import InterpolatorDispatcher
from ..io.types import EvolutionMethod, OperatorLabel
from ..kernels import ev_method
from ..kernels import non_singlet as ns
from ..kernels import non_singlet_qed as qed_ns
from ..kernels import singlet as s
from ..kernels import singlet_qed as qed_s
from ..kernels import valence_qed as qed_v
from ..matchings import Segment, lepton_number
from ..matchings import Atlas, Segment, lepton_number
from ..member import OpMember
from ..scale_variations import expanded as sv_expanded
from ..scale_variations import exponentiated as sv_exponentiated
Expand Down Expand Up @@ -608,6 +611,15 @@ def quad_ker_qed(
"""Map of all operators."""


@dataclass(frozen=True)
class Managers:
"""Set of steering objects."""

atlas: Atlas
couplings: Couplings
interpolator: InterpolatorDispatcher


class Operator(sv.ScaleVariationModeMixin):
"""Internal representation of a single EKO.
Expand Down Expand Up @@ -637,7 +649,12 @@ class Operator(sv.ScaleVariationModeMixin):
full_labels_qed: Tuple[OperatorLabel, ...] = br.full_unified_labels

def __init__(
self, config, managers, segment: Segment, mellin_cut=5e-2, is_threshold=False
self,
config,
managers: Managers,
segment: Segment,
mellin_cut=5e-2,
is_threshold=False,
):
self.config = config
self.managers = managers
Expand Down Expand Up @@ -669,7 +686,7 @@ def xif2(self):
return self.config["xif2"]

@property
def int_disp(self):
def int_disp(self) -> InterpolatorDispatcher:
"""Return the interpolation dispatcher."""
return self.managers.interpolator

Expand Down
40 changes: 28 additions & 12 deletions src/eko/evolution_operator/__init__.py.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
diff --git a/src/eko/evolution_operator/__init__.py b/src/eko/evolution_operator/__init__.py
index bd1b19d6..f543f7bc 100644
index 366f934c..73edf44f 100644
--- a/src/eko/evolution_operator/__init__.py
+++ b/src/eko/evolution_operator/__init__.py
@@ -3,16 +3,16 @@ r"""Contains the central operator classes.
@@ -3,7 +3,6 @@ r"""Contains the central operator classes.
See :doc:`Operator overview </code/Operators>`.
"""

-import functools
import logging
import os
import time
@@ -11,13 +10,10 @@ from dataclasses import dataclass
from multiprocessing import Pool
from typing import Dict, Tuple

+import ekors
import numba as nb
import numpy as np
-from scipy import integrate
-
-import ekore.anomalous_dimensions.polarized.space_like as ad_ps
-import ekore.anomalous_dimensions.unpolarized.space_like as ad_us
-import ekore.anomalous_dimensions.unpolarized.time_like as ad_ut
+from scipy import LowLevelCallable, integrate

import ekore.anomalous_dimensions.polarized.space_like as ad_ps
import ekore.anomalous_dimensions.unpolarized.space_like as ad_us
@@ -32,91 +32,10 @@ from ..matchings import Segment, lepton_number
from .. import basis_rotation as br
from .. import interpolation, mellin
@@ -26,100 +22,12 @@ from ..couplings import Couplings
from ..interpolation import InterpolatorDispatcher
from ..io.types import EvolutionMethod, OperatorLabel
from ..kernels import ev_method
-from ..kernels import non_singlet as ns
-from ..kernels import non_singlet_qed as qed_ns
-from ..kernels import singlet as s
-from ..kernels import singlet_qed as qed_s
-from ..kernels import valence_qed as qed_v
-from ..matchings import Atlas, Segment, lepton_number
+from ..matchings import Atlas, Segment
from ..member import OpMember
from ..scale_variations import expanded as sv_expanded
from ..scale_variations import exponentiated as sv_exponentiated
-from ..scale_variations import expanded as sv_expanded
-from ..scale_variations import exponentiated as sv_exponentiated
+from .quad_ker import cb_quad_ker_qcd

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -114,7 +129,7 @@ index bd1b19d6..f543f7bc 100644
spec = [
("is_singlet", nb.boolean),
("is_QEDsinglet", nb.boolean),
@@ -188,421 +107,6 @@ class QuadKerBase:
@@ -191,422 +99,6 @@ class QuadKerBase:
return self.path.prefactor * pj * self.path.jac


Expand Down Expand Up @@ -533,10 +548,11 @@ index bd1b19d6..f543f7bc 100644
- )
- return ker
-

-
OpMembers = Dict[OperatorLabel, OpMember]
"""Map of all operators."""
@@ -792,49 +296,6 @@ class Operator(sv.ScaleVariationModeMixin):

@@ -809,49 +301,6 @@ class Operator(sv.ScaleVariationModeMixin):
"""Return the evolution method."""
return ev_method(EvolutionMethod(self.config["method"]))

Expand Down Expand Up @@ -586,7 +602,7 @@ index bd1b19d6..f543f7bc 100644
def initialize_op_members(self):
"""Init all operators with the identity or zeros."""
eye = OpMember(
@@ -857,10 +318,14 @@ class Operator(sv.ScaleVariationModeMixin):
@@ -874,10 +323,14 @@ class Operator(sv.ScaleVariationModeMixin):
else:
self.op_members[n] = zero.copy()

Expand All @@ -605,7 +621,7 @@ index bd1b19d6..f543f7bc 100644
"""Run the integration for each grid point.

Parameters
@@ -875,18 +339,53 @@ class Operator(sv.ScaleVariationModeMixin):
@@ -892,18 +345,53 @@ class Operator(sv.ScaleVariationModeMixin):
"""
column = []
k, logx = log_grid
Expand Down
Loading

0 comments on commit 2b37aea

Please sign in to comment.