-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b004db
commit 7a6c1cc
Showing
4 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,33 @@ | ||
"""The solutions to the |DGLAP| equations.""" | ||
|
||
import enum | ||
|
||
|
||
class EvoMethods(enum.IntEnum): | ||
"""Enumerate evolution methods.""" | ||
|
||
ITERATE_EXACT = enum.auto() | ||
ITERATE_EXPANDED = enum.auto() | ||
PERTURBATIVE_EXACT = enum.auto() | ||
PERTURBATIVE_EXPANDED = enum.auto() | ||
TRUNCATED = enum.auto() | ||
ORDERED_TRUNCATED = enum.auto() | ||
DECOMPOSE_EXACT = enum.auto() | ||
DECOMPOSE_EXPANDED = enum.auto() | ||
|
||
|
||
def ev_method(s: EvoMethods) -> EvoMethods: | ||
"""Return the evolution methods. | ||
Parameters | ||
---------- | ||
s : | ||
string representation | ||
Returns | ||
------- | ||
i : | ||
int representation | ||
""" | ||
return EvoMethods[s.value.upper().replace("-", "_")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from eko.io.types import EvolutionMethod | ||
from eko.kernels import EvoMethods, ev_method | ||
|
||
|
||
def test_ev_method(): | ||
methods = { | ||
"iterate-expanded": EvoMethods.ITERATE_EXPANDED, | ||
"decompose-expanded": EvoMethods.DECOMPOSE_EXPANDED, | ||
"perturbative-expanded": EvoMethods.PERTURBATIVE_EXPANDED, | ||
"truncated": EvoMethods.TRUNCATED, | ||
"ordered-truncated": EvoMethods.ORDERED_TRUNCATED, | ||
"iterate-exact": EvoMethods.ITERATE_EXACT, | ||
"decompose-exact": EvoMethods.DECOMPOSE_EXACT, | ||
"perturbative-exact": EvoMethods.PERTURBATIVE_EXACT, | ||
} | ||
assert len(methods.keys()) == len(EvolutionMethod) | ||
assert len(methods.keys()) == len(EvoMethods) | ||
for s, i in methods.items(): | ||
j = ev_method(EvolutionMethod(s)) | ||
assert j == i | ||
assert isinstance(j, int) |