From d7193a1c489ef17bc10f1436448febdcf1ef0dcf Mon Sep 17 00:00:00 2001 From: Abelardo Moralejo Date: Wed, 9 Oct 2024 09:13:12 +0200 Subject: [PATCH] Fix failing E-scaling test --- lstchain/tools/tests/test_tools.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lstchain/tools/tests/test_tools.py b/lstchain/tools/tests/test_tools.py index 4a6c2bcceb..fdef88fecb 100644 --- a/lstchain/tools/tests/test_tools.py +++ b/lstchain/tools/tests/test_tools.py @@ -521,11 +521,10 @@ def test_add_scale_true_energy_in_irfs(temp_dir_observed_files, simulated_dl2_fi order_max = [] order_max_mod = [] for idx, _ in enumerate(e_true_list): - for j in range(len(e_migra)): - if e_migra_prob[idx][j] > e_migra_prob[idx][j - 1]: - order_max.append(j) - if e_migra_prob_mod[idx][j] > e_migra_prob_mod[idx][j - 1]: - order_max_mod.append(j) - - for i in range(len(order_max)): - assert order_max[i] != order_max_mod[i] + if (e_migra_prob[idx].sum() <= 0) or (e_migra_prob_mod[idx].sum() <= 0): + continue + order_max.append(np.argmax(e_migra_prob[idx])) + order_max_mod.append(np.argmax(e_migra_prob_mod[idx])) + + for a, b in zip(order_max, order_max_mod): + assert a != b