Skip to content

Commit

Permalink
Recover bench_fonll
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Oct 20, 2023
1 parent fdf9a05 commit 78ab9c9
Showing 1 changed file with 22 additions and 30 deletions.
52 changes: 22 additions & 30 deletions benchmarks/bench_fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,25 @@

import pineko

# @pytest.mark.parametrize("theoryid,is_mixed", [(400, False), (208, True)])
# def benchmark_produce_fonll_tcards(
# tmp_path, test_files, test_configs, theoryid, is_mixed
# ):
# tcard = pineko.theory_card.load(theoryid)
# tcard_paths_list = pineko.fonll.produce_fonll_tcards(tcard, tmp_path, theoryid)
# # Check they are correct
# theorycards = []
# for path in tcard_paths_list:
# with open(path, encoding="UTF-8") as f:
# theorycards.append(yaml.safe_load(f))
# for num_fonll_tcard, fns, nfff, po, part in zip(
# theorycards,
# np.array(pineko.fonll.MIXED_FNS_CONFIG).transpose().tolist()[0]
# if is_mixed
# else np.array(pineko.fonll.FNS_CONFIG).transpose().tolist()[0],
# np.array(pineko.fonll.MIXED_FNS_CONFIG).transpose().tolist()[1]
# if is_mixed
# else np.array(pineko.fonll.FNS_CONFIG).transpose().tolist()[1],
# pineko.fonll.produce_ptos(tcard["FNS"], is_mixed),
# np.array(pineko.fonll.MIXED_FNS_CONFIG).transpose().tolist()[2]
# if is_mixed
# else np.array(pineko.fonll.FNS_CONFIG).transpose().tolist()[2],
# ):
# assert num_fonll_tcard["FNS"] == fns
# assert num_fonll_tcard["NfFF"] == int(nfff)
# assert (
# num_fonll_tcard["PTO"] == po - 1 if is_mixed and fns == "FONLL-FFN0" else po
# )
# assert num_fonll_tcard["FONLLParts"] == part

@pytest.mark.parametrize("theoryid,is_mixed", [(400, False), (208, True)])
def benchmark_produce_fonll_tcards(
tmp_path, test_files, test_configs, theoryid, is_mixed
):
tcard = pineko.theory_card.load(theoryid)
tcard_paths_list = pineko.fonll.dump_tcards(tcard, tmp_path, theoryid)
# Check they are correct
theorycards = []
for path in tcard_paths_list:
with open(path, encoding="UTF-8") as f:
theorycards.append(yaml.safe_load(f))
base_pto = pineko.fonll.FNS_BASE_PTO[tcard["FNS"]]
for num_fonll_tcard, cfg in zip(
theorycards,
pineko.fonll.MIXED_FNS_CONFIG if is_mixed else pineko.fonll.FNS_CONFIG,
):
po = int(base_pto) + (cfg.delta_pto if is_mixed else 0)
assert num_fonll_tcard["FNS"] == cfg.scheme
assert num_fonll_tcard["NfFF"] == int(cfg.nf)
assert num_fonll_tcard["PTO"] == po - 1 if is_mixed and cfg.asy else po
assert num_fonll_tcard["FONLLParts"] == cfg.parts

0 comments on commit 78ab9c9

Please sign in to comment.