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

kfactor maintenance and documentation #161

Merged
merged 39 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
614bd43
first understanding
giacomomagni Mar 15, 2024
664a798
init some refactoring
giacomomagni Mar 15, 2024
8305507
make test working
giacomomagni Mar 15, 2024
93131b1
try to make it working again
giacomomagni Mar 15, 2024
4dfd7a8
try to make bench passing
giacomomagni Mar 15, 2024
746bc4d
remove pdb
giacomomagni Mar 15, 2024
4d97c72
restore mask
giacomomagni Mar 15, 2024
fb5b9f8
more work
giacomomagni Mar 15, 2024
16d8279
more fixes
giacomomagni Mar 15, 2024
a4626f2
remove pdb
giacomomagni Mar 15, 2024
c9d4c43
add some docs and fix names
giacomomagni Mar 16, 2024
8dc15f0
some cleaning in scale variations
giacomomagni Mar 16, 2024
3f94e4c
pre-commit
giacomomagni Mar 16, 2024
64e252d
update pineappl version
giacomomagni Mar 16, 2024
770ce81
Fix pre-commit, fix kfactor docs
felixhekhorn Mar 18, 2024
40124ea
Update scale_subgrid
felixhekhorn Mar 18, 2024
3163be4
first round of review
giacomomagni Mar 18, 2024
7d04323
second round of updates
giacomomagni Mar 18, 2024
55e015d
Rework kfactors.to_list
felixhekhorn Mar 19, 2024
82e4657
Drop type hints from kfactors.to_list
felixhekhorn Mar 19, 2024
7ea62d7
Update src/pineko/cli/kfactor.py
giacomomagni Mar 19, 2024
5a31fc0
more fixes from review suggestions
giacomomagni Mar 19, 2024
53f939a
Update docs/source/theory/kfactors.rst
giacomomagni Mar 19, 2024
b62249b
make kfactor names more uniform
giacomomagni Mar 19, 2024
4665cad
do_it -> apply_to_grid
giacomomagni Mar 19, 2024
21572f8
clarification on PTO_TO_UPDATE
giacomomagni Mar 19, 2024
25be7c4
drop target_folder=None
giacomomagni Mar 19, 2024
3d067f0
more typos here and there
giacomomagni Mar 19, 2024
9821965
Merge branch 'main' into issue_160
giacomomagni Mar 26, 2024
0a27fbe
run poetry lock
giacomomagni Mar 26, 2024
4ce5921
restore poetry lock
giacomomagni Mar 26, 2024
c87c39e
Merge branch 'main' into issue_160
giacomomagni Jun 10, 2024
41a4649
make kfactors working again with nnpdf settings
giacomomagni Jun 10, 2024
9fab164
exterminate yamldb
giacomomagni Jun 10, 2024
3aaa411
Merge branch 'main' into issue_160
giacomomagni Jun 18, 2024
a314490
update poetry lock
giacomomagni Jun 19, 2024
02940a3
Merge branch 'main' into issue_160
giacomomagni Aug 21, 2024
011ec6c
fix benchmarks
giacomomagni Aug 21, 2024
d33d2f9
other fix to benchmarks
giacomomagni Aug 21, 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
12 changes: 4 additions & 8 deletions benchmarks/bench_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,15 @@ def benchmark_scaffold_cli(test_empty_proj):
assert "Success: All the folders are correctly configured" in res.output


def benchmark_gen_sv_cli(test_files, tmp_path, test_pdf, lhapdf_path):
def benchmark_gen_sv_cli(test_files, tmp_path):
runner = CliRunner()
pdf_name = "NNPDF40_nlo_as_01180"
max_as = "2"
nf = "5"
name_grid = "ATLAS_TTB_8TEV_LJ_TRAP_norensv_fixed.pineappl.lz4"
grid_path = test_files / "data" / "grids" / "400" / name_grid
new_grid_path = tmp_path / name_grid
target_path = tmp_path
shutil.copy(grid_path, new_grid_path)
with lhapdf_path(test_pdf):
pdf = lhapdf.mkPDF(pdf_name)
res = runner.invoke(
command,
["ren_sv_grid", str(new_grid_path), str(target_path), max_as, nf, "False"],
Expand All @@ -137,7 +134,7 @@ def benchmark_kfactor_cli(test_files, tmp_path):
grid_folder = test_files / "data" / "grids" / "400"
kfolder = test_files / "data" / "kfactors"
fake_yaml_path = test_files / "data" / "yamldb" / "ATLAS_TTB_FAKE.yaml"
max_as = "3"
ordr_to_update = "3"
target_path = tmp_path
res = runner.invoke(
command,
Expand All @@ -147,8 +144,7 @@ def benchmark_kfactor_cli(test_files, tmp_path):
str(kfolder),
str(fake_yaml_path),
str(target_path),
max_as,
"False",
ordr_to_update,
],
)
assert "The number of bins match the lenght of the k-factor" in res.output
assert "The number of bins match the length of the kfactor" in res.output
8 changes: 4 additions & 4 deletions benchmarks/bench_kfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

def benchmark_kfactor_inclusion(test_files, tmp_path, test_pdf, lhapdf_path):
fake_yaml_path = test_files / "data" / "yamldb" / "ATLAS_TTB_FAKE.yaml"
max_as = 3
pto_to_update = 3 # here we want to update NNLO
pdf_name = "NNPDF40_nnlo_as_01180"
kfactor.compute_k_factor_grid(
kfactor.apply_to_dataset(
test_files / "data" / "grids" / "400",
test_files / "data" / "kfactors",
fake_yaml_path,
max_as,
pto_to_update,
target_folder=tmp_path,
)
pluskfactor_grid_path = tmp_path / "ATLAS_TTB_8TEV_LJ_TRAP.pineappl.lz4"
Expand Down Expand Up @@ -46,7 +46,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))
centrals_kfactor, _ = kfactor.read_kfactor(
centrals_kfactor, _ = kfactor.read_from_file(
test_files / "data" / "kfactors" / "CF_QCD_ATLAS_TTB_8TEV_LJ_TRAP.dat"
)
rtol = 1.0e-15
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ handy utility functions:

- applying the :doc:`FONLL prescription</theory/fonll>`
- applying the :doc:`scale variation prescription</theory/scalevar>`
- burning the :doc:`K-factor</theory/kfactors>` into grids
- burning the :doc:`Kfactor</theory/kfactors>` into grids


Checking the grids
Expand Down
21 changes: 16 additions & 5 deletions docs/source/theory/kfactors.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
K-Factors
Kfactors
=========

Another useful tool that `pineko` includes is ``pineko kfactor`` which allows the embedding of a kfactor
as a proper order in a grid. The usage is the following::

pineko kfactor GRIDS_FOLDER KFACTOR_FOLDER YAMLDB_PATH TARGET_FOLDER MAX_AS ORDER_EXISTS
pineko kfactor GRIDS_FOLDER KFACTOR_FOLDER YAMLDB_FILE TARGET_FOLDER PTO_TO_UPDATE [--order_exists]

where ``GRIDS_FOLDER`` is the folder containing the grids to update, ``KFACTOR_FOLDER`` is the folder
containing the kfactor files and ``YAMLDB_PATH`` is the path to the yamldb file of the requested dataset.
The other inputs have already been described in the previous section.
where:

- ``GRIDS_FOLDER`` is the folder containing the grids to update,
- ``KFACTOR_FOLDER`` is the folder containing the kfactor files,
- ``YAMLDB_FILE`` is the path to the yamldb file of the requested dataset,
- ``TARGET_FOLDER`` is the folder where the new updated grids is going to be saved,
- ``PTO_TO_UPDATE`` is the :math:`\alpha_s` perturbative order to update or create,
with the convention that ``LO=1``, ``NLO=2`` and so on, irrespectively to the powers of :math:`\alpha_s`.
- ``--order_exists`` is a flag used to apply the kfactor to the specified perturbative order, insead of the next.

Note that only pure QCD kfactors are taken into account.
For example to add the NNLO in a grid containing at most NLO one has to select ``PTO_TO_UPDATE=2``;
nn the other hand to reweight the NNLO present in a grid with a kfactor,
one should do ``PTO_TO_UPDATE=2 --order_exists``.
Loading
Loading