Skip to content

Commit

Permalink
Correct bug in step function
Browse files Browse the repository at this point in the history
  • Loading branch information
achiefa committed Jan 29, 2025
1 parent 2e517f3 commit f916a65
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def step_function(a: npt.ArrayLike, y_shift: npt.ArrayLike, bin_edges: npt.Array
for shift_pos, shift in enumerate(y_shift):
bin_low = bin_edges[shift_pos]
bin_high = bin_edges[shift_pos + 1]
condition = np.multiply(a >= bin_low, a < bin_high)
condition = np.multiply(
a >= bin_low, a < bin_high if shift_pos != len(y_shift) - 1 else a <= bin_high
)
res.append([shift for cond in condition if cond])
res = np.concatenate(res)
return res
Expand Down

0 comments on commit f916a65

Please sign in to comment.