Skip to content

Commit

Permalink
Merge branch 'master' into rust
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Jan 11, 2024
2 parents 2b60979 + ccb003e commit 230646b
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 73 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ repos:
hooks:
- id: pycln
args: [--config=pyproject.toml]
- repo: https://github.com/psf/black
rev: 23.11.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
Expand Down Expand Up @@ -62,6 +62,6 @@ repos:
files: ^crates/ekore/.*\.rs$
args: []
- repo: https://github.com/pre-commit/pre-commit
rev: v3.5.0
rev: v3.6.0
hooks:
- id: validate_manifest
82 changes: 45 additions & 37 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/eko/evolution_operator/operator_matrix_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,5 +324,12 @@ def compute(self):
if self.order[0] == 0:
logger.info("%s: no need to compute matching at LO", self.log_label)
return
logger.info(
"%s: order: (%d, %d), backward method: %s",
self.log_label,
self.order[0],
self.order[1],
self.backward_method,
)

self.integrate()
49 changes: 26 additions & 23 deletions src/eko/io/runcards.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Structures to hold runcards information.
All energy scales in the runcards should be saved linearly, not the squared
value, for consistency.
Squares are consistenly taken inside.
All energy scales in the runcards should be saved linearly, not the
squared value, for consistency. Squares are consistenly taken inside.
"""
from dataclasses import dataclass
from math import nan
Expand Down Expand Up @@ -48,10 +46,15 @@ class TheoryCard(DictLike):
xif: float
"""Ratio between factorization scale and process scale."""
n3lo_ad_variation: N3LOAdVariation
"""|N3LO| anomalous dimension variation: ``(gg_var, gq_var, qg_var, qq_var)``."""
"""|N3LO| anomalous dimension variation: ``(gg, gq, qg,qq)``."""
matching_order: Optional[Order] = None
"""Matching conditions perturbative order tuple, ``(QCD, QED)``."""

def __post_init__(self):
"""Enforce defaults."""
if self.matching_order is None:
self.matching_order = (self.order[0] - 1, 0)


@dataclass
class Debug(DictLike):
Expand All @@ -71,6 +74,7 @@ class Configs(DictLike):
"""Evolution mode."""
ev_op_max_order: Order
"""Maximum order to use in U matrices expansion.
Used only in ``perturbative`` solutions.
"""
ev_op_iterations: int
Expand All @@ -83,6 +87,7 @@ class Configs(DictLike):
"""Degree of elements of the intepolation polynomial basis."""
interpolation_is_log: bool
r"""Whether to use polynomials in :math:`\log(x)`.
If `false`, polynomials are in :math:`x`.
"""
polarized: bool
Expand All @@ -105,7 +110,8 @@ class OperatorCard(DictLike):

# collections
configs: Configs
"""Specific configuration to be used during the calculation of these operators."""
"""Specific configuration to be used during the calculation of these
operators."""
debug: Debug
"""Debug configurations."""

Expand Down Expand Up @@ -276,7 +282,6 @@ def update(theory: Union[RawCard, TheoryCard], operator: Union[RawCard, Operator
cards = update(theory, operator)
assert update(*cards) == cards
"""
if isinstance(theory, TheoryCard) or isinstance(operator, OperatorCard):
# if one is not a dict, both have to be new cards
Expand All @@ -291,13 +296,12 @@ def update(theory: Union[RawCard, TheoryCard], operator: Union[RawCard, Operator
def default_atlas(masses: list, matching_ratios: list):
r"""Create default landscape.
This method should not be used to write new runcards, but rather to have a
consistent default for comparison with other softwares and existing PDF
sets.
There is no one-to-one relation between number of running flavors and final
scales, unless matchings are all applied. But this is a custom choice,
since it is possible to have PDFs in different |FNS| at the same scales.
This method should not be used to write new runcards, but rather to
have a consistent default for comparison with other softwares and
existing PDF sets. There is no one-to-one relation between number of
running flavors and final scales, unless matchings are all applied.
But this is a custom choice, since it is possible to have PDFs in
different |FNS| at the same scales.
"""
matchings = (np.array(masses) * np.array(matching_ratios)) ** 2
return Atlas(matchings.tolist(), (0.0, 0))
Expand All @@ -306,16 +310,15 @@ def default_atlas(masses: list, matching_ratios: list):
def flavored_mugrid(mugrid: list, masses: list, matching_ratios: list):
r"""Upgrade :math:`\mu^2` grid to contain also target number flavors.
It determines the number of flavors for the PDF set at the target scale,
inferring it according to the specified scales.
This method should not be used to write new runcards, but rather to have a
consistent default for comparison with other softwares and existing PDF
sets.
There is no one-to-one relation between number of running flavors and final
scales, unless matchings are all applied. But this is a custom choice,
since it is possible to have PDFs in different |FNS| at the same scales.
It determines the number of flavors for the PDF set at the target
scale, inferring it according to the specified scales.
This method should not be used to write new runcards, but rather to
have a consistent default for comparison with other softwares and
existing PDF sets. There is no one-to-one relation between number of
running flavors and final scales, unless matchings are all applied.
But this is a custom choice, since it is possible to have PDFs in
different |FNS| at the same scales.
"""
atlas = default_atlas(masses, matching_ratios)
return [(mu, nf_default(mu**2, atlas)) for mu in mugrid]
Expand Down
10 changes: 1 addition & 9 deletions src/eko/runner/parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
After #242, the goal is to update :class:`Operator` and
:class:`OperatorMatrixElement` to simplify the computation and passing down
parameters.
"""
import numpy as np

Expand All @@ -28,7 +27,6 @@ def managers(eko: EKO) -> dict:
.. todo::
Legacy interface, avoid managers usage.
"""
tcard = eko.theory_card
ocard = eko.operator_card
Expand Down Expand Up @@ -60,7 +58,6 @@ def blowup_info(eko: EKO) -> dict:
evolution history (to determine if evolution is backward in flavor,
irrespectively of happening for an increasing or decreasing interval in
scale at fixed flavor).
"""
return dict(intrinsic_range=[4, 5, 6], qed=eko.theory_card.order[1] > 0)

Expand All @@ -71,7 +68,6 @@ def evolve_configs(eko: EKO) -> dict:
.. todo::
Legacy interface, make use of a dedicated object.
"""
tcard = eko.theory_card
ocard = eko.operator_card
Expand All @@ -89,9 +85,7 @@ def evolve_configs(eko: EKO) -> dict:
ModSV=ocard.configs.scvar_method,
n3lo_ad_variation=tcard.n3lo_ad_variation,
# Here order is shifted by one, no QED matching is available so far.
matching_order=tcard.matching_order
if tcard.matching_order is not None
else (tcard.order[0] - 1, 0),
matching_order=tcard.matching_order,
)


Expand All @@ -116,7 +110,6 @@ def matching_configs(eko: EKO) -> dict:
.. todo::
Legacy interface, make use of a dedicated object.
"""
tcard = eko.theory_card
ocard = eko.operator_card
Expand All @@ -138,7 +131,6 @@ def match(eko: EKO, recipe: Matching) -> Operator:
All the operators are blown up to flavor basis, and they are saved and
joined in that unique basis. So, the only rotation used is towards that
basis, and encoded in the blowing up prescription.
"""
kthr = eko.theory_card.heavy.squared_ratios[recipe.hq - 4]
op = ome.OperatorMatrixElement(
Expand Down

0 comments on commit 230646b

Please sign in to comment.