Skip to content

Commit

Permalink
Remove ev_op/grid
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Jan 13, 2025
1 parent dc3e725 commit 29c401d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 282 deletions.
2 changes: 0 additions & 2 deletions benchmarks/eko/benchmark_evol_to_unity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pathlib
from dataclasses import dataclass

import numpy as np
Expand Down Expand Up @@ -47,7 +46,6 @@ 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)
Expand Down
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
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
204 changes: 0 additions & 204 deletions src/eko/evolution_operator/grid.py

This file was deleted.

16 changes: 13 additions & 3 deletions src/eko/evolution_operator/operator_matrix_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import enum
import functools
import logging
from typing import Optional

import numba as nb
import numpy as np
Expand All @@ -18,7 +19,7 @@
from ..io.types import InversionMethod
from ..matchings import Segment
from ..scale_variations.exponentiated import gamma_variation
from . import Operator, QuadKerBase
from . import Managers, Operator, QuadKerBase

logger = logging.getLogger(__name__)

Expand All @@ -31,7 +32,7 @@ class MatchingMethods(enum.IntEnum):
BACKWARD_EXPANDED = enum.auto()


def matching_method(s: InversionMethod) -> MatchingMethods:
def matching_method(s: Optional[InversionMethod]) -> MatchingMethods:
"""Return the matching method.
Parameters
Expand Down Expand Up @@ -241,7 +242,16 @@ class OperatorMatrixElement(Operator):
# still valid in QED since Sdelta and Vdelta matchings are diagonal
full_labels_qed = copy.deepcopy(full_labels)

def __init__(self, config, managers, nf, q2, is_backward, L, is_msbar):
def __init__(
self,
config,
managers: Managers,
nf: int,
q2: float,
is_backward: bool,
L: float,
is_msbar: bool,
):
super().__init__(config, managers, Segment(q2, q2, nf))
self.backward_method = matching_method(
config["backward_inversion"] if is_backward else None
Expand Down
5 changes: 2 additions & 3 deletions src/eko/runner/parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
from .. import evolution_operator as evop
from ..evolution_operator import matching_condition, physical
from ..evolution_operator import operator_matrix_element as ome
from ..evolution_operator.grid import Managers
from ..io import EKO
from ..io.items import Evolution, Matching, Operator
from ..quantities.heavy_quarks import QuarkMassScheme
from . import commons


def _managers(eko: EKO) -> Managers:
def _managers(eko: EKO) -> evop.Managers:
"""Collect managers for operator computation.
.. todo::
Expand All @@ -31,7 +30,7 @@ def _managers(eko: EKO) -> Managers:
"""
tcard = eko.theory_card
ocard = eko.operator_card
return Managers(
return evop.Managers(
atlas=commons.atlas(tcard, ocard),
couplings=commons.couplings(tcard, ocard),
interpolator=commons.interpolator(ocard),
Expand Down
Loading

0 comments on commit 29c401d

Please sign in to comment.