Skip to content

Commit

Permalink
Merge branch 'master' into runcards-update-248
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Aug 8, 2024
2 parents 618639b + e6e3913 commit 6a73625
Show file tree
Hide file tree
Showing 54 changed files with 685 additions and 820 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
rev: v3.17.0
hooks:
- id: pyupgrade
- repo: https://github.com/pycqa/pydocstyle
Expand Down Expand Up @@ -60,6 +60,6 @@ repos:
files: ^crates/.*\.rs$
args: []
- repo: https://github.com/pre-commit/pre-commit
rev: v3.7.1
rev: v3.8.0
hooks:
- id: validate_manifest
12 changes: 3 additions & 9 deletions benchmarks/eko/benchmark_alphaem.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ def test_alphaQED_high(self):
dict(
alphas=0.118,
alphaem=7.7553e-03,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=5,
ref=(91.2, 5),
em_running=True,
)
)
Expand Down Expand Up @@ -75,9 +73,7 @@ def test_alphaQED_low(self):
dict(
alphas=0.118,
alphaem=7.7553e-03,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=5,
ref=(91.2, 5),
em_running=True,
)
)
Expand Down Expand Up @@ -124,9 +120,7 @@ def test_validphys(self):
dict(
alphas=0.118,
alphaem=7.7553e-03,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=5,
ref=(91.2, 5),
em_running=True,
)
)
Expand Down
9 changes: 2 additions & 7 deletions benchmarks/eko/benchmark_inverse_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@
couplings=dict(
alphas=0.118,
alphaem=0.007496252,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=6,
ref=(91.2, 5),
),
heavy=dict(
num_flavs_init=4,
num_flavs_max_pdf=6,
intrinsic_flavors=[],
masses=[ReferenceRunning([mq, np.nan]) for mq in (MC, 4.92, 172.5)],
masses_scheme="POLE",
matching_ratios=[1.0, 1.0, np.inf],
Expand All @@ -40,7 +35,7 @@

# operator settings
op_raw = dict(
mu0=1.65,
init=(1.65, 4),
xgrid=[0.0001, 0.001, 0.01, 0.1, 1],
mugrid=[(MC, 3), (MC, 4)],
configs=dict(
Expand Down
65 changes: 65 additions & 0 deletions crates/doc-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-hIoBPJpTUs74ddyc4bFZSM1TVlQDA60VBbJS0oA934VSz82sBx1X7kSx2ATBDIyd" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
// activate KaTeX
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
// • rendering keys, e.g.:
throwOnError : false
});

// Allow abbreviations
let abbrevs = {
"EKO": "Evolution Kernel Operator",
"PDF": "Parton Distribution Function(s)",
"FF": "Fragmentation Function(s)",
"FNS": "Flavor Number Scheme",
"FFNS": "Fixed Flavor Number Scheme",
"VFNS": "Variable Flavor Number Scheme",
"LO": "Leading Order",
"NLO": "Next-to-Leading Order",
"NNLO": "Next-to-Next-to-Leading Order",
"N3LO": "Next-to-Next-to-Next-to-Leading Order",
"LL": "Leading Log",
"NLL": "Next-to-Leading Log",
"NNLL": "Next-to-Next-to-Leading Log",
"DGLAP": "Dokshitzer-Gribov-Lipatov-Altarelli-Parisi",
"PID": "(Monte Carlo) parton identifier",
"OME": "Operator Matrix Element",
"RGE": "Renormalization Group Equation",
"MHOU": "Missing Higher Order Uncertainties",
"QCD": "Quantum Chromodynamics",
"QED": "Quantum Electrodynamics",
"DIS": "Deep Inelastic Scattering",
"BFKL": "Balitsky-Fadin-Kuraev-Lipatov",
"FHMRUVV": "Falcioni, Herzog, Moch, Ruijl, Ueda, Vermaseren and Vogt",
"API": "Application Program Interface",
};
// parse abbreviations
let parsedAbbrevs = {};
for (el in abbrevs) {
parsedAbbrevs["|" + el + "|"] = "<abbr title='"+abbrevs[el]+"' >"+el+"</abbr>";
}
// do the actual replace
function replaceAbbrev(el) {
let txt = el.textContent;
for (k in parsedAbbrevs)
txt = txt.replace(k, parsedAbbrevs[k]);
el.innerHTML = txt;
}
// search texts
let longs = document.getElementsByClassName("docblock");
for (let el of longs) replaceAbbrev(el);
let shorts = document.getElementsByClassName("docblock-short");
for (let el of shorts) replaceAbbrev(el);
});
</script>
2 changes: 1 addition & 1 deletion crates/eko/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rust-version.workspace = true
version.workspace = true

[package.metadata.docs.rs]
rustdoc-args = ["--html-in-header", "katex-header.html"]
rustdoc-args = ["--html-in-header", "doc-header.html"]

[lib]
name = "ekors"
Expand Down
1 change: 1 addition & 0 deletions crates/eko/doc-header.html
1 change: 0 additions & 1 deletion crates/eko/katex-header.html

This file was deleted.

2 changes: 1 addition & 1 deletion crates/ekore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rust-version.workspace = true
version.workspace = true

[package.metadata.docs.rs]
rustdoc-args = ["--html-in-header", "katex-header.html"]
rustdoc-args = ["--html-in-header", "doc-header.html"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
1 change: 1 addition & 0 deletions crates/ekore/doc-header.html
1 change: 0 additions & 1 deletion crates/ekore/katex-header.html

This file was deleted.

19 changes: 0 additions & 19 deletions crates/katex-header.html

This file was deleted.

20 changes: 20 additions & 0 deletions crates/parse-abbrev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Parse abbreviations from sphinx to Rust."""

import pathlib
import re

SRC = (
pathlib.Path(__file__).parents[1]
/ "doc"
/ "source"
/ "shared"
/ "abbreviations.rst"
)

cnt = SRC.read_text("utf-8")
for el in cnt.split(".."):
test = re.match(r"\s*(.+)\s+replace::\n\s+:abbr:`(.+?)\((.+)\)`", el.strip())
if test is None:
continue
# Print to terminal - the user can dump to the relevant file
print(f'"{test[2].strip()}": "{test[3].strip()}",')
12 changes: 9 additions & 3 deletions src/eko/evolution_operator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from .. import basis_rotation as br
from .. import interpolation, mellin
from .. import scale_variations as sv
from ..io.types import OperatorLabel
from ..io.types import EvolutionMethod, OperatorLabel
from ..kernels import ev_method
from ..kernels import non_singlet as ns
from ..kernels import non_singlet_qed as qed_ns
from ..kernels import singlet as s
Expand Down Expand Up @@ -606,7 +607,7 @@ def quad_ker_qed(
"""Map of all operators."""


class Operator(sv.ModeMixin):
class Operator(sv.ScaleVariationModeMixin):
"""Internal representation of a single EKO.
The actual matrices are computed upon calling :meth:`compute`.
Expand Down Expand Up @@ -786,6 +787,11 @@ def labels(self):
labels.extend(br.singlet_unified_labels)
return labels

@property
def ev_method(self):
"""Return the evolution method."""
return ev_method(EvolutionMethod(self.config["method"]))

def quad_ker(self, label, logx, areas):
"""Return partially initialized integrand function.
Expand All @@ -809,7 +815,7 @@ def quad_ker(self, label, logx, areas):
order=self.order,
mode0=label[0],
mode1=label[1],
method=self.config["method"],
method=self.ev_method,
is_log=self.int_disp.log,
logx=logx,
areas=areas,
Expand Down
26 changes: 13 additions & 13 deletions src/eko/evolution_operator/__init__.py.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/eko/evolution_operator/__init__.py b/src/eko/evolution_operator/__init__.py
index 1c759c5c..5eb394d0 100644
index fe07ade9..0f58c9e5 100644
--- a/src/eko/evolution_operator/__init__.py
+++ b/src/eko/evolution_operator/__init__.py
@@ -3,15 +3,15 @@ r"""Contains the central operator classes.
@@ -3,16 +3,16 @@ r"""Contains the central operator classes.
See :doc:`Operator overview </code/Operators>`.
"""

Expand All @@ -11,6 +11,7 @@ index 1c759c5c..5eb394d0 100644
import os
import time
from multiprocessing import Pool
from typing import Dict, Tuple

+import ekors
import numba as nb
Expand All @@ -20,7 +21,7 @@ index 1c759c5c..5eb394d0 100644

import ekore.anomalous_dimensions.polarized.space_like as ad_ps
import ekore.anomalous_dimensions.unpolarized.space_like as ad_us
@@ -27,92 +27,10 @@ from ..kernels import singlet_qed as qed_s
@@ -30,92 +30,10 @@ from ..kernels import singlet_qed as qed_s
from ..kernels import valence_qed as qed_v
from ..matchings import Segment, lepton_number
from ..member import OpMember
Expand Down Expand Up @@ -114,7 +115,7 @@ index 1c759c5c..5eb394d0 100644
spec = [
("is_singlet", nb.boolean),
("is_QEDsinglet", nb.boolean),
@@ -184,422 +102,6 @@ class QuadKerBase:
@@ -187,421 +105,6 @@ class QuadKerBase:
return self.path.prefactor * pj * self.path.jac


Expand Down Expand Up @@ -533,13 +534,12 @@ index 1c759c5c..5eb394d0 100644
- )
- return ker
-
-
class Operator(sv.ModeMixin):
"""Internal representation of a single EKO.

@@ -780,50 +282,6 @@ class Operator(sv.ModeMixin):
labels.extend(br.singlet_unified_labels)
return labels
OpMembers = Dict[OperatorLabel, OpMember]
"""Map of all operators."""
@@ -792,50 +295,6 @@ class Operator(sv.ScaleVariationModeMixin):
"""Return the evolution method."""
return ev_method(EvolutionMethod(self.config["method"]))

- def quad_ker(self, label, logx, areas):
- """Return partially initialized integrand function.
Expand All @@ -564,7 +564,7 @@ index 1c759c5c..5eb394d0 100644
- order=self.order,
- mode0=label[0],
- mode1=label[1],
- method=self.config["method"],
- method=self.ev_method,
- is_log=self.int_disp.log,
- logx=logx,
- areas=areas,
Expand All @@ -588,7 +588,7 @@ index 1c759c5c..5eb394d0 100644
def initialize_op_members(self):
"""Init all operators with the identity or zeros."""
eye = OpMember(
@@ -846,10 +304,7 @@ class Operator(sv.ModeMixin):
@@ -858,10 +317,7 @@ class Operator(sv.ScaleVariationModeMixin):
else:
self.op_members[n] = zero.copy()

Expand All @@ -600,7 +600,7 @@ index 1c759c5c..5eb394d0 100644
"""Run the integration for each grid point.

Parameters
@@ -864,18 +319,56 @@ class Operator(sv.ModeMixin):
@@ -876,18 +332,56 @@ class Operator(sv.ScaleVariationModeMixin):
"""
column = []
k, logx = log_grid
Expand Down
2 changes: 1 addition & 1 deletion src/eko/evolution_operator/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Managers:
interpolator: InterpolatorDispatcher


class OperatorGrid(sv.ModeMixin):
class OperatorGrid(sv.ScaleVariationModeMixin):
"""Collection of evolution operators for several scales.
The operator grid is the driver class of the evolution.
Expand Down
Loading

0 comments on commit 6a73625

Please sign in to comment.