Skip to content

Upgrade to PineAPPL v1 #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9a9cffc
Start modifying `pineko`
Radonirinaunimi Nov 12, 2024
4fd72e0
Converges into a first implementation
Radonirinaunimi Nov 20, 2024
31aa840
Fix `poe lint` errors related to `PineAPPL` imports
Radonirinaunimi Nov 20, 2024
5bc2bde
Fix `tests::test_check.py`
Radonirinaunimi Nov 20, 2024
c543771
Fix all the Python tests
Radonirinaunimi Nov 20, 2024
84bc0df
Fix typing and CI
Radonirinaunimi Nov 21, 2024
ad782ed
Fix `benchmarks/bench_autosv.py` benchmarks
Radonirinaunimi Nov 21, 2024
8f1a2f7
Fix `benchmarks/bench_kfactor.py` benchmarks
Radonirinaunimi Nov 22, 2024
87346cb
Fix `benchmarks/bench_comparator.py` benchmarks
Radonirinaunimi Nov 22, 2024
671af03
Start fixing `benchmarks/bench_theory.py` (not fully working)
Radonirinaunimi Nov 22, 2024
ffb2020
Fix benchmarks: `benchmarks/bench_theory.py`
Radonirinaunimi Nov 25, 2024
a1ae3b4
Fix `benchmarks:bench_evolve`
Radonirinaunimi Nov 25, 2024
370665b
Fix all the benchmarks
Radonirinaunimi Nov 26, 2024
784a239
Final fixes to `tests` and cosmetic changes
Radonirinaunimi Nov 26, 2024
c28303b
Fix bug in loops over the EKOs
Radonirinaunimi Jan 28, 2025
69fe7ff
Fix scale variation benchmarks
Radonirinaunimi Feb 13, 2025
b476a4d
Fix the benchmark of the evolutions
Radonirinaunimi Feb 13, 2025
cf6fb77
Fix the benchmarks of the k-factors
Radonirinaunimi Feb 13, 2025
ae2e844
Mino fixes
Radonirinaunimi Feb 13, 2025
8fb041c
Fix bin remapping
Radonirinaunimi Feb 15, 2025
cb19e1a
Remove Rust toolchain in the CI
Radonirinaunimi Feb 17, 2025
c94a9d1
Apply suggestions from code review
Radonirinaunimi Feb 26, 2025
50eb5ea
Replace remaining instances of `{set_}key_value{s}`
Radonirinaunimi Feb 26, 2025
4baa8fc
Fix computations of EKOs in case there are duplicates convtypes
Radonirinaunimi Feb 28, 2025
b6ef164
Remove TODO
Radonirinaunimi Feb 28, 2025
c50d632
Fix FONLL part
Radonirinaunimi Mar 12, 2025
6311da9
Fix pre-commit
Radonirinaunimi Mar 12, 2025
2b52f81
Leave out the POS data for the time being
Radonirinaunimi Mar 14, 2025
d173734
Remove Q2 values from checks
Radonirinaunimi Apr 6, 2025
69268eb
Add back POS data in the full regression test
Radonirinaunimi Apr 8, 2025
2dc4d30
Infer if a grid is DIS from the number of convolutions
Radonirinaunimi Apr 8, 2025
27c5be6
Account for SIA when checking if a grid is a DIS one
Radonirinaunimi Apr 10, 2025
d889b8b
Change position of `--xia` in `pineko compare`
Radonirinaunimi Apr 10, 2025
2989715
Exposes `q2_min` to the CLI
Radonirinaunimi Apr 10, 2025
611be6d
Make sure that only `Q2` is cut when using `--q2_min`
Radonirinaunimi Apr 10, 2025
b1f3158
Final needed modifications
Radonirinaunimi Apr 14, 2025
0000c24
Bump `pineappl` version to `v1.0.0a5`
Radonirinaunimi May 22, 2025
9986052
Bump `pdbpp` version to solve `fancycompleter` incompatibilities
Radonirinaunimi May 22, 2025
b8d0360
Remove unnecessary import
Radonirinaunimi Jun 4, 2025
83fff9b
Ensures that Operator slices are lazyly loaded
Radonirinaunimi Jun 10, 2025
0bf08c5
Finally update to PineAPPL v1 🎉
Radonirinaunimi Jun 11, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
virtualenvs-create: false
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction --no-root --with test
run: poetry install --no-interaction --no-root --with test -E nnpdf
- name: Install project
# it is required to repeat extras, otherwise they will be removed from
# the environment
run: poetry install --no-interaction
run: poetry install --no-interaction -E nnpdf
- name: Install task runner
run: pip install poethepoet
- name: Lint with pylint
Expand Down
38 changes: 21 additions & 17 deletions benchmarks/bench_autosv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,32 @@ def benchmark_compute_ren_sv_grid(test_files, tmp_path, test_pdf, lhapdf_path):
plusrensv_grid_path = tmp_path / name_grid
with lhapdf_path(test_pdf):
pdf = lhapdf.mkPDF(pdf_name)

to_test_grid = pineappl.grid.Grid.read(to_test_grid_path)
plusrensv_grid = pineappl.grid.Grid.read(plusrensv_grid_path)
sv_list = [(0.5, 1.0), (2.0, 1.0)] # Only ren sv have to be tested
sv_list = [(0.5, 1.0, 1.0), (2.0, 1.0, 1.0)] # Only μR have to be tested
bin_number = to_test_grid.bins()
to_test_res = to_test_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
np.array([], dtype=bool),
np.array([], dtype=np.uint64),
np.array([], dtype=bool),
sv_list,

to_test_res = to_test_grid.convolve(
pdg_convs=to_test_grid.convolutions,
xfxs=[pdf.xfxQ2],
alphas=pdf.alphasQ2,
order_mask=np.array([], dtype=bool),
bin_indices=np.array([], dtype=np.uint64),
channel_mask=np.array([], dtype=bool),
xi=sv_list,
).reshape(bin_number, len(sv_list))
plusrensv_res = plusrensv_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
np.array([], dtype=bool),
np.array([], dtype=np.uint64),
np.array([], dtype=bool),
sv_list,

plusrensv_res = plusrensv_grid.convolve(
pdg_convs=plusrensv_grid.convolutions,
xfxs=[pdf.xfxQ2],
alphas=pdf.alphasQ2,
order_mask=np.array([], dtype=bool),
bin_indices=np.array([], dtype=np.uint64),
channel_mask=np.array([], dtype=bool),
xi=sv_list,
).reshape(bin_number, len(sv_list))

rtol = 1.0e-14
for sv in sv_list:
for n_res, old_res in zip(
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/bench_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def benchmark_compare_cli(lhapdf_path, test_files, test_pdf):
command,
["compare", str(fk_path), str(grid_path), "2", "0", "NNPDF40_nlo_as_01180"],
)
assert "yll left" in result.output
assert "left" in result.output
assert "right" in result.output


def benchmark_convolve_cli(test_files, tmp_path):
Expand Down
9 changes: 5 additions & 4 deletions benchmarks/bench_comparator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import pineappl

import pineko
Expand All @@ -8,9 +9,9 @@ def benchmark_compare(lhapdf_path, test_files, test_pdf):
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"
pdfs = ["NNPDF40_nlo_as_01180"]
xi = (1.0, 1.0, 1.0)
with lhapdf_path(test_pdf):
comp_table = pineko.comparator.compare(grid, fk, 2, 0, pdf, 1.0, 1.0)
comp_table = pineko.comparator.compare(grid, fk, 2, 0, pdfs, xi)
errors = comp_table["permille_error"].values
assertions = [er < 5.0 for er in errors]
assert False not in assertions
assert np.all(errors < 5.0)
19 changes: 10 additions & 9 deletions benchmarks/bench_evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,20 @@ def benchmark_evolve_grid(tmp_path, lhapdf_path, test_files, test_pdf):
with eko.EKO.edit(eko_path) as eko_op:
with lhapdf_path(test_pdf):
pineko.evolve.evolve_grid(
pinegrid,
eko_op,
target_path,
max_as,
max_al,
1.0,
1.0,
grid=pinegrid,
operators=[eko_op],
fktable_path=target_path,
max_as=max_as,
max_al=max_al,
xir=1.0,
xif=1.0,
xia=1.0,
assumptions=assumptions,
comparison_pdf1="NNPDF40_nnlo_as_01180",
comparison_pdfs=["NNPDF40_nnlo_as_01180"],
)
# check metadata is there - fixes https://github.com/NNPDF/pineko/issues/70
fk = pineappl.fk_table.FkTable.read(target_path)
kvs = fk.key_values()
kvs = fk.metadata
assert "results_fk" in kvs
assert "eko_theory_card" in kvs
assert json.dumps(eko_op.theory_card.raw) == kvs["eko_theory_card"]
42 changes: 21 additions & 21 deletions benchmarks/bench_kfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,31 @@ def benchmark_kfactor_inclusion(test_files, tmp_path, test_pdf, lhapdf_path):
with lhapdf_path(test_pdf):
pdf = lhapdf.mkPDF(pdf_name)
pluskfactor_grid = pineappl.grid.Grid.read(pluskfactor_grid_path)
sv_list = [(1.0, 1.0)] # Only ren sv have to be tested
sv_list = [(1.0, 1.0, 1.0)] # Only ren sv have to be tested
bin_number = pluskfactor_grid.bins()
order_mask_nloQCD = pineappl.grid.Order.create_mask(
pluskfactor_grid.orders(), 2, 0, True
order_mask_nloQCD = pineappl.boc.Order.create_mask(
orders=pluskfactor_grid.orders(), max_as=2, max_al=0, logs=True
)
order_mask_nnloQCD = pineappl.grid.Order.create_mask(
pluskfactor_grid.orders(), 3, 0, True
order_mask_nnloQCD = pineappl.boc.Order.create_mask(
orders=pluskfactor_grid.orders(), max_as=3, max_al=0, logs=True
)
to_test_res_nlo = pluskfactor_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
order_mask_nloQCD,
np.array([], dtype=np.uint64),
np.array([], dtype=bool),
sv_list,
to_test_res_nlo = pluskfactor_grid.convolve(
pdg_convs=pluskfactor_grid.convolutions,
xfxs=[pdf.xfxQ2],
alphas=pdf.alphasQ2,
order_mask=order_mask_nloQCD,
bin_indices=np.array([], dtype=np.uint64),
channel_mask=np.array([], dtype=bool),
xi=sv_list,
).reshape(bin_number, len(sv_list))
to_test_res_nnlo = pluskfactor_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
order_mask_nnloQCD,
np.array([], dtype=np.uint64),
np.array([], dtype=bool),
sv_list,
to_test_res_nnlo = pluskfactor_grid.convolve(
pdg_convs=pluskfactor_grid.convolutions,
xfxs=[pdf.xfxQ2],
alphas=pdf.alphasQ2,
order_mask=order_mask_nnloQCD,
bin_indices=np.array([], dtype=np.uint64),
channel_mask=np.array([], dtype=bool),
xi=sv_list,
).reshape(bin_number, len(sv_list))
centrals_kfactor, _ = kfactor.read_from_file(
test_files / "data" / "kfactors" / "CF_QCD_ATLAS_TTB_8TEV_LJ_TRAP.dat"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bench_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def benchmark_regression(tmp_path, dataset):
fkt = FkTable.read(
tmp_path / "data" / "fktables" / str(THEORYID) / f"{grid_name}.pineappl.lz4"
)
result.append(fkt.convolve_with_one(2212, pdf.xfxQ2))
result.append(fkt.convolve(pdg_convs=fkt.convolutions, xfxs=[pdf.xfxQ2]))
result = np.concatenate(result)

if not regression_path.exists():
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/bench_theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def benchmark_fk(test_files, test_configs):
)
theory_obj_hera.opcard(grid_name, pathlib.Path(test_files / grid_path), tcard)

theory_obj_hera.fk(grid_name, grid_path, tcard, pdf1=None, pdf2=None)
theory_obj_hera.fk(grid_name, grid_path, tcard, pdfs=None)
# test overwrite function
theory_obj_hera.fk(grid_name, grid_path, tcard, pdf1=None, pdf2=None)
theory_obj_hera.fk(grid_name, grid_path, tcard, pdfs=None)
log_path = pathlib.Path(test_files / "logs/fk/400-HERA_NC_225GEV_EP_SIGMARED.log")
if os.path.exists(log_path):
os.remove(log_path)
Expand Down
Loading