diff --git a/src/pineko/kfactor.py b/src/pineko/kfactor.py index 2ef06610..4784f77e 100644 --- a/src/pineko/kfactor.py +++ b/src/pineko/kfactor.py @@ -288,7 +288,21 @@ def is_already_in(to_check, list_orders): def construct_new_order(grid, order_to_update, central_k_factor, alphas, order_exists): - """Construct a scaled grid, with the given order.""" + """Construct a scaled grid, with the given order. + + Parameters + ---------- + grid : pineappl.grid + loaded grid + order_to_update : int + alpha_s order to update + central_kfactor : np.ndarray + kfactors to apply + alphas : lhapdf.AlphaS + alphas + order_exists: bool + True if the order to update is already present + """ # extract the relevant order to rescale from the grid for each lumi and bin grid_orders = [order.as_tuple() for order in grid.orders()] @@ -361,6 +375,7 @@ def do_it( # check if the order is already there is_in = is_already_in((order_to_update, min_al, 0, 0), grid_orders) + # Prevent summing orders incoherently if is_in and not order_exists: rich.print("[green] Success: Requested order already in the grid.") return @@ -373,8 +388,7 @@ def do_it( ) new_grid = grid - - # TODO: is this really necessary?? pineappl doesn't complain if the order is still there. + # if the new order is there, clean the old one. if is_in: new_grid = scale_variations.construct_and_dump_order_exists_grid( grid, order_to_update diff --git a/tests/test_kfactor.py b/tests/test_kfactor.py index d8c602ef..ecd1fcd6 100644 --- a/tests/test_kfactor.py +++ b/tests/test_kfactor.py @@ -27,7 +27,6 @@ def test_compute_scale_factor(): bin_index = 1 np.testing.assert_allclose( kfactor.compute_scale_factor( - 0, [0, 0, 0, 0], [1, 0, 0, 0], 5.0**2, @@ -40,7 +39,6 @@ def test_compute_scale_factor(): ) np.testing.assert_allclose( kfactor.compute_scale_factor( - 0, [0, 0, 0, 0], [2, 0, 0, 0], 5.0**2,