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 pineko to check if the grid contains SV #24

Merged
merged 40 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ff57aab
First implementation
andreab1997 Jun 13, 2022
c13474d
Fixing
andreab1997 Jun 13, 2022
f7f3e06
Put scalevar parameters as arguments
andreab1997 Jun 13, 2022
02ee40d
Fixed init of cli
andreab1997 Jun 13, 2022
4fad303
Added SV check as default when computing fks
andreab1997 Jun 16, 2022
7713ff0
Fixing
andreab1997 Jun 16, 2022
b1598f6
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
c7987f8
Fixing
andreab1997 Jun 17, 2022
9fdd291
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
8322198
Fixing
andreab1997 Jun 17, 2022
f2eecce
Merge branch 'sv_check' of github.com:N3PDF/pineko into sv_check
andreab1997 Jun 17, 2022
b4dc401
Change argument of the function and put tocheck as argument
andreab1997 Jul 5, 2022
8c14399
put the grid as argument of evolve
andreab1997 Jul 8, 2022
7c3147a
Run pre-commit
andreab1997 Jul 8, 2022
0316a2f
Removed redundant def of xir and xif
andreab1997 Jul 8, 2022
cd68db0
Fixed import of pineappl
andreab1997 Jul 8, 2022
bd2dbdd
Upgrade PineAPPL to v0.5.4
alecandido Jul 9, 2022
5fcc283
Fixed import of pineappl
andreab1997 Jul 9, 2022
703c316
Merge branch 'sv_check' of github.com:N3PDF/pineko into sv_check
andreab1997 Jul 9, 2022
5d194df
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
5a3df49
Fixing
andreab1997 Jun 17, 2022
26ee37e
Fixing
andreab1997 Jun 13, 2022
fbeae62
Put scalevar parameters as arguments
andreab1997 Jun 13, 2022
3f9d6fe
Fixed init of cli
andreab1997 Jun 13, 2022
b406490
Added SV check as default when computing fks
andreab1997 Jun 16, 2022
c053a86
Splitted funcs, put if in theory and change cli
andreab1997 Jun 17, 2022
72c7889
Change argument of the function and put tocheck as argument
andreab1997 Jul 5, 2022
1928fcf
put the grid as argument of evolve
andreab1997 Jul 8, 2022
460af45
Run pre-commit
andreab1997 Jul 8, 2022
8e4ba78
Removed redundant def of xir and xif
andreab1997 Jul 8, 2022
48ec795
Fixed import of pineappl
andreab1997 Jul 8, 2022
381426e
Fixed import of pineappl
andreab1997 Jul 9, 2022
6cec81c
Merge branch 'sv_check' of github.com:N3PDF/pineko into sv_check
andreab1997 Jul 9, 2022
b88a051
Minor changes
andreab1997 Jul 9, 2022
7c30efe
Change names of funcs
andreab1997 Jul 11, 2022
261a2c7
Fixed theory
andreab1997 Jul 11, 2022
776af28
Merge branch 'feature/sv' into sv_check
felixhekhorn Jul 11, 2022
a3bc157
Added relevant tests
andreab1997 Jul 12, 2022
975b8fe
Refactor check subcommand
alecandido Jul 12, 2022
3010f8c
Improve functions' names consistency
alecandido Jul 12, 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
26 changes: 26 additions & 0 deletions src/pineko/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,29 @@ def check_grid_and_eko_compatible(pineappl_grid, operators):
# x-grid
if not np.all(in1d(np.unique(operators["targetgrid"]), np.array(x_grid))):
raise ValueError("x grid in pineappl grid and eko operator are NOT compatible!")


def check_grid_contains_sv(pineappl_grid, theory_card):
"""
Raises a `ValueError if the theory_card asks for scale-variations but they are not
available in the pineappl grid.

Parameters
----------
pineappl_grid : pineappl.grid.Grid
grid
theory_card : dict
theory card
"""
xir = theory_card["XIR"]
xif = theory_card["XIF"]
ftr = theory_card["fact_to_ren_scale_ratio"]
if xir == 1 and xif == 1 and ftr == 1:
return 0
order_list = [order.as_tuple() for order in pineappl_grid.orders()]
for order in order_list:
if order[-1] != 0 or order[-2] != 0:
return 0
raise ValueError(
"Theory card is requesting scale variations but they are not available for this grid!"
)
17 changes: 17 additions & 0 deletions src/pineko/cli/check_scalevar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
import click
import pineappl
import rich

from .. import check, theory_card
from ._base import command


@command.command("check_scalevar")
@click.argument("pineappl_path", metavar="PINEAPPL", type=click.Path(exists=True))
@click.argument("theory_ID", metavar="ID", type=click.Path(exists=True))
def subcommand(pineappl_path, theory_ID):
"""Check if PineAPPL grid contains scale variations if theory card needs them"""
t_card = theory_card.load(theory_ID)
pineappl_grid = pineappl.grid.Grid.read(pineappl_path)
check.check_grid_contains_sv(pineappl_grid, t_card)