Skip to content

Commit

Permalink
Replace np.sum for np.count_nonzero
Browse files Browse the repository at this point in the history
  • Loading branch information
bpalmeiro committed Jan 14, 2025
1 parent 7d12409 commit 8b584bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions invisible_cities/reco/icaro_components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_select_nS_mask_and_check_right_output(nsignals, signal):
data = pd.DataFrame({'nS1': data, 'nS2': data, 'event': range(nevt)})
mask = icarcomp.select_nS_mask_and_check(data, signal)

assert np.sum(mask) == nsignals
assert np.count_nonzero(mask) == nsignals


@given(integers(min_value = 1,
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_select_nS_mask_and_check_concatenating(ns1, ns2):
maskS1 = icarcomp.select_nS_mask_and_check(data, icarcomp.type_of_signal.nS1)
maskS2 = icarcomp.select_nS_mask_and_check(data, icarcomp.type_of_signal.nS2, maskS1)

assert np.sum(maskS1) >= np.sum(maskS2)
assert np.count_nonzero(maskS1) >= np.count_nonzero(maskS2)
assert np.logical_not(maskS2[np.logical_not(maskS1)].all())


Expand Down

0 comments on commit 8b584bb

Please sign in to comment.