Skip to content
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

Allow evolution and convolution with different ekos for a single grid #181

Merged
merged 69 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e91b2cd
init adjust write opcard
giacomomagni Jun 3, 2024
57dff37
allow convolution with 2 ekos
giacomomagni Jun 3, 2024
6091b7e
small cleaning
giacomomagni Jun 3, 2024
443794e
small refactor
giacomomagni Jun 3, 2024
a759bfc
fix call to pineappl_layout
giacomomagni Jun 3, 2024
0d3076e
Update src/pineko/evolve.py
giacomomagni Jun 3, 2024
3c107ee
some improvements
giacomomagni Jun 3, 2024
31f9886
some improvements 2
giacomomagni Jun 3, 2024
6de0497
Update src/pineko/evolve.py
giacomomagni Jun 3, 2024
f6a1c0f
use develop branch of pineappl
Radonirinaunimi Jun 3, 2024
ba90fea
make opcard working
giacomomagni Jun 4, 2024
95a157c
make ekos working
giacomomagni Jun 4, 2024
ea405fd
Update src/pineko/evolve.py
giacomomagni Jun 4, 2024
34ee7d5
make fks working
Jun 4, 2024
f2dbc46
start fixing some of the benchmarks
Radonirinaunimi Jun 4, 2024
929726d
make tests passing
giacomomagni Jun 4, 2024
ea263a4
remove duplicated print statement
giacomomagni Jun 4, 2024
81bcfd0
revert changes to Channel
giacomomagni Jun 4, 2024
4274fa6
give a try on setting up rustup & cargo in CI
Radonirinaunimi Jun 4, 2024
f435cac
correct syntax
giacomomagni Jun 5, 2024
65468a8
Merge branch 'allow_different_ekos' of https://github.com/N3PDF/pinek…
giacomomagni Jun 5, 2024
b413bd6
fix test
giacomomagni Jun 5, 2024
840eb9e
restore DIS polarized compatibility
giacomomagni Jun 6, 2024
49295cd
make FakePine less fake
giacomomagni Jun 6, 2024
d39c497
Merge branch 'main' into allow_different_ekos
giacomomagni Jun 18, 2024
c503f6f
update poetry lock
giacomomagni Jun 19, 2024
453bc45
fix inherit ekos
giacomomagni Jul 8, 2024
adf5bb8
more on ekos names
giacomomagni Jul 8, 2024
c847c48
fix path type
giacomomagni Jul 8, 2024
13a5e80
Merge branch 'main' into allow_different_ekos
giacomomagni Jul 9, 2024
cc08301
update evolve method
giacomomagni Jul 16, 2024
9137643
covolute -> convolve
giacomomagni Jul 16, 2024
d62dac4
update ekocompatibility layout
giacomomagni Jul 16, 2024
b1c8c78
remove ekocomaptibility
giacomomagni Jul 17, 2024
ca58d1a
init fix on benchmarks
giacomomagni Jul 19, 2024
ed8fed9
remove temporary fix
giacomomagni Jul 19, 2024
4d44dbf
Fix comparison print
felixhekhorn Jul 22, 2024
6812bdd
PyPidBasis from Pdg to Evol
giacomomagni Jul 23, 2024
c1fe183
update compare and convolve to accept multiple pdfs
giacomomagni Jul 23, 2024
915daf4
init fixes of compare
giacomomagni Jul 23, 2024
c2cc150
make benchmarks passing
giacomomagni Jul 23, 2024
a06d9ed
poetry lock
giacomomagni Jul 23, 2024
96ec886
fix in nfoll
giacomomagni Jul 23, 2024
807fc02
make notation mor uniform
giacomomagni Jul 24, 2024
bbfc210
small fix bench
giacomomagni Jul 24, 2024
2553fe1
first round of comments
giacomomagni Jul 24, 2024
b715f03
cast parton to int
giacomomagni Jul 24, 2024
8da63b1
fix syntax
giacomomagni Jul 24, 2024
58d6b38
fix syntax
giacomomagni Jul 24, 2024
04a56f7
add some usefule logs
giacomomagni Jul 24, 2024
da1aa53
add a check on convolution types
giacomomagni Jul 24, 2024
31235b2
typo
giacomomagni Jul 24, 2024
67a45a2
propagate metadata in scale variations
giacomomagni Jul 24, 2024
618f46b
improve check
giacomomagni Jul 24, 2024
4bc0401
Update src/pineko/theory.py
giacomomagni Jul 30, 2024
4859448
Update src/pineko/theory.py
giacomomagni Jul 30, 2024
ddf92ef
pre-commit
giacomomagni Jul 30, 2024
f3d8187
fix pre-commit error due to identation
Radonirinaunimi Jul 30, 2024
e066d88
apply review suggetsion
giacomomagni Aug 14, 2024
725db3d
apply review suggetsion
giacomomagni Aug 14, 2024
ecb021e
fix bug, finally
giacomomagni Aug 15, 2024
a279d70
Update src/pineko/cli/compare.py
giacomomagni Aug 16, 2024
fde3e65
Update src/pineko/evolve.py
giacomomagni Aug 16, 2024
d80c9fe
address review comments
giacomomagni Aug 16, 2024
fd588b6
Update src/pineko/evolve.py
giacomomagni Aug 16, 2024
d68f2be
restore nargs=-1 and add a check
giacomomagni Aug 16, 2024
4aac0f8
restore nargs=-1 and add a check
giacomomagni Aug 16, 2024
495ad80
simplify prepare
giacomomagni Aug 16, 2024
8642572
clarify error message
giacomomagni Aug 16, 2024
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 benchmarks/bench_autosv.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def benchmark_compute_ren_sv_grid(test_files, tmp_path, test_pdf, lhapdf_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
bin_number = to_test_grid.bins()
to_test_res = to_test_grid.convolute_with_one(
to_test_res = to_test_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
Expand All @@ -49,7 +49,7 @@ def benchmark_compute_ren_sv_grid(test_files, tmp_path, test_pdf, lhapdf_path):
np.array([], dtype=bool),
sv_list,
).reshape(bin_number, len(sv_list))
plusrensv_res = plusrensv_grid.convolute_with_one(
plusrensv_res = plusrensv_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/bench_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def benchmark_compare_cli(lhapdf_path, test_files, test_pdf):
with lhapdf_path(test_pdf):
result = runner.invoke(
command,
["compare", str(grid_path), str(fk_path), "2", "0", "NNPDF40_nlo_as_01180"],
["compare", str(fk_path), str(grid_path), "2", "0", "NNPDF40_nlo_as_01180"],
)
assert "yll left" in result.output


def benchmark_convolute_cli(test_files, tmp_path):
def benchmark_convolve_cli(test_files, tmp_path):
grid_path = pathlib.Path(
test_files / "data/grids/400/HERA_NC_225GEV_EP_SIGMARED.pineappl.lz4"
)
Expand All @@ -95,7 +95,7 @@ def benchmark_convolute_cli(test_files, tmp_path):
runner = CliRunner()
result = runner.invoke(
command,
["convolute", str(grid_path), str(eko_path), str(fk_path), "2", "0"],
["convolve", str(fk_path), str(grid_path), "2", "0", str(eko_path)],
)
assert "Optimizing for Nf6Ind" in result.output

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bench_evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def benchmark_evolve_grid(tmp_path, lhapdf_path, test_files, test_pdf):
1.0,
1.0,
assumptions=assumptions,
comparison_pdf="NNPDF40_nnlo_as_01180",
comparison_pdf1="NNPDF40_nnlo_as_01180",
)
# check metadata is there - fixes https://github.com/NNPDF/pineko/issues/70
fk = pineappl.fk_table.FkTable.read(target_path)
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/bench_kfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def benchmark_kfactor_inclusion(test_files, tmp_path, test_pdf, lhapdf_path):
order_mask_nnloQCD = pineappl.grid.Order.create_mask(
pluskfactor_grid.orders(), 3, 0, True
)
to_test_res_nlo = pluskfactor_grid.convolute_with_one(
to_test_res_nlo = pluskfactor_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
Expand All @@ -37,7 +37,7 @@ def benchmark_kfactor_inclusion(test_files, tmp_path, test_pdf, lhapdf_path):
np.array([], dtype=bool),
sv_list,
).reshape(bin_number, len(sv_list))
to_test_res_nnlo = pluskfactor_grid.convolute_with_one(
to_test_res_nnlo = pluskfactor_grid.convolve_with_one(
2212,
pdf.xfxQ2,
pdf.alphasQ2,
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/bench_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def benchmark_regression(tmp_path, dataset):
fkt = FkTable.read(
tmp_path / "data" / "fktables" / str(THEORYID) / f"{grid_name}.pineappl.lz4"
)
result.append(fkt.convolute_with_one(2212, pdf.xfxQ2))
result.append(fkt.convolve_with_one(2212, pdf.xfxQ2))
result = np.concatenate(result)

if not regression_path.exists():
np.save(regression_path, result)
raise FileNotFoundError("Regression did not exist and has been regenerated")

regression_data = np.load(regression_path)
np.testing.assert_allclose(regression_data, result)
np.testing.assert_allclose(regression_data, result, rtol=4e-6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that we understand why an rtol=4e-6 is needed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know exactly, but I believe this is numerical precision

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean 4e-6 is surely not a problem for us but still it seems a bit high to be numerical precision

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default is 1e-7 so it is not that much bigger - however, why aren't we byte-by-byte the same? we may have changed the program flow, but we didn't touch any of the ingredients and not the underlying math (as far as I'm aware) ...

Copy link
Contributor Author

@giacomomagni giacomomagni Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK only the NaN business changed and only the LHCBWZMU8TEV is not passing without rtol=4e-6

13 changes: 9 additions & 4 deletions benchmarks/bench_theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ def benchmark_inherit_grids(test_files):


def benchmark_inherit_eko(tmp_path):
from_eko = theory_obj.ekos_path()
theory_obj.inherit_eko("TestEko", from_eko, tmp_path)
for grid in theory_obj.grids_path().iterdir():
name = grid.stem.split(".")[0]
# here NUTEV eko is not present
if (theory_obj.ekos_path() / f"{name}.tar").exists():
theory_obj.inherit_eko(name, grid, tmp_path)
assert tmp_path.is_dir()
assert (tmp_path / f"{name}.tar").exists()


def benchmark_inherit_ekos(test_files):
Expand Down Expand Up @@ -166,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, pdf=None)
theory_obj_hera.fk(grid_name, grid_path, tcard, pdf1=None, pdf2=None)
# test overwrite function
theory_obj_hera.fk(grid_name, grid_path, tcard, pdf=None)
theory_obj_hera.fk(grid_name, grid_path, tcard, pdf1=None, pdf2=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
10 changes: 5 additions & 5 deletions docs/source/overview/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ Generating the FK Table
-----------------------

You need to have the |EKO| computed in the previous step.
Then you can convolute the |EKO| with the grids by running::
Then you can convolve the |EKO| with the grids by running::

pineko theory fks THEORY_ID DATASET1 DATASET2 ...

Note that you can also convolute a single grid with a single eko (obtaining a single FK table) by running::
Note that you can also convolve a single grid with a single eko (obtaining a single FK table) by running::

pineko convolute GRID OPCARD FKTABLE MAX_AS MAX_AL
pineko convolve FKTABLE GRID MAX_AS MAX_AL OP_PATH_1 OP_PATH_2

If necessary it is possible to specify the values of the *renormalization* and *factorization* scale variations with
the options ``--xir`` and ``--xif``.
Expand Down Expand Up @@ -89,9 +89,9 @@ Comparing grids and FK tables
"""""""""""""""""""""""""""""

With the command ``pineko compare`` it is possible to compare the predictions as provided by the grid
(convoluted with a |PDF|) with the predictions as provided by the |FK| table. This is done like
(convolved with a |PDF|) with the predictions as provided by the |FK| table. This is done like

pineko compare GRID FKTABLE MAX_AS MAX_AL PDF
pineko compare FKTABLE GRID MAX_AS MAX_AL PDF_1 PDF_2

again eventually specifying the values of *renormalization* and *factorization* scales with the
appropriate options.
Expand Down
Loading
Loading