Skip to content

Commit

Permalink
Fix actually eko/qnt/hq and add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed May 11, 2023
1 parent ac00737 commit ec083e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
18 changes: 0 additions & 18 deletions src/eko/quantities/heavy_quarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,6 @@ def t(self, value: T):
MatchingScales = HeavyQuarks[MatchingScale]


def scales_from_ratios(
ratios: MatchingRatios, masses: HeavyQuarkMasses
) -> MatchingScales:
"""Convert ratios to squared scales.
.. todo::
make this a method
"""
return MatchingScales(*(np.power(ratios, 2.0) * np.power(masses, 2.0)).tolist())


# TODO: upgrade the following to StrEnum (requires py>=3.11) with that, it is
# possible to replace all non-alias right sides with calls to enum.auto()

Expand Down Expand Up @@ -120,11 +107,6 @@ class HeavyInfo(DictLike):
matching_ratios: MatchingRatios
"""Matching scale of heavy quark masses"""

@property
def matching_scales(self) -> MatchingScales:
"""Compute matching scales."""
return scales_from_ratios(self.matching_ratios, self.masses)

@property
def squared_ratios(self) -> List[float]:
"""Squared ratios of matching scales."""
Expand Down
8 changes: 5 additions & 3 deletions tests/eko/test_quantities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from math import nan

import numpy as np
import pytest

from eko.quantities import heavy_quarks as hq
Expand Down Expand Up @@ -37,11 +38,12 @@ def test_HeavyInfo():
intrinsic_flavors=[4, 5],
masses=hq.HeavyQuarkMasses(
[
hq.QuarkMassRef(2.0, nan),
hq.QuarkMassRef(5.0, nan),
hq.QuarkMassRef(100.0, nan),
hq.QuarkMassRef([2.0, nan]),
hq.QuarkMassRef([5.0, nan]),
hq.QuarkMassRef([100.0, nan]),
]
),
masses_scheme=hq.QuarkMassScheme.POLE,
matching_ratios=hq.MatchingRatios([1.5, 2.0, 3.0]),
)
np.testing.assert_allclose(i.squared_ratios, [2.25, 4.0, 9.0])

0 comments on commit ec083e7

Please sign in to comment.