Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
241345d
Added first test of configs
andreab1997 Jun 15, 2022
04bc966
Added other tests of configs
andreab1997 Jun 15, 2022
101f63f
Completed config tests
andreab1997 Jun 15, 2022
d778955
Fixing
andreab1997 Jun 15, 2022
2fd0bd9
Added pineko.toml file for testing
andreab1997 Jun 15, 2022
44f8bf5
Added tests for theory_card
andreab1997 Jun 15, 2022
e4b3a1b
Added tests for check
andreab1997 Jun 15, 2022
f0e22e4
Init evolve test
andreab1997 Jun 15, 2022
e86e5ed
Completed evolve tests
andreab1997 Jun 15, 2022
0eca8f5
Init test theory
andreab1997 Jun 15, 2022
204c6b2
Other theory tests
andreab1997 Jun 15, 2022
50af20e
Completed test for theory
andreab1997 Jun 16, 2022
968673d
Added necessary files
andreab1997 Jun 16, 2022
b0f2703
Added file
andreab1997 Jun 16, 2022
2752533
Added dir
andreab1997 Jun 16, 2022
01e5019
Remove stuff
andreab1997 Jun 16, 2022
f8dbaae
Added some cli tests
andreab1997 Jun 16, 2022
e4ef2f7
First attempt to SV
felixhekhorn May 11, 2022
4cc5c88
Update pre-commit
felixhekhorn May 11, 2022
319a79a
Run pre-commit
felixhekhorn May 11, 2022
b41a20e
Pass alpha_s around
felixhekhorn May 11, 2022
ea6fe0d
Propagate scales around
felixhekhorn May 12, 2022
a08884c
Fix compare call. Save before compare
felixhekhorn May 12, 2022
aa29f5c
Fix bug in as computation
felixhekhorn May 17, 2022
da496a5
Pass more xiev around
felixhekhorn May 23, 2022
ec5e243
Remove xiev
felixhekhorn Jun 6, 2022
3129554
Init pydocstyle and update pre-commit
felixhekhorn Jun 8, 2022
710f976
Appease pydocstyle
felixhekhorn Jun 8, 2022
4869ca0
Fix assumptions hash computation
felixhekhorn Jun 15, 2022
2a10743
Revert assuptions fix
felixhekhorn Jun 15, 2022
271eea2
Play with SV
felixhekhorn Jun 15, 2022
d088c6c
Improve sv script
felixhekhorn Jun 16, 2022
c6c4472
Save debug script
felixhekhorn Jun 22, 2022
2aceb26
Backup more debug stuff
felixhekhorn Jul 8, 2022
a33dd4c
Upgrade PineAPPL to v0.5.4
alecandido Jul 9, 2022
6119584
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
6f32da0
Fixing
andreab1997 Jun 17, 2022
da639bf
Fixing
andreab1997 Jun 13, 2022
bd16255
Put scalevar parameters as arguments
andreab1997 Jun 13, 2022
90aeace
Fixed init of cli
andreab1997 Jun 13, 2022
4ec986a
Added SV check as default when computing fks
andreab1997 Jun 16, 2022
42dd75b
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
9a08100
Change argument of the function and put tocheck as argument
andreab1997 Jul 5, 2022
ca1dcff
put the grid as argument of evolve
andreab1997 Jul 8, 2022
3ae9f29
Run pre-commit
andreab1997 Jul 8, 2022
01710dc
Removed redundant def of xir and xif
andreab1997 Jul 8, 2022
3aedd43
Fixed import of pineappl
andreab1997 Jul 8, 2022
78a1d67
Fixed import of pineappl
andreab1997 Jul 9, 2022
9b9b9ed
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
0a24150
Fixing
andreab1997 Jun 17, 2022
b3517e1
First implementation
andreab1997 Jun 13, 2022
cfcdf11
Fixing
andreab1997 Jun 13, 2022
a1f3cab
Put scalevar parameters as arguments
andreab1997 Jun 13, 2022
c076e79
Fixed init of cli
andreab1997 Jun 13, 2022
237269f
Added SV check as default when computing fks
andreab1997 Jun 16, 2022
c88a95c
Fixing
andreab1997 Jun 16, 2022
bd22d00
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
ab248fd
Fixing
andreab1997 Jun 17, 2022
059fad8
Change argument of the function and put tocheck as argument
andreab1997 Jul 5, 2022
0b0549d
put the grid as argument of evolve
andreab1997 Jul 8, 2022
7bcff1e
Run pre-commit
andreab1997 Jul 8, 2022
73b1d87
Fixed import of pineappl
andreab1997 Jul 8, 2022
228a89f
Minor changes
andreab1997 Jul 9, 2022
5b0f976
Change names of funcs
andreab1997 Jul 11, 2022
53efcc5
Fixed theory
andreab1997 Jul 11, 2022
e8aa039
Remove debug scripts
felixhekhorn Jul 11, 2022
aff171b
Changed eko args in evolve_grid
andreab1997 Jul 8, 2022
dc1e73d
fixed names of import and runned pre-commit
andreab1997 Jul 8, 2022
22ad61e
Changed eko args in evolve_grid
andreab1997 Jul 8, 2022
e10d1fd
fixed names of import and runned pre-commit
andreab1997 Jul 8, 2022
53e520e
Fixing
andreab1997 Jul 11, 2022
65ae229
First draft of implementation
andreab1997 Jul 5, 2022
4551808
Added check on lumi
andreab1997 Jul 8, 2022
6ef0034
Removed pdb
andreab1997 Jul 8, 2022
b066450
Fixing
andreab1997 Jul 11, 2022
2d3c344
Changed name
andreab1997 Jul 11, 2022
697d987
Added relevant test
andreab1997 Jul 12, 2022
e8df738
Fixed conflict
andreab1997 Jul 12, 2022
991c4f3
Update src/pineko/evolve.py
felixhekhorn Jul 11, 2022
6e495db
Update src/pineko/theory.py
felixhekhorn Jul 11, 2022
c5e90d2
Rename xi to xif
felixhekhorn Jul 11, 2022
1492378
Narrow opcard args in theory
felixhekhorn Jul 11, 2022
99c6b55
Added relevant tests
andreab1997 Jul 12, 2022
e0ac356
Refactor check subcommand
alecandido Jul 12, 2022
7752c32
Improve functions' names consistency
alecandido Jul 12, 2022
6e5e85d
Removed isDIS
andreab1997 Jul 12, 2022
076d22a
Changed grid name
andreab1997 Jul 12, 2022
28c4e90
Update src/pineko/check.py
andreab1997 Jul 12, 2022
d5a66a0
Fix missing not
alecandido Jul 12, 2022
f945ac0
Fixed bug
andreab1997 Jul 12, 2022
730c344
Added first element in check and updated test
andreab1997 Jul 14, 2022
09ca0b1
slitted func islepton and updated tests
andreab1997 Jul 15, 2022
61ed41e
Updated test
andreab1997 Jul 15, 2022
bd7fc92
Updating tests
andreab1997 Jul 19, 2022
3443598
Fixed checks and tests
andreab1997 Jul 15, 2022
9882041
Fixed func and updated test
andreab1997 Jul 15, 2022
1410ac3
Refactor check to include order_mask and sv for QED
andreab1997 Jul 15, 2022
e749f9c
Added some docs
andreab1997 Jul 15, 2022
f661681
Fixing docs
andreab1997 Jul 19, 2022
5a8c6cf
Fixing url of logo
andreab1997 Jul 19, 2022
f1020c8
Update README.md
andreab1997 Jul 20, 2022
e97b5c4
Update pre-commit
felixhekhorn Jul 20, 2022
6844ec3
Anger black
felixhekhorn Jul 20, 2022
42c8e70
Reconcile black
felixhekhorn Jul 20, 2022
7ae14e2
Restore docstrings for module level variables
alecandido Jul 20, 2022
c6416af
Drop check-docstring-first due to https://github.com/pre-commit/pre-c…
felixhekhorn Jul 20, 2022
20eadd8
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 1, 2022
d3a8b66
Fixed integrability opcards
andreab1997 Aug 18, 2022
cbaef67
Fixing
andreab1997 Aug 18, 2022
18f6c1f
Fixing again
andreab1997 Aug 18, 2022
dfa1265
Copying x_grid rather than assigning
andreab1997 Aug 18, 2022
370c59a
explicitly casting the list
andreab1997 Aug 18, 2022
a612ba4
Recognize integrability from grid
andreab1997 Aug 19, 2022
b090b83
Removed int argument from func
andreab1997 Aug 19, 2022
5b38cff
Removed wrong docs
andreab1997 Aug 24, 2022
81f05cb
Removed function is_integrability
andreab1997 Aug 25, 2022
007a46a
Run poetry update
felixhekhorn Aug 26, 2022
58c122d
Update eko and pineappl
felixhekhorn Aug 26, 2022
584c7ab
Fix eko syntax
felixhekhorn Aug 26, 2022
b7f4deb
Add eko compatibility layer
felixhekhorn Aug 26, 2022
866fc5b
Add version information
felixhekhorn Aug 26, 2022
f496232
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Sep 5, 2022
f22c86f
Removed wrong test on factorization scale for schemeB
andreab1997 Sep 12, 2022
fa6dc70
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Sep 19, 2022
12a5053
Added tests for check
andreab1997 Jun 15, 2022
579dc54
Merge branch 'main' into testing
andreab1997 Sep 21, 2022
e6bfb37
Fix test_check
andreab1997 Sep 21, 2022
ed4c3a4
Fix test_cli
andreab1997 Sep 21, 2022
52d5195
Fix test_evolve
andreab1997 Sep 21, 2022
ff73e6b
Fix test_theory_card
andreab1997 Sep 21, 2022
4b8d284
Fix test_theory
andreab1997 Sep 21, 2022
688e4cc
Run black
andreab1997 Sep 21, 2022
278e0fe
Remove useless import
andreab1997 Sep 21, 2022
ba323a8
Separe benchmarks from tests
andreab1997 Sep 21, 2022
6674dba
Fix .toml
andreab1997 Sep 21, 2022
7aa598b
Fix theory_bench and change workflow for bench
andreab1997 Sep 21, 2022
ff630b6
Change names of benchmarks
andreab1997 Sep 21, 2022
c02328e
TEST: remove theory_bench
andreab1997 Sep 21, 2022
c089af1
Restore theory_bench and pineko.toml
andreab1997 Sep 21, 2022
e3ca4e9
Change name of benchmarks
andreab1997 Sep 21, 2022
3f468fd
Fix bench
andreab1997 Sep 21, 2022
6d56fdd
Add test for islepton
andreab1997 Oct 3, 2022
7784436
Add test on exception of check
andreab1997 Oct 3, 2022
5137572
Add test for check cli
andreab1997 Oct 3, 2022
035e504
Add test for comparator
andreab1997 Oct 3, 2022
c1e95d2
Change Fk to check in benchmark
andreab1997 Oct 3, 2022
949018f
Add fakepdf and test for compare cli
andreab1997 Oct 3, 2022
f064fa5
Remove banana
andreab1997 Oct 3, 2022
333e3d6
Fix path of fakepdf
andreab1997 Oct 3, 2022
e877f65
Fix test_pdf path
andreab1997 Oct 3, 2022
c6004b5
Remove useless members of pdf
andreab1997 Oct 3, 2022
0c3edc2
Change name of evolve benchmark
andreab1997 Oct 3, 2022
28158aa
Make folders explicit
andreab1997 Oct 3, 2022
70ef0ce
Make folders explicit again
andreab1997 Oct 3, 2022
aa49853
Make folders explicit in theory_bench
andreab1997 Oct 3, 2022
5e0fd12
Update pyproject.toml
andreab1997 Oct 3, 2022
9572d93
Update workflow to cache poetry virtualenv
andreab1997 Oct 3, 2022
435d020
Try to fix workflow
andreab1997 Oct 3, 2022
ec5f792
Try to install project only, when cache is used
alecandido Oct 3, 2022
fa63bd1
Revert "Try to install project only, when cache is used "
alecandido Oct 3, 2022
0ab1126
Ignore local config
felixhekhorn Oct 4, 2022
3654d7b
Fix unused imports
felixhekhorn Oct 4, 2022
375ddbb
Make lhapdf_path a fixture
andreab1997 Oct 4, 2022
0b91ba8
Make test_files and test_pdf fixtures
andreab1997 Oct 4, 2022
1774ae5
Change names of benchmarks
andreab1997 Oct 4, 2022
f52eeff
Update benchmarks/bench_theory.py
andreab1997 Oct 4, 2022
554f3a4
Change name of theory_obj_hera
andreab1997 Oct 4, 2022
584e653
Use pytest fixtures
andreab1997 Oct 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: benchmarks

on: push

jobs:
bench:
name: Benchmarks
runs-on: ubuntu-latest

container:
image: ghcr.io/n3pdf/bench-evol:latest
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
with:
# tags needed for dynamic versioning
fetch-depth: 0
- name: Install and configure Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
# update path for this and the other steps
export PATH=$HOME/.local/bin:$PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
# prevent poetry environments
# in order to access container pre-installed packages
poetry config virtualenvs.create false
# log all configurations
poetry config --list
Comment thread
andreab1997 marked this conversation as resolved.
- name: Cache Poetry virtualenv
uses: actions/cache@v2
id: cache
with:
path: ~/.virtualenvs
key: ${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install version management tool
run: |
# same poetry env
PIP="$(head -n1 $(which poetry) | cut -c 3-) -m pip"
${PIP} install poetry-dynamic-versioning
- name: Install dependencies
run: poetry install --no-interaction --no-root
if: steps.cache.outputs.cache-hit != 'true'
- name: Install project
run: |
poetry install --no-interaction ${{ inputs.poetry-extras }}
Comment thread
alecandido marked this conversation as resolved.
- name: Install task runner
run: pip install poethepoet
- name: Lint with pylint
run: |
# Search for actual errors
poe lint
# For warnings instead return always zero
poe lint-warnings
- name: Test with pytest
run: |
poe bench
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: bench
name: codecov-umbrella
fail_ci_if_error: true
27 changes: 27 additions & 0 deletions benchmarks/bench_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
import pathlib

import eko
import numpy as np
import pineappl
import pytest

import pineko.check


def benchmark_check_grid_and_eko_compatible(test_files):
grid = pineappl.grid.Grid.read(
test_files / "data/grids/208/HERA_CC_318GEV_EM_SIGMARED.pineappl.lz4"
)
wrong_grid = pineappl.grid.Grid.read(
test_files / "data/grids/208/NUTEV_CC_NU_FE_SIGMARED.pineappl.lz4"
)
ekoop = eko.output.Output.load_tar(
test_files / "data/ekos/208/HERA_CC_318GEV_EM_SIGMARED.tar"
)
with pytest.raises(ValueError):
pineko.check.check_grid_and_eko_compatible(wrong_grid, ekoop, 1.0)
pineko.check.check_grid_and_eko_compatible(grid, ekoop, 1.0)
ekoop.xgrid_reshape(targetgrid=[0.0001, 0.001, 0.1, 0.5, 1.0])
with pytest.raises(ValueError):
pineko.check.check_grid_and_eko_compatible(grid, ekoop, 1.0)
84 changes: 84 additions & 0 deletions benchmarks/bench_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
import pathlib

import pytest
from click.testing import CliRunner

from pineko.cli._base import command


def benchmark_check_cli(test_files):
grid_path = pathlib.Path(
test_files / "data/grids/208/LHCB_DY_13TEV_DIMUON.pineappl.lz4"
)
wrong_grid_path = pathlib.Path(
test_files / "data/grids/208/HERA_CC_318GEV_EM_SIGMARED.pineappl.lz4"
)
eko_path = pathlib.Path(test_files / "data/ekos/208/LHCB_DY_13TEV_DIMUON.tar")
runner = CliRunner()
result = runner.invoke(
command, ["check", "compatibility", str(grid_path), str(eko_path)]
)
assert "Success: grids are compatible" in result.output
wrong_result = runner.invoke(
command, ["check", "compatibility", str(wrong_grid_path), str(eko_path)]
)
assert (
"Error: Q2 grid in pineappl grid and eko operator are NOT compatible!"
in wrong_result.output
)
wrong_scvar_res = runner.invoke(
command, ["check", "scvar", str(grid_path), "wrong_string", "2", "0"]
)
assert "Invalid value for 'SCALE'" in wrong_scvar_res.output
ren_res = runner.invoke(
command, ["check", "scvar", str(grid_path), "ren", "2", "0"]
)
assert (
"Success: grids contain renormalization scale variations for as"
in ren_res.output
)
assert (
"Success: grids contain renormalization scale variations for al"
in ren_res.output
)
fact_res = runner.invoke(
command, ["check", "scvar", str(grid_path), "fact", "2", "0"]
)
assert (
"Success: grids contain factorization scale variations for as"
in fact_res.output
)
assert (
"Success: grids contain factorization scale variations for al"
in fact_res.output
)


def benchmark_opcard_cli(tmp_path, test_files):
grid_path = pathlib.Path(
test_files / "data/grids/208/LHCB_DY_13TEV_DIMUON.pineappl.lz4"
)
default_card_path = pathlib.Path(test_files / "data/operator_cards/_template.yaml")
target_path = pathlib.Path(tmp_path / "test_ope_card.yaml")
runner = CliRunner()
result = runner.invoke(
command, ["opcard", str(grid_path), str(default_card_path), str(target_path)]
)
assert "Success" in result.output


def benchmark_compare_cli(lhapdf_path, test_files, test_pdf):
grid_path = pathlib.Path(
test_files / "data/grids/208/LHCB_DY_13TEV_DIMUON.pineappl.lz4"
)
fk_path = pathlib.Path(
test_files / "data/fktables/208/LHCB_DY_13TEV_DIMUON.pineappl.lz4"
)
runner = CliRunner()
with lhapdf_path(test_pdf):
result = runner.invoke(
command,
["compare", str(grid_path), str(fk_path), "2", "0", "NNPDF40_nlo_as_01180"],
)
assert "yll left" in result.output
19 changes: 19 additions & 0 deletions benchmarks/bench_comparator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import pathlib

import pineappl

import pineko


def benchmark_compare(lhapdf_path, test_files, test_pdf):
pine_path = test_files / "data/grids/208/LHCB_DY_13TEV_DIMUON.pineappl.lz4"
grid = pineappl.grid.Grid.read(pine_path)
fk_path = test_files / "data/fktables/208/LHCB_DY_13TEV_DIMUON.pineappl.lz4"
fk = pineappl.fk_table.FkTable.read(fk_path)
pdf = "NNPDF40_nlo_as_01180"
with lhapdf_path(test_pdf):
comp_table = pineko.comparator.compare(grid, fk, 2, 0, pdf, 1.0, 1.0)
errors = comp_table["permille_error"].values
assertions = [er < 5.0 for er in errors]
assert False not in assertions
19 changes: 19 additions & 0 deletions benchmarks/bench_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

import pathlib

import pytest

import pineko


def benchmark_detect(test_files):
with pytest.raises(FileNotFoundError):
pineko.configs.detect()
conf_file = pineko.configs.detect(test_files)


def benchmark_load(test_files):
conf_file = pineko.configs.load(test_files)
assert conf_file["paths"]["root"] == test_files
assert conf_file["paths"]["grids"] == "data/grids/"
48 changes: 48 additions & 0 deletions benchmarks/bench_evolve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
import pathlib

import eko
import pineappl
import pytest

import pineko


def benchmark_write_operator_card_from_file(tmp_path, test_files):
pine_path = test_files / "data/grids/208/HERA_CC_318GEV_EM_SIGMARED.pineappl.lz4"
default_path = test_files / "data/operator_cards/_template.yaml"
target_path = pathlib.Path(tmp_path / "test_operator.yaml")
x_grid, q2_grid = pineko.evolve.write_operator_card_from_file(
pine_path, default_path, target_path, 1.0
)
wrong_pine_path = test_files / "data/grids/208/HERA_CC_318GEV_EM_wrong.pineappl.lz4"
with pytest.raises(FileNotFoundError):
x_grid, q2_grid = pineko.evolve.write_operator_card_from_file(
wrong_pine_path, default_path, target_path, 1.0
)


def benchmark_evolve_grid(tmp_path, lhapdf_path, test_files, test_pdf):
pine_path = test_files / "data/grids/208/HERA_CC_318GEV_EM_SIGMARED.pineappl.lz4"
pinegrid = pineappl.grid.Grid.read(pine_path)
eko_path = test_files / "data/ekos/208/HERA_CC_318GEV_EM_SIGMARED.tar"
eko_op = eko.output.Output.load_tar(eko_path)
target_path = pathlib.Path(tmp_path / "test_fktable.pineappl.lz4")
max_as = 1
max_al = 0
base_configs = pineko.configs.load(test_files)
pineko.configs.configs = pineko.configs.defaults(base_configs)
tcard = pineko.theory_card.load(208)
assumptions = pineko.theory_card.construct_assumptions(tcard)
with lhapdf_path(test_pdf):
pineko.evolve.evolve_grid(
pinegrid,
eko_op,
target_path,
max_as,
max_al,
1.0,
1.0,
assumptions=assumptions,
comparison_pdf="NNPDF40_nlo_as_01180",
)
Loading