@@ -333,18 +333,22 @@ cdef class AmplitudeBasedLabeler:
333333 Vmaxback = distance
334334 Imaxback = i
335335
336- # label forward region if meets size requirement
337- if Vmaxfwd >= self .minamp:
338- self ._apply_label (labels, Istart, Imaxfwd, dir )
339- self ._apply_label (labels, Imaxfwd+ 1 , Imaxback- 1 , 0.0 )
336+ # if neither direction meets required minimum, zero out
337+ if Vmaxfwd < self .minamp and Vmaxback < self .minamp:
338+ self ._apply_label (labels, Istart, Iend, 0.0 )
340339 else :
341- self ._apply_label (labels, Istart, Imaxback, 0.0 )
340+ # label forward region if meets size requirement
341+ if Vmaxfwd >= self .minamp:
342+ self ._apply_label (labels, Istart, Imaxfwd, dir )
343+ self ._apply_label (labels, Imaxfwd+ 1 , Imaxback- 1 , 0.0 )
344+ else :
345+ self ._apply_label (labels, Istart, Imaxback, 0.0 )
342346
343- # label backward region is meets size requirement
344- if Vmaxback >= self .minamp:
345- self ._apply_label (labels, Imaxback, Iend, dir )
346- else :
347- self ._apply_label (labels, max (Imaxback, Imaxfwd+ 1 ), Iend, 0.0 )
347+ # label backward region if meets size requirement
348+ if Vmaxback >= self .minamp:
349+ self ._apply_label (labels, Imaxback, Iend, dir )
350+ else :
351+ self ._apply_label (labels, max (Imaxback, Imaxfwd+ 1 ), Iend, 0.0 )
348352
349353 Ipos = Iend+ 1
350354
0 commit comments