Skip to content

Commit

Permalink
check idx with nb sample
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyjim committed Feb 23, 2024
1 parent 0704422 commit a1a5acd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion grand/basis/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ def find_max_with_parabola_interp(x_trace, y_trace, idx_max, factor_hill=0.8):
e_idx = idx_max + 1
nb_out = 0
last_idx = e_idx
while e_idx < nb_sple and nb_out < out_lim:
while e_idx < (nb_sple-1) and nb_out < out_lim:
if y_trace[e_idx] < y_lim:
nb_out += 1
else:
nb_out = 0
last_idx = e_idx
e_idx += 1
e_idx = last_idx
if e_idx >= nb_sple:
e_idx = nb_sple -1
logger.debug(f"border around idx max {idx_max} is {b_idx}, {e_idx}")
logger.debug(f"{x_trace[b_idx]}\t{x_trace[e_idx]}")
if (e_idx - b_idx) <= 2:
Expand Down

0 comments on commit a1a5acd

Please sign in to comment.