Skip to content

Commit

Permalink
Revert "Adjust apply for ekomark"
Browse files Browse the repository at this point in the history
This reverts commit e9aff79.
  • Loading branch information
giacomomagni committed Oct 21, 2024
1 parent 9fedf2f commit ec079c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 52 deletions.
61 changes: 13 additions & 48 deletions src/ekobox/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,50 +60,6 @@ def apply_pdf(
rotate_to_evolution_basis :
if True rotate to evoluton basis
Returns
-------
pdfs :
PDFs for the computed evolution points
errors :
Integration errors for PDFs for the computed evolution points
"""
# prepare post-process
qed = eko.theory_card.order[1] > 0
flavor_rotation = None
labels = br.flavor_basis_pids
if rotate_to_evolution_basis:
if not qed:
flavor_rotation = br.rotate_flavor_to_evolution
labels = br.evol_basis_pids
else:
flavor_rotation = br.rotate_flavor_to_unified_evolution
labels = br.unified_evol_basis_pids
return apply_pdf_flavor(eko, lhapdf_like, labels, targetgrid, flavor_rotation)


def apply_pdf_flavor(
eko: EKO,
lhapdf_like,
flavor_labels: Sequence[int],
targetgrid: npt.ArrayLike = None,
flavor_rotation: npt.ArrayLike = None,
) -> tuple[LabeledPdfResult, LabeledErrorResult]:
"""Apply all available operators to the input PDF.
Parameters
----------
eko :
eko output object containing all informations
lhapdf_like : Any
object that provides an `xfxQ2` callable (as `lhapdf <https://lhapdf.hepforge.org/>`_
and :class:`ekomark.toyLH.toyPDF` do) (and thus is in flavor basis)
flavor_labels :
flavor names
targetgrid :
if given, interpolates to the targetgrid (instead of xgrid)
flavor_rotation :
if give, rotate in flavor space
Returns
-------
pdfs :
Expand All @@ -121,10 +77,19 @@ def apply_pdf_flavor(
)
# apply
grids, grid_errors = apply_grids(eko, input_pdfs[None, :])
new_grids = rotate_result(eko, grids, flavor_labels, targetgrid, flavor_rotation)
new_errors = rotate_result(
eko, grid_errors, flavor_labels, targetgrid, flavor_rotation
)
# post-process
qed = eko.theory_card.order[1] > 0
flavor_rotation = None
labels = br.flavor_basis_pids
if rotate_to_evolution_basis:
if not qed:
flavor_rotation = br.rotate_flavor_to_evolution
labels = br.evol_basis_pids
else:
flavor_rotation = br.rotate_flavor_to_unified_evolution
labels = br.unified_evol_basis_pids
new_grids = rotate_result(eko, grids, labels, targetgrid, flavor_rotation)
new_errors = rotate_result(eko, grid_errors, labels, targetgrid, flavor_rotation)
# unwrap the replica axis again
pdfs: LabeledPdfResult = {}
errors: LabeledErrorResult = {}
Expand Down
9 changes: 5 additions & 4 deletions src/ekomark/benchmark/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ def log(self, theory, _, pdf, me, ext):
rotate_to_evolution[3, :] = [0, 0, 0, 0, 0, -1, -1, 0, 1, 1, 0, 0, 0, 0]

with EKO.read(me) as eko:
pdf_grid, errors = apply.apply_pdf_flavor(
pdf_grid = apply.apply_pdf_flavor(
eko,
pdf,
labels,
xgrid,
flavor_rotation=rotate_to_evolution,
labels=labels,
)
for q2, ref_pdfs in ext["values"].items():
log_tab = dfdict.DFdict()
Expand All @@ -243,8 +243,9 @@ def log(self, theory, _, pdf, me, ext):
if len(eps) == 0:
raise KeyError(f"PDF at Q2={q2} not found")
raise KeyError(f"More than one evolution point found for Q2={q2}")
my_pdfs = pdf_grid[eps[0]]
my_pdf_errs = errors[eps[0]]
res = pdf_grid[eps[0]]
my_pdfs = res["pdfs"]
my_pdf_errs = res["errors"]

for key in my_pdfs:
if key in self.skip_pdfs(theory):
Expand Down

0 comments on commit ec079c7

Please sign in to comment.