Skip to content

Commit

Permalink
Merge pull request #190 from NNPDF/develop
Browse files Browse the repository at this point in the history
Drop `develop`
  • Loading branch information
felixhekhorn authored Jan 27, 2023
2 parents e3466fa + f3c4f8f commit c484957
Show file tree
Hide file tree
Showing 248 changed files with 6,346 additions and 5,814 deletions.
10 changes: 0 additions & 10 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
# check only master and branches that should be merged directly into
# master
branches:
- master
- develop
- "feature/*"
- "release/*"

parsers:
gcov:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
fail-fast: false

uses: N3PDF/workflows/.github/workflows/python-poetry-tests.yml@v2
with:
Expand Down
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ repos:
- id: check-toml
- id: check-merge-conflict
- id: debug-statements
- id: fix-encoding-pragma
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
Expand All @@ -28,13 +27,13 @@ repos:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.1
rev: v3.2.0
hooks:
- id: pyupgrade
- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
- id: pydocstyle
files: ^src/
additional_dependencies:
- toml
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ When using our code please cite

## Contributing
- Your feedback is welcome! If you want to report a (possible) bug or want to ask for a new feature, please raise an issue: <a href="https://github.com/N3PDF/eko/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/N3PDF/eko"/></a>
- If you need help, for installation, usage, or anything related, feel free to open a new discussion in the ["Support" section](https://github.com/NNPDF/eko/discussions/categories/support)
- Please follow our [Code of Conduct](https://github.com/N3PDF/eko/blob/master/.github/CODE_OF_CONDUCT.md) and read the
[Contribution Guidelines](https://github.com/N3PDF/eko/blob/master/.github/CONTRIBUTING.md)
1 change: 0 additions & 1 deletion benchmarks/CT14_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Benchmark CT14 pdf family
Expand Down
1 change: 0 additions & 1 deletion benchmarks/CT18_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Benchmark CT18 pdf family
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/HERA20_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Benchmark HERAPDF2.0 pdf family
Expand All @@ -22,7 +21,7 @@
}

# LHAPDF x-range is smaller
base_op = {"interpolation_xgrid": interpolation.make_lambert_grid(50, 1.0e-6)}
base_op = {"interpolation_xgrid": interpolation.lambertgrid(50, 1.0e-6)}


class BenchmarkHERA20(Runner):
Expand Down
1 change: 0 additions & 1 deletion benchmarks/NNPDF_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Benchmark NNPDF pdf family
"""
Expand Down
1 change: 0 additions & 1 deletion benchmarks/apfel_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Benchmark EKO to Apfel
"""
Expand Down
31 changes: 31 additions & 0 deletions benchmarks/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import numpy as np
import pytest

from eko import interpolation
from eko.io.runcards import TheoryCard
from ekobox import cards


@pytest.fixture
def theory_card():
return cards.example.theory()


@pytest.fixture()
def theory_ffns(theory_card):
def set_(flavors: int) -> TheoryCard:
i = flavors - 3
for q in "cbt"[i:]:
setattr(theory_card.matching, q, np.inf)
return theory_card

return set_


@pytest.fixture
def operator_card():
card = cards.example.operator()
card.rotations.xgrid = interpolation.XGrid([0.1, 0.3, 0.5, 1.0])
card.configs.interpolation_polynomial_degree = 2

return card
1 change: 0 additions & 1 deletion benchmarks/eko/benchmark_ad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Benchmark the NLO anomalous dimensions against PEGASUS"""
import numpy as np
import pytest
Expand Down
118 changes: 40 additions & 78 deletions benchmarks/eko/benchmark_evol_to_unity.py
Original file line number Diff line number Diff line change
@@ -1,95 +1,57 @@
# -*- coding: utf-8 -*-
import pathlib
from math import nan

import numpy as np
import pytest

from eko import basis_rotation as br
from eko import compatibility
from eko.couplings import Couplings
from eko.evolution_operator import Operator
from eko.evolution_operator.grid import OperatorGrid
from eko.interpolation import InterpolatorDispatcher, XGrid
from eko.thresholds import ThresholdsAtlas
from eko.interpolation import XGrid
from eko.io import types
from eko.io.runcards import OperatorCard, TheoryCard
from eko.runner.legacy import Runner

# from eko.matching_conditions.operator_matrix_element import OperatorMatrixElement


@pytest.mark.isolated
class BenchmarkBackwardForward:
# setup objs
theory_card = {
"alphas": 0.35,
"alphaqed": 0.007496,
"PTO": 0,
"QED": 0,
"ModEv": "EXA",
"fact_to_ren_scale_ratio": 1.0,
"Qref": np.sqrt(2),
"nfref": None,
"Q0": np.sqrt(2),
"nf0": 4,
"IC": 1,
"IB": 1,
"mc": 1.0,
"mb": 4.75,
"mt": 173.0,
"kcThr": 1.0,
"kbThr": 1.0,
"ktThr": 1.0,
"MaxNfPdf": 6,
"MaxNfAs": 6,
"HQ": "POLE",
"ModSV": None,
}
operators_card = {
"Q2grid": [10],
# here you need a very dense grid
"xgrid": np.linspace(1e-1, 1, 30),
# "xgrid": make_grid(30,30, x_min=1e-3),
"configs": {
"interpolation_polynomial_degree": 1,
"interpolation_is_log": True,
"ev_op_max_order": (2, 0),
"ev_op_iterations": 1,
"backward_inversion": "exact",
"n_integration_cores": 1,
},
"debug": {
"skip_singlet": False,
"skip_non_singlet": False,
},
}
new_theory, new_operators = compatibility.update(theory_card, operators_card)
g = OperatorGrid.from_dict(
new_theory,
new_operators,
ThresholdsAtlas.from_dict(new_theory),
Couplings.from_dict(new_theory),
InterpolatorDispatcher(
XGrid(
new_operators["xgrid"],
log=new_operators["configs"]["interpolation_is_log"],
),
new_operators["configs"]["interpolation_polynomial_degree"],
),
def update_cards(theory: TheoryCard, operator: OperatorCard):
theory.couplings = types.CouplingsRef(
alphas=types.FloatRef(value=0.35, scale=float(np.sqrt(2))),
alphaem=types.FloatRef(value=0.007496, scale=nan),
max_num_flavs=6,
num_flavs_ref=None,
)
theory.num_flavs_init = 4
theory.intrinsic_flavors = [4, 5]
theory.quark_masses.c.value = 1.0
theory.quark_masses.b.value = 4.75
theory.quark_masses.t.value = 173.0
operator.mu0 = float(np.sqrt(2))
operator.mu2grid = [10]
operator.rotations.xgrid = XGrid(np.linspace(1e-1, 1, 30))
operator.configs.interpolation_polynomial_degree = 1
operator.configs.ev_op_max_order = (2, 0)
operator.configs.ev_op_iterations = 1
operator.configs.inversion_method = types.InversionMethod.EXACT
operator.configs.n_integration_cores = 1


@pytest.mark.isolated
class BenchmarkBackwardForward:
def test_operator_grid(
# test that eko_forward @ eko_backward gives ID matrix or zeros
self,
theory_card: TheoryCard,
operator_card: OperatorCard,
tmp_path: pathlib.Path,
):
g = OperatorGrid.from_dict(
self.new_theory,
self.new_operators,
ThresholdsAtlas.from_dict(self.new_theory),
Couplings.from_dict(self.new_theory),
InterpolatorDispatcher(
XGrid(
self.new_operators["xgrid"],
log=self.new_operators["configs"]["interpolation_is_log"],
),
self.new_operators["configs"]["interpolation_polynomial_degree"],
),
)
"""Test that eko_forward @ eko_backward gives ID matrix or zeros."""
update_cards(theory_card, operator_card)
g = Runner(
theory_card=theory_card,
operators_card=operator_card,
path=tmp_path / "eko.tar",
).op_grid

q20 = 30
q21 = 50
nf = 4
Expand Down
Loading

0 comments on commit c484957

Please sign in to comment.