Skip to content

Commit

Permalink
Restrict parts public API
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Aug 17, 2023
1 parent 394bb9f commit 7ecb58e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/eko/runner/managed.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""
from pathlib import Path

from ..io.items import Evolution, Matching, Target
from ..io.items import Target
from ..io.runcards import OperatorCard, TheoryCard
from ..io.struct import EKO
from . import operators, parts, recipes
Expand All @@ -27,12 +27,10 @@ def solve(theory: TheoryCard, operator: OperatorCard, path: Path):
recipes.create(eko)

for recipe in eko.recipes:
assert isinstance(recipe, Evolution)
eko.parts[recipe] = parts.evolve(eko, recipe)
# flush the memory
del eko.parts[recipe]
for recipe in eko.recipes_matching:
assert isinstance(recipe, Matching)
eko.parts_matching[recipe] = parts.match(eko, recipe)
# flush the memory
del eko.parts_matching[recipe]
Expand Down
23 changes: 13 additions & 10 deletions src/eko/runner/parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from . import commons


def managers(eko: EKO) -> dict:
def _managers(eko: EKO) -> dict:
"""Collect managers for operator computation.
.. todo::
Expand All @@ -39,7 +39,7 @@ def managers(eko: EKO) -> dict:
)


def blowup_info(eko: EKO) -> dict:
def _blowup_info(eko: EKO) -> dict:
"""Prepare common information to blow up to flavor basis.
Note
Expand All @@ -65,7 +65,7 @@ def blowup_info(eko: EKO) -> dict:
return dict(intrinsic_range=[4, 5, 6], qed=eko.theory_card.order[1] > 0)


def evolve_configs(eko: EKO) -> dict:
def _evolution_configs(eko: EKO) -> dict:
"""Create configs for :class:`Operator`.
.. todo::
Expand Down Expand Up @@ -94,19 +94,22 @@ def evolve_configs(eko: EKO) -> dict:
def evolve(eko: EKO, recipe: Evolution) -> Operator:
"""Compute evolution in isolation."""
op = evop.Operator(
evolve_configs(eko), managers(eko), recipe.as_atlas, is_threshold=recipe.cliff
_evolution_configs(eko),
_managers(eko),
recipe.as_atlas,
is_threshold=recipe.cliff,
)
op.compute()

binfo = blowup_info(eko)
binfo = _blowup_info(eko)
res, err = physical.PhysicalOperator.ad_to_evol_map(
op.op_members, op.nf, op.q2_to, **binfo
).to_flavor_basis_tensor(qed=binfo["qed"])

return Operator(res, err)


def matching_configs(eko: EKO) -> dict:
def _matching_configs(eko: EKO) -> dict:
"""Create configs for :class:`OperatorMatrixElement`.
.. todo::
Expand All @@ -117,7 +120,7 @@ def matching_configs(eko: EKO) -> dict:
tcard = eko.theory_card
ocard = eko.operator_card
return dict(
**evolve_configs(eko),
**_evolution_configs(eko),
backward_inversion=ocard.configs.inversion_method,
intrinsic_range=tcard.heavy.intrinsic_flavors,
)
Expand All @@ -138,8 +141,8 @@ def match(eko: EKO, recipe: Matching) -> Operator:
"""
kthr = eko.theory_card.heavy.squared_ratios[recipe.hq - 4]
op = ome.OperatorMatrixElement(
matching_configs(eko),
managers(eko),
_matching_configs(eko),
_managers(eko),
recipe.hq - 1,
recipe.scale,
recipe.inverse,
Expand All @@ -148,7 +151,7 @@ def match(eko: EKO, recipe: Matching) -> Operator:
)
op.compute()

binfo = blowup_info(eko)
binfo = _blowup_info(eko)
nf_match = op.nf - 1 if recipe.inverse else op.nf
res, err = matching_condition.MatchingCondition.split_ad_to_evol_map(
op.op_members, nf_match, recipe.scale, **binfo
Expand Down

0 comments on commit 7ecb58e

Please sign in to comment.