Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dd2cb06
Introduction of template.py to contain constants and xgrid
evagroenendijk May 23, 2025
51eb28b
Introduction of template.py to contain constants and xgrid
evagroenendijk May 23, 2025
756be45
Removal of need of _template.yaml
evagroenendijk Jun 19, 2025
ed25c7d
Remove test that checks q0 from theory card & _template.py
evagroenendijk Jun 19, 2025
b0350dc
Remove unnecessary stuff from template.py
evagroenendijk Jun 19, 2025
44d784a
Resolve conflicts with master
evagroenendijk Jun 20, 2025
22d9ac2
Forgot to add template.py
evagroenendijk Jun 20, 2025
5f7394b
Remove eko version from template.py
evagroenendijk Apr 14, 2026
7c973d2
changes needed for merge with main
evagroenendijk Apr 23, 2026
f560b91
change ev_op_iterations
evagroenendijk Apr 23, 2026
5b931b6
Adjusted function in cli and changed last thing in evolve.py
evagroenendijk Apr 23, 2026
a2973ab
Merge branch 'remove_template' of github.com:NNPDF/pineko into remove…
evagroenendijk Apr 23, 2026
53b193b
Change ValueError of evolution method
evagroenendijk Apr 23, 2026
d8332f9
Adjust evolve benchmark
evagroenendijk Apr 27, 2026
4c9ee46
Change ValueError into warning
evagroenendijk May 5, 2026
7b06030
Change error into warning and remove unnecessary import
evagroenendijk May 5, 2026
b714df0
Add missing keys to template
evagroenendijk May 18, 2026
8e23b88
fix formatting of scripts and change debug settings to false
evagroenendijk May 18, 2026
3664fa2
Last changes to pass last test, had forgotten some keys in template.py
evagroenendijk May 19, 2026
89304e2
new regression data
evagroenendijk May 19, 2026
4e0fde0
Removed _template from & added extra keys to CLI & evolution method f…
evagroenendijk May 21, 2026
37242b3
Set inversion method to expanded for truncated and exact for iterate-…
evagroenendijk May 21, 2026
7a3167c
Remove time_like and polarized keys from operator card
evagroenendijk May 21, 2026
b7ba5e1
Add early exit if ModEv or IterEv are not set in theory card
evagroenendijk May 25, 2026
9240191
Remove NEEDED_FILES
evagroenendijk May 25, 2026
ad4ceda
Fix mistake in scaffold.py
evagroenendijk May 25, 2026
979e5b6
Merge branch 'main' into remove_template
evagroenendijk May 25, 2026
4dd2298
Changes from pre-commit
evagroenendijk May 25, 2026
9fc1570
Apply suggestion from @felixhekhorn
felixhekhorn May 26, 2026
5fc8b6b
Add cli options to fonll commands
evagroenendijk May 27, 2026
d45f340
Merge branch 'remove_template' of github.com:NNPDF/pineko into remove…
evagroenendijk May 27, 2026
515c806
Remove ipd and iil from fonll ekos command
evagroenendijk May 28, 2026
dd06d83
Remove some unnecessary keys
evagroenendijk May 29, 2026
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: 0 additions & 4 deletions benchmarks/bench_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ def benchmark_opcard_cli(tmp_path, test_files):
grid_path = pathlib.Path(
test_files / "data/grids/400/HERA_NC_225GEV_EP_SIGMARED.pineappl.lz4"
)
default_card_path = pathlib.Path(
test_files / "data/operator_cards/400/_template.yaml"
)
thcard_path = pathlib.Path(test_files / "data" / "theory_cards" / "400.yaml")
target_path = pathlib.Path(tmp_path / "test_ope_card.yaml")
runner = CliRunner()
Expand All @@ -61,7 +58,6 @@ def benchmark_opcard_cli(tmp_path, test_files):
[
"opcard",
str(grid_path),
str(default_card_path),
str(thcard_path),
str(target_path),
],
Expand Down
13 changes: 4 additions & 9 deletions benchmarks/bench_evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def benchmark_write_operator_card_from_file_num_fonll(
/ "400"
/ "HERA_NC_225GEV_EP_SIGMARED.pineappl.lz4"
)
default_path = test_files / "data" / "operator_cards" / "400" / "_template.yaml"
num_opcard = 7 if is_mixed else 5
targets_path_list = [
tmp_path / f"test_opcard_{num}.yaml" for num in range(num_opcard)
Expand All @@ -34,7 +33,7 @@ def benchmark_write_operator_card_from_file_num_fonll(
with open(tcard_path, encoding="utf-8") as f:
tcard = yaml.safe_load(f)
_x_grid, _q2_grid = pineko.evolve.write_operator_card_from_file(
pine_path, default_path, target_path, tcard
pine_path, target_path, tcard
)
# Check if the opcards are ok
for opcard_path, cfg in zip(
Expand All @@ -49,11 +48,10 @@ def benchmark_write_operator_card_from_file_num_fonll(

def benchmark_write_operator_card_from_file(tmp_path, test_files, test_configs):
pine_path = test_files / "data/grids/400/HERA_NC_225GEV_EP_SIGMARED.pineappl.lz4"
default_path = test_files / "data/operator_cards/400/_template.yaml"
target_path = pathlib.Path(tmp_path / "test_operator.yaml")
tcard = pineko.theory_card.load(400)
x_grid, _q2_grid = pineko.evolve.write_operator_card_from_file(
pine_path, default_path, target_path, tcard
pine_path, target_path, tcard
)

# Load the operator card
Expand All @@ -64,22 +62,19 @@ def benchmark_write_operator_card_from_file(tmp_path, test_files, test_configs):
wrong_pine_path = test_files / "data/grids/208/HERA_CC_318GEV_EM_wrong.pineappl.lz4"
with pytest.raises(FileNotFoundError):
_ = pineko.evolve.write_operator_card_from_file(
wrong_pine_path, default_path, target_path, 1.0
wrong_pine_path, target_path, 1.0
)


def benchmark_dglap(tmp_path, test_files, test_configs):
pine_path = test_files / "data/grids/400/HERA_NC_225GEV_EP_SIGMARED.pineappl.lz4"
default_path = test_files / "data/operator_cards/400/_template.yaml"
target_path = pathlib.Path(tmp_path / "test_operator.yaml")

theory_id = 400
tcard = pineko.theory_card.load(theory_id)
# In order to check if the operator card is enough for eko, let's compute the eko

pineko.evolve.write_operator_card_from_file(
pine_path, default_path, target_path, tcard
)
pineko.evolve.write_operator_card_from_file(pine_path, target_path, tcard)

# Load the opcard
myopcard = yaml.safe_load(target_path.read_text(encoding="utf-8"))
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bench_theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def benchmark_eko(test_files, test_configs):
)
theory_obj_hera.opcard(grid_name, pathlib.Path(test_files / grid_path), tcard)

theory_obj_hera.eko(grid_name, grid_path, tcard)
theory_obj_hera.eko(grid_name, grid_path, tcard, int_cores=1)

log_path = pathlib.Path(test_files / "logs/eko/400-HERA_NC_225GEV_EP_SIGMARED.log")
if os.path.exists(log_path):
Expand Down
Binary file modified benchmarks/regression_data/LHCBWZMU8TEV.npy
Binary file not shown.
1 change: 0 additions & 1 deletion pineko.ci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ nnpdf=true
[paths]
# inputs
grids = "./theory_productions/data/grids"
operator_card_template_name = "_template.ci.yaml"
# outputs
operator_cards = "./theory_productions/operator_cards"
ekos = "./theory_productions/data/ekos"
Expand Down
1 change: 0 additions & 1 deletion pineko.debug.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
ymldb = "data/ymldb"
grids = "data/grids"
theory_cards = "data/theory_cards"
operator_card_template_name = "_template.yaml"
# outputs
operator_cards = "data/operator_cards"
ekos = "data/ekos"
Expand Down
9 changes: 6 additions & 3 deletions src/pineko/cli/fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def tcards(theoryid):
@click.argument("theoryID", type=click.INT)
@click.argument("datasets", type=click.STRING, nargs=-1)
@click.option("--overwrite", is_flag=True, help="Allow files to be overwritten")
def ekos(theoryid, datasets, overwrite):
@click.option(
"--int-cores", default=1, show_default=True, help="number of integration cores"
)
def ekos(theoryid, datasets, overwrite, int_cores, ipd=4, iil=True):
"""Command to generate numerical FONLL ekos.

1. Create all the operator cards for the different flavor patches.
Expand All @@ -87,7 +90,7 @@ def ekos(theoryid, datasets, overwrite):
for nf_id in range(7):
theory.TheoryBuilder(
f"{theoryid}0{nf_id}", datasets, overwrite=overwrite
).opcards()
).opcards(ipd=ipd, iil=iil)

# Most of the time only these 3 patches are necessary
for nf_id in ["00", "04", "05"]:
Expand All @@ -98,7 +101,7 @@ def ekos(theoryid, datasets, overwrite):
silent=False,
clear_logs=True,
overwrite=overwrite,
).ekos()
).ekos(int_cores=int_cores)

# Now _attempt_ to inherit the ekos
# _if_ a discrepancy is found between the eko and the grid, recompute
Expand Down
22 changes: 15 additions & 7 deletions src/pineko/cli/opcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pathlib

import rich
import rich_click as click
import yaml

Expand All @@ -11,16 +12,23 @@

@command.command("opcard")
@click.argument("pineappl-path", metavar="PINEAPPL", type=click.Path(exists=True))
@click.argument(
"default-card-path", metavar="DEFAULT_CARD", type=click.Path(exists=True)
)
@click.argument("thcard-path", metavar="THCARD", type=click.Path())
@click.argument("opcard-path", metavar="OPCARD", type=click.Path())
def subcommand(pineappl_path, default_card_path, thcard_path, opcard_path):
@click.option(
"--ipd", default=4, show_default=True, help="interpolation polynomial degree"
)
@click.option("--iil", default=True, show_default=True, help="interpolation is log")
def subcommand(
pineappl_path,
thcard_path,
opcard_path,
ipd,
iil,
):
"""Write EKO card for PineAPPL grid.

Writes a copy of the default card from DEFAULT_CARD to OPCARD
with the adjusted x grid and Q2 grid read from PINEAPPL.
Writes an operator card OPCARD from the information in
opcard_template.py and the theory card.

A THCARD is required, since some of the EKO's OPCARD information come from
the NNPDF theory entries (e.g. :math:`Q0`).
Expand All @@ -29,5 +37,5 @@ def subcommand(pineappl_path, default_card_path, thcard_path, opcard_path):
tcard = yaml.safe_load(pathlib.Path(thcard_path).read_text(encoding="utf-8"))
opcard_path = pathlib.Path(opcard_path)
_x_grid, q2_grid = evolve.write_operator_card_from_file(
pineappl_path, default_card_path, opcard_path, tcard
pineappl_path, opcard_path, tcard, ipd, iil
)
17 changes: 13 additions & 4 deletions src/pineko/cli/theory_.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ def inherit_grids(source_theory_id, target_theory_id, datasets, overwrite):
@click.argument("theory_id", type=click.INT)
@click.argument("datasets", type=click.STRING, nargs=-1)
@click.option("--overwrite", is_flag=True, help="Allow files to be overwritten")
def opcards(theory_id, datasets, overwrite):
@click.option(
"--ipd", default=4, show_default=True, help="interpolation polynomial degree"
)
@click.option("--iil", default=True, show_default=True, help="interpolation is log")
def opcards(theory_id, datasets, overwrite, ipd, iil):
"""Write EKO card for all FK tables in all datasets."""
theory.TheoryBuilder(theory_id, datasets, overwrite=overwrite).opcards()
theory.TheoryBuilder(theory_id, datasets, overwrite=overwrite).opcards(
ipd=ipd, iil=iil
)


@theory_.command()
Expand All @@ -45,11 +51,14 @@ def opcards(theory_id, datasets, overwrite):
help="Erease previos logs (instead of appending)",
)
@click.option("--overwrite", is_flag=True, help="Allow files to be overwritten")
def ekos(theory_id, datasets, silent, clear_logs, overwrite):
@click.option(
"--int-cores", default=1, show_default=True, help="number of integration cores"
)
def ekos(theory_id, datasets, silent, clear_logs, overwrite, int_cores):
"""Compute EKOs for all FK tables in all datasets."""
theory.TheoryBuilder(
theory_id, datasets, silent=silent, clear_logs=clear_logs, overwrite=overwrite
).ekos()
).ekos(int_cores=int_cores)


@theory_.command()
Expand Down
4 changes: 0 additions & 4 deletions src/pineko/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
NEEDED_KEYS = [
"operator_cards",
"grids",
"operator_card_template_name",
THEORY_PATH_KEY,
"fktables",
"ekos",
]

NEEDED_FILES = ["operator_card_template_name"]
GENERIC_OPTIONS = "general"


Expand Down Expand Up @@ -87,8 +85,6 @@ def enhance_paths(configs_):
for key in required_keys:
if key not in configs_["paths"]:
raise ValueError(f"Configuration is missing a 'paths.{key}' key")
if key in NEEDED_FILES:
continue
if pathlib.Path(configs_["paths"][key]).anchor == "":
configs_["paths"][key] = configs_["paths"]["root"] / configs_["paths"][key]
else:
Expand Down
Loading
Loading