Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions n3fit/src/evolven3fit/eko_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,15 @@ def construct_eko_cards(

def construct_eko_photon_cards(
nnpdf_theory,
q_fin,
x_grid,
q_gamma,
op_card_dict: Optional[Dict[str, Any]] = None,
theory_card_dict: Optional[Dict[str, Any]] = None,
):
"""
Return the theory and operator cards used to construct the eko_photon.
nnpdf_theory is a NNPDF theory card for which we are computing the operator card and eko
q_fin is the final point of the q grid while q_points is the number of points of the grid.
nnpdf_theory is a NNPDF theory card for which we are computing the operator card and eko.
The q grid ends at Q0.
x_grid is the x grid to be used.
op_card_dict and theory_card_dict are optional updates that can be provided respectively to the
operator card and to the theory card.
Expand Down
15 changes: 3 additions & 12 deletions n3fit/src/n3fit/scripts/evolven3fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def construct_eko_parser(subparsers):
"produce_eko",
help=(
"""Produce the eko for the specified theory.
The q_grid starts at the Q0 given by the theory but the last point is q_fin
and its number of points can be specified by q_points.
The q_grid starts at 1.0 and ends at 1e5.
The x_grid starts at x_grid_ini and ends at 1.0 and contains the
provided number of points. The eko will be dumped in the provided path."""
),
Expand Down Expand Up @@ -80,7 +79,7 @@ def construct_eko_photon_parser(subparsers):
def construct_evolven3fit_parser(subparsers):
parser = subparsers.add_parser(
"evolve",
help="Evolves the fitted PDFs. The q_grid starts at the Q0 given by the theory but the last point is q_fin and its number of points can be specified by q_points. If a path is given for the dump option, the eko will be dumped in that path after the computation. If a path is given for the load option, the eko to be used for the evolution will be loaded from that path. The two options are mutually exclusive.",
help="Evolves the fitted PDFs. The q_grid starts at 1.0 and ends at 1e5. If a path is given for the dump option, the eko will be dumped in that path after the computation. If a path is given for the load option, the eko to be used for the evolution will be loaded from that path. The two options are mutually exclusive.",
)
parser.add_argument(
"fit_folder", help="Path to the folder containing the (pre-DGLAP) fit result"
Expand Down Expand Up @@ -108,12 +107,6 @@ def construct_evolven3fit_parser(subparsers):

def main():
parser = ArgumentParser(description="evolven3fit - a script with tools to evolve PDF fits")
parser.add_argument(
"-q", "--q-fin", type=float, default=None, help="Final q-value of the evolution"
)
parser.add_argument(
"-p", "--q-points", type=int, default=None, help="Number of q points for the evolution"
)
parser.add_argument("--no-net", action="store_true", help="Emulates validphys' --no-net")

subparsers = parser.add_subparsers(title="actions", dest="actions")
Expand Down Expand Up @@ -185,16 +178,14 @@ def main():
if args.actions == "produce_eko":
tcard, opcard = eko_utils.construct_eko_cards(
nnpdf_theory,
args.q_fin,
args.q_points,
x_grid,
op_card_info,
theory_card_info,
args.legacy40,
)
elif args.actions == "produce_eko_photon":
tcard, opcard = eko_utils.construct_eko_photon_cards(
nnpdf_theory, args.q_fin, x_grid, args.q_gamma, op_card_info, theory_card_info
nnpdf_theory, x_grid, args.q_gamma, op_card_info, theory_card_info
)
solve(tcard, opcard, args.dump)

Expand Down
4 changes: 4 additions & 0 deletions n3fit/src/n3fit/tests/test_evolven3fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def test_eko_utils(tmp_path, nnpdf_theory_card):
np.testing.assert_allclose(eko_op.operator_card.raw["xgrid"], x_grid)
np.testing.assert_allclose(list(eko_op.operator_card.raw["mugrid"]), op_card_dict["mugrid"])

# Testing if you can produce an eko with the CLI, then kill the job after 60 seconds
with pytest.raises(sp.TimeoutExpired):
sp.run(f"evolven3fit produce_eko 40000000 test.tar".split(), cwd=tmp_path, timeout=60)


# Keep old theory 399 and 398 EKOs here to avoid having to download many GB of data
# the only _actual_ eko test is given by the fit-bot
Expand Down
Loading