Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading v0.13 and v0.14 files #417

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d392c17
Add packaging package
felixhekhorn Oct 17, 2024
e4b04e9
Drop some old legacy stuff
felixhekhorn Oct 17, 2024
e0aa2c8
Draft vX modules
felixhekhorn Oct 17, 2024
2b1fa1e
Start on support for v2
felixhekhorn Oct 30, 2024
b55fb05
add compatibility layer for theory and operator cards
giacomomagni Nov 12, 2024
1e7ae81
Merge branch 'master' into read-legacy
giacomomagni Nov 12, 2024
ffd4ec8
prevent loading non squared ekos
giacomomagni Nov 13, 2024
92eb1e3
black
giacomomagni Nov 13, 2024
0ef51c3
update old names
giacomomagni Nov 14, 2024
dfdd659
added eko objects from old versions and some very small test scripts
Jan 8, 2025
93cc2f2
Revert "added eko objects from old versions and some very small test …
Jan 9, 2025
3e7b3aa
Top level download script to get test assets
Jan 9, 2025
416d778
Test for theory card
Jan 9, 2025
1bd8e06
Comment legacy tests
Jan 9, 2025
ff3a6e2
Fix v1 legacy
Jan 9, 2025
aba6513
Merge branch 'master' into read-legacy
felixhekhorn Jan 10, 2025
3e84ca3
Get .pre-commit-config from master
felixhekhorn Jan 10, 2025
76778e1
Recover tests/eko/e_o/init
felixhekhorn Jan 10, 2025
cf0bae7
Recover tests/eko/e_o/ome
felixhekhorn Jan 10, 2025
3ee5efb
Remove old test data
felixhekhorn Jan 10, 2025
17033fc
Improve assets script and attempt pytest fix
felixhekhorn Jan 10, 2025
3d9c9b1
Fix plural typo in workflow
felixhekhorn Jan 10, 2025
4ed730f
Fix some py unit tests
felixhekhorn Jan 10, 2025
d2b5bdb
Merge branch 'master' into read-legacy
felixhekhorn Jan 13, 2025
82192b6
Merge branch 'master' into read-legacy
felixhekhorn Jan 13, 2025
a4f8b37
Undo EKOFactory bug
felixhekhorn Jan 13, 2025
dc3e725
Recover benchmarks
felixhekhorn Jan 13, 2025
29c401d
Remove ev_op/grid
felixhekhorn Jan 13, 2025
eb347df
Recover rustify
felixhekhorn Jan 13, 2025
f62afe2
Work in progress script to test versions
Jan 20, 2025
2b37aea
Merge branch 'read-legacy' of github.com:NNPDF/eko into read-legacy
Jan 20, 2025
b57186c
Improved test legacy script for v0.14
Jan 28, 2025
dfca5b4
Test legacy v0.14 script that works
Jan 28, 2025
e343d0c
Revert "Improved test legacy script for v0.14"
Jan 29, 2025
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
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
2 changes: 1 addition & 1 deletion poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ scipy = "^1.10.1"
PyYAML = "^6.0"
lz4 = "^4.0.2"
numba = "^0.59.0"
packaging = "^24.1"
# ekomark
banana-hep = { version = "^0.6.12", optional = true }
sqlalchemy = { version = "^1.4.21", optional = true }
Expand Down
3 changes: 3 additions & 0 deletions src/eko/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"""Evolution Kernel Operators."""

from . import io, version
from .io.runcards import OperatorCard, TheoryCard
from .io.struct import EKO
from .runner import solve

__version__ = version.__version__

__all__ = [
"io",
"OperatorCard",
"TheoryCard",
"EKO",
"solve",
]
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
Loading