Skip to content

Commit

Permalink
Merge branch 'ome_rust' into rust_sv
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Sep 21, 2024
2 parents a019bf0 + ddc57bf commit 090c275
Show file tree
Hide file tree
Showing 198 changed files with 790 additions and 1,182 deletions.
7 changes: 4 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ language, however, please read a "Please" in front of everything.
- :brain: Be reasonable and use common sense when contributing: we
added some points we would like to highlight below
- :family: Follow our [Code of
Conduct](https://github.com/N3PDF/eko/blob/master/.github/CODE_OF_CONDUCT.md)
Conduct](https://github.com/NNPDF/eko/blob/master/.github/CODE_OF_CONDUCT.md)
and use the provided [Issue
Templates](https://github.com/N3PDF/eko/issues/new/choose)
Templates](https://github.com/NNPDF/eko/issues/new/choose)
- :1234: Use the _almost_ standard [SemVer](https://semver.org/) for version numbers

## Tools

Expand All @@ -25,7 +26,7 @@ language, however, please read a "Please" in front of everything.
generated (and intended to be used)
- :parking: [`pre-commit`](https://pre-commit.com/) is used to enforce
automation and standardize the tools for all developers; if you want
to contribute to this project, install it and setup
to contribute to this project, install it and activate it

## Docs

Expand Down
45 changes: 17 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,22 @@ repos:
hooks:
- id: pycln
args: [--config=pyproject.toml]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
hooks:
- id: blacken-docs
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
files: ^src/
args: ["--add-ignore=D107,D105"]
additional_dependencies:
- toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--in-place, --config, ./pyproject.toml]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies: [types-PyYAML]
Expand All @@ -53,14 +42,14 @@ repos:
- repo: local
hooks:
- id: fmt
name: fmt
name: cargo fmt
description: Format Rust files with cargo fmt.
entry: cargo fmt --
language: system
files: ^crates/.*\.rs$
args: []
- id: clippy
name: clippy
name: cargo clippy
description: Check Rust files with cargo clippy.
entry: cargo clippy --all-targets --all-features -- -Dclippy::all
pass_filenames: false
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/CT14_bench.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Benchmark CT14 pdf family
"""Benchmark CT14 pdf family.
- as far as I understand, the llo family uses LO splitting functions with LO alphas evolution,
whereas the lo family uses LO splitting functions with NLO alphas evolution
Expand All @@ -25,7 +24,7 @@


class BenchmarkCT14(Runner):
"""Benchmark CT14 pdfs"""
"""Benchmark CT14 pdfs."""

external = "LHAPDF"

Expand Down
7 changes: 2 additions & 5 deletions benchmarks/CT18_bench.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
"""
Benchmark CT18 pdf family
"""
"""Benchmark CT18 pdf family."""

from banana import register

Expand All @@ -23,7 +20,7 @@


class BenchmarkCT18(Runner):
"""Benchmark CT18 pdfs"""
"""Benchmark CT18 pdfs."""

external = "LHAPDF"

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/DSSV_bench.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Benchmark DSSV pdf family.
Note that the PDF set is private, but can be obtained from the
authors upon request.
Note that the PDF set is private, but can be obtained from the authors
upon request.
"""

from banana import register
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/FF_LHAPDF_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Benchmark FFs from LHAPDF"""
"""Benchmark FFs from LHAPDF."""

from banana import register

Expand Down
7 changes: 2 additions & 5 deletions benchmarks/HERA20_bench.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
"""
Benchmark HERAPDF2.0 pdf family
"""
"""Benchmark HERAPDF2.0 pdf family."""

from banana import register

Expand All @@ -27,7 +24,7 @@


class BenchmarkHERA20(Runner):
"""Benchmark HERA20 pdfs"""
"""Benchmark HERA20 pdfs."""

external = "LHAPDF"

Expand Down
16 changes: 6 additions & 10 deletions benchmarks/NNPDF_bench.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Benchmark NNPDF pdf family
"""
"""Benchmark NNPDF pdf family."""

from banana import register

Expand All @@ -11,9 +9,7 @@


class BenchmarkNNPDF(Runner):
"""
Globally set the external program to LHAPDF
"""
"""Globally set the external program to LHAPDF."""

external = "LHAPDF"

Expand Down Expand Up @@ -49,7 +45,7 @@ def skip_pdfs(self, _theory):


class BenchmarkNNPDF31(BenchmarkNNPDF):
"""Benchmark NNPDF3.1"""
"""Benchmark NNPDF3.1."""

def benchmark_nlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
Expand All @@ -64,7 +60,7 @@ def benchmark_nlo(self, Q0=1.65, mugrid=(10,)):


class BenchmarkNNPDF31_luxqed(BenchmarkNNPDF):
"""Benchmark NNPDF3.1_luxqed"""
"""Benchmark NNPDF3.1_luxqed."""

def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
Expand All @@ -91,7 +87,7 @@ def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)):


class BenchmarkNNPDF40(BenchmarkNNPDF):
"""Benchmark NNPDF4.0"""
"""Benchmark NNPDF4.0."""

def benchmark_nlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
Expand Down Expand Up @@ -119,7 +115,7 @@ def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)):


class BenchmarkNNPDFpol11(BenchmarkNNPDF):
"""Benchmark NNPDFpol11"""
"""Benchmark NNPDFpol11."""

def benchmark(self, Q0=1.65, mugrid=(10,)):
theory_card = {
Expand Down
42 changes: 19 additions & 23 deletions benchmarks/apfel_bench.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Benchmark EKO to Apfel
"""
"""Benchmark EKO to Apfel."""

import numpy as np
from banana import register
Expand All @@ -21,9 +19,7 @@ def tolist(input_dict):


class ApfelBenchmark(Runner):
"""
Globally set the external program to Apfel
"""
"""Globally set the external program to Apfel."""

external = "apfel"

Expand All @@ -37,7 +33,7 @@ def skip_pdfs(_theory):


class BenchmarkVFNS(ApfelBenchmark):
"""Benchmark VFNS"""
"""Benchmark VFNS."""

vfns_theory = {
"FNS": "ZM-VFNS",
Expand All @@ -59,7 +55,7 @@ class BenchmarkVFNS(ApfelBenchmark):
vfns_theory = tolist(vfns_theory)

def benchmark_plain(self, pto):
"""Plain configuration"""
"""Plain configuration."""

th = self.vfns_theory.copy()
th.update({"PTO": [pto]})
Expand All @@ -68,7 +64,7 @@ def benchmark_plain(self, pto):
)

def benchmark_sv(self, pto, svmode):
"""Scale Variation"""
"""Scale Variation."""

th = self.vfns_theory.copy()
th.update(
Expand All @@ -86,7 +82,7 @@ def benchmark_sv(self, pto, svmode):
)

def benchmark_kthr(self, pto):
"""Threshold scale different from heavy quark mass"""
"""Threshold scale different from heavy quark mass."""

th = self.vfns_theory.copy()
th.update(
Expand All @@ -101,10 +97,10 @@ def benchmark_kthr(self, pto):
)

def benchmark_msbar(self, pto):
"""
MSbar heavy quark mass scheme
when passing kthr != 1 both apfel and eko use ``kThr * msbar``,
as thr scale, where ``msbar`` is the usual ms_bar solution.
"""MSbar heavy quark mass scheme when passing kthr != 1 both apfel and
eko use ``kThr * msbar``, as thr scale, where ``msbar`` is the usual
ms_bar solution.
However apfel and eko manage the alpha_s thr differently:
apfel uses the given mass parameters as thr multiplied by the kthr,
while in eko only the already computed thr matters, so the
Expand Down Expand Up @@ -132,7 +128,7 @@ def benchmark_msbar(self, pto):


class BenchmarkFFNS(ApfelBenchmark):
"""Benckmark FFNS"""
"""Benckmark FFNS."""

ffns_theory = {
"FNS": "FFNS",
Expand All @@ -150,7 +146,7 @@ class BenchmarkFFNS(ApfelBenchmark):
ffns_theory = tolist(ffns_theory)

def benchmark_plain(self, pto):
"""Plain configuration"""
"""Plain configuration."""

th = self.ffns_theory.copy()
th.update({"PTO": [pto]})
Expand All @@ -159,7 +155,7 @@ def benchmark_plain(self, pto):
)

def benchmark_plain_pol(self, pto):
"""Plain configuration"""
"""Plain configuration."""

th = self.ffns_theory.copy()
th.update({"PTO": [pto]})
Expand All @@ -169,7 +165,7 @@ def benchmark_plain_pol(self, pto):
self.run(cartesian_product(th), operators.build(op), ["ToyLH"])

def benchmark_sv(self, pto, svmode):
"""Scale Variation"""
"""Scale Variation."""

ts = []
th = self.ffns_theory.copy()
Expand Down Expand Up @@ -198,7 +194,7 @@ def benchmark_sv(self, pto, svmode):


class BenchmarkFFNS_qed(ApfelBenchmark):
"""Benckmark FFNS"""
"""Benckmark FFNS."""

ffns_theory = {
"Qref": 91.1870,
Expand All @@ -223,7 +219,7 @@ class BenchmarkFFNS_qed(ApfelBenchmark):
ffns_theory = tolist(ffns_theory)

def benchmark_plain(self, pto, qed):
"""Plain configuration"""
"""Plain configuration."""

th = self.ffns_theory.copy()
th.update({"PTO": [pto], "QED": [qed]})
Expand All @@ -240,7 +236,7 @@ def benchmark_plain(self, pto, qed):
)

def benchmark_sv(self, pto, qed, svmode):
"""Scale Variation"""
"""Scale Variation."""

ts = []
th = self.ffns_theory.copy()
Expand Down Expand Up @@ -277,7 +273,7 @@ def benchmark_sv(self, pto, qed, svmode):


class BenchmarkVFNS_qed(ApfelBenchmark):
"""Benckmark FFNS"""
"""Benckmark FFNS."""

vfns_theory = {
"Qref": 91.1870,
Expand All @@ -301,7 +297,7 @@ class BenchmarkVFNS_qed(ApfelBenchmark):
vfns_theory = tolist(vfns_theory)

def benchmark_plain(self, pto, qed):
"""Plain configuration"""
"""Plain configuration."""

th = self.vfns_theory.copy()
th.update({"PTO": [pto], "QED": [qed]})
Expand Down
8 changes: 5 additions & 3 deletions benchmarks/eko/benchmark_alphaem.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""This module benchmarks alpha_em against alphaQED23 and validphys.
alphaQED23 can be obtained from http://www-com.physik.hu-berlin.de/~fjeger/software.html .
alphaQED23 can be obtained from
http://www-com.physik.hu-berlin.de/~fjeger/software.html
.
"""

import numpy as np
Expand All @@ -14,7 +16,7 @@
@pytest.mark.isolated
class BenchmarkCouplings:
def test_alphaQED_high(self):
"""testing aginst alphaQED23 for high Q values"""
"""Testing aginst alphaQED23 for high Q values."""
alphaQED23 = np.array(
[
0.0075683,
Expand Down Expand Up @@ -90,7 +92,7 @@ def test_alphaQED_low(self):
np.testing.assert_allclose(alphaQED23, alpha_eko, rtol=3.2e-3)

def test_validphys(self):
"""testing aginst validphys"""
"""Testing aginst validphys."""
alpha_vp = np.array(
[
0.007408255774054356,
Expand Down
Loading

0 comments on commit 090c275

Please sign in to comment.