Skip to content

Commit

Permalink
apply review suggetsion
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Aug 14, 2024
1 parent f3d8187 commit e066d88
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 57 deletions.
50 changes: 21 additions & 29 deletions src/pineko/cli/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,28 @@ def subcommand(
f"with max_as={max_as}, max_al={max_al}, xir={xir}, xif={xif}",
f"min_as: {min_as}" if min_as is not None else "",
)
if n_ekos == 1:
_grid, _fk, comp = evolve.evolve_grid(
grid,
operators1,
fktable,
max_as,
max_al,
xir,
xif,
assumptions=assumptions,
comparison_pdf1=pdf1,
comparison_pdf2=pdf2,
min_as=min_as,
)
if n_ekos == 2:
operators2 = eko.EKO.edit(op_paths[1])
else:
with eko.EKO.edit(op_paths[1]) as operators2:
_grid, _fk, comp = evolve.evolve_grid(
grid,
operators1,
fktable,
max_as,
max_al,
xir,
xif,
operators2=operators2,
assumptions=assumptions,
comparison_pdf1=pdf1,
comparison_pdf2=pdf2,
min_as=min_as,
)
operators2 = None

_grid, _fk, comp = evolve.evolve_grid(
grid,
operators1,
fktable,
max_as,
max_al,
xir,
xif,
operators2=operators2,
assumptions=assumptions,
comparison_pdf1=pdf1,
comparison_pdf2=pdf2,
min_as=min_as,
)

if n_ekos == 2:
operators2.close()

if comp is not None:
print(comp.to_string())
48 changes: 20 additions & 28 deletions src/pineko/theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,35 +514,27 @@ def fk(self, name, grid_path, tcard, pdf1, pdf2):
f"with max_as={max_as}, max_al={max_al}, xir={xir}, xif={xif}",
)

if n_ekos == 1:
_grid, _fk, comparison = evolve.evolve_grid(
grid,
operators1,
fk_filename,
max_as,
max_al,
xir=xir,
xif=xif,
assumptions=assumptions,
comparison_pdf1=pdf1,
meta_data={"theory_card": json.dumps(tcard)},
)
if n_ekos == 2:
operators2 = eko.EKO.edit(eko_tmp_path_b)
else:
with eko.EKO.edit(eko_tmp_path_b) as operators2:
_grid, _fk, comparison = evolve.evolve_grid(
grid,
operators1,
fk_filename,
max_as,
max_al,
xir=xir,
xif=xif,
assumptions=assumptions,
operators2=operators2,
comparison_pdf1=pdf1,
comparison_pdf2=pdf2,
meta_data={"theory_card": json.dumps(tcard)},
)
operators2 = None

_grid, _fk, comparison = evolve.evolve_grid(
grid,
operators1,
fk_filename,
max_as,
max_al,
xir=xir,
xif=xif,
assumptions=assumptions,
operators2=operators2,
comparison_pdf1=pdf1,
comparison_pdf2=pdf2,
meta_data={"theory_card": json.dumps(tcard)},
)

if n_ekos == 2:
# Remove tmp ekos
eko_tmp_path_b.unlink()

Expand Down

0 comments on commit e066d88

Please sign in to comment.