Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Sep 20, 2023
1 parent acd6d81 commit 56ec7d9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
22 changes: 18 additions & 4 deletions src/pineko/fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def produce_combined_fk(
damp=(0, None),
):
"""Combine the FONLL FKs to produce one single final FONLL FK."""
fonll_info = FONLLInfo(ffns3, ffn03, ffns4, ffns4til, ffns4bar, ffn04, ffns5, ffns5til, ffns5bar)
fonll_info = FONLLInfo(
ffns3, ffn03, ffns4, ffns4til, ffns4bar, ffn04, ffns5, ffns5til, ffns5bar
)
theorycard_constituent_fks = fonll_info.theorycard_no_fns_pto
fk_dict = fonll_info.fks
if damp[0] == 0:
Expand Down Expand Up @@ -187,7 +189,15 @@ def produce_combined_fk(
"FONLL-FFNS",
]
MIXED_NFFF_LIST = [3, 3, 4, 4, 4, 5, 5, 5]
MIXED_PARTS_LIST = ["full", "full", "massless", "massive", "full", "massless", "massive"]
MIXED_PARTS_LIST = [
"full",
"full",
"massless",
"massive",
"full",
"massless",
"massive",
]

# plain FONLL schemes
FNS_LIST = [
Expand Down Expand Up @@ -230,7 +240,9 @@ def produce_fonll_recipe(fonll_fns, damp):
fns_list = MIXED_FNS_LIST if is_mixed else FNS_LIST
nfff_list = MIXED_NFFF_LIST if is_mixed else NFFF_LIST
parts_list = MIXED_PARTS_LIST if is_mixed else PARTS_LIST
for fns, nfff, po, part in zip(fns_list, nfff_list, produce_ptos(fonll_fns, is_mixed), parts_list):
for fns, nfff, po, part in zip(
fns_list, nfff_list, produce_ptos(fonll_fns, is_mixed), parts_list
):
fonll_recipe.append(
{
"FNS": fns,
Expand All @@ -249,7 +261,9 @@ def produce_fonll_tcards(tcard, tcard_parent_path, theoryid):
theorycards = [copy.deepcopy(tcard) for _ in range(n_theory)]
for theorycard, recipe in zip(theorycards, fonll_recipe):
theorycard.update(recipe)
paths_list = [tcard_parent_path / f"{theoryid}0{num}.yaml" for num in range(n_theory)]
paths_list = [
tcard_parent_path / f"{theoryid}0{num}.yaml" for num in range(n_theory)
]
for newtcard, path in zip(theorycards, paths_list):
with open(path, "w", encoding="UTF-8") as f:
yaml.safe_dump(newtcard, f)
Expand Down
17 changes: 14 additions & 3 deletions tests/test_fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ def test_FONLLInfo():
]
fullfonll_fake_info = pineko.fonll.FONLLInfo(*full_list)
wrongfonll_fake_info = pineko.fonll.FONLLInfo(
full_list[0], full_list[1], None, full_list[3], full_list[4], None, None, None, full_list[8]
full_list[0],
full_list[1],
None,
full_list[3],
full_list[4],
None,
None,
None,
full_list[8],
)
partialfonll_fake_info = pineko.fonll.FONLLInfo(
full_list[0], full_list[1], None, full_list[3], None, None, None, None, None
Expand All @@ -41,11 +49,14 @@ def test_FONLLInfo():
assert wrongfonll_fake_info.fk_paths == {
name: pathlib.Path(fk)
for name, fk in zip(
name_list[:2] + name_list[3:5] + [name_list[-1]], full_list[:2] + full_list[3:5] + [full_list[-1]]
name_list[:2] + name_list[3:5] + [name_list[-1]],
full_list[:2] + full_list[3:5] + [full_list[-1]],
)
}
assert partialfonll_fake_info.fk_paths == {
name: pathlib.Path(fk)
for name, fk in zip(name_list[:2] + name_list[3:4], full_list[:2] + full_list[3:4])
for name, fk in zip(
name_list[:2] + name_list[3:4], full_list[:2] + full_list[3:4]
)
if fk is not None
}

0 comments on commit 56ec7d9

Please sign in to comment.