Skip to content

Commit

Permalink
Use recipe for PTO of FNS
Browse files Browse the repository at this point in the history
  • Loading branch information
andreab1997 committed Sep 19, 2023
1 parent fbb7500 commit 3778f27
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion benchmarks/bench_fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def benchmark_produce_fonll_tcards(tmp_path, test_files, test_configs, theoryid)
theorycards,
pineko.fonll.FNS_LIST,
pineko.fonll.NFFF_LIST,
pineko.fonll.PTOS_DICT[tcard["FNS"]],
pineko.fonll.produce_ptos(tcard["FNS"]),
pineko.fonll.PARTS_LIST,
):
assert simFONLL_tcard["FNS"] == fns
Expand Down
29 changes: 21 additions & 8 deletions src/pineko/fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FONLLInfo:
def __init__(
self, ffns3, ffn03, ffns4til, ffns4bar, ffn04, ffns5til, ffns5bar
) -> None:
"""Initialize fonll info."""
self.ffns3 = ffns3
self.ffn03 = ffn03
self.ffns4til = ffns4til
Expand Down Expand Up @@ -178,19 +179,31 @@ def produce_combined_fk(

NFFF_LIST = [3, 3, 4, 4, 4, 5, 5, 5]
PARTS_LIST = ["full", "full", "massless", "massive", "full", "massless", "massive"]
PTOS_DICT = {
"FONLL-A": [1 for _ in range(7)],
"FONLL-B": [2, 2, 1, 2, 2, 1, 2],
"FONLL-C": [2 for _ in range(7)],
"FONLL-D": [3, 3, 2, 3, 3, 2, 3],
"FONLL-E": [3 for _ in range(7)],
}
FNS_BASE_PTO = {"FONLL-A": 1, "FONLL-B": 1, "FONLL-C": 2, "FONLL-D": 2, "FONLL-E": 3}
MIXED_ORDER_FNS = ["FONLL-B", "FONLL-D"]


def produce_ptos(fns):
"""Produce the list of PTOs needed for the requested fns."""
base_pto = FNS_BASE_PTO["fns"]
if fns in MIXED_ORDER_FNS:
return [
base_pto + 1,
base_pto + 1,
base_pto,
base_pto + 1,
base_pto + 1,
base_pto,
base_pto + 1,
]
else:
return [base_pto for _ in range(7)]


def produce_fonll_recipe(fns):
"""Produce the different theory cards according to which FONLL is asked for."""
fonll_recipe = []
for fns, nfff, po, part in zip(FNS_LIST, NFFF_LIST, PTOS_DICT[fns], PARTS_LIST):
for fns, nfff, po, part in zip(FNS_LIST, NFFF_LIST, produce_ptos(fns), PARTS_LIST):
fonll_recipe.append(
{
"FNS": fns,
Expand Down

0 comments on commit 3778f27

Please sign in to comment.