Skip to content

Commit

Permalink
- fixed issue where labeler does not zero out filter section < minamp…
Browse files Browse the repository at this point in the history
… (contribution by Cory Fletcher)
  • Loading branch information
tr8dr committed Oct 19, 2020
1 parent 955d11a commit 3cdf2bf
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions tseries_patterns/labelers/AmplitudeBasedLabeler.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,22 @@ cdef class AmplitudeBasedLabeler:
Vmaxback = distance
Imaxback = i

# label forward region if meets size requirement
if Vmaxfwd >= self.minamp:
self._apply_label (labels, Istart, Imaxfwd, dir)
self._apply_label (labels, Imaxfwd+1, Imaxback-1, 0.0)
# if neither direction meets required minimum, zero out
if Vmaxfwd < self.minamp and Vmaxback < self.minamp:
self._apply_label (labels, Istart, Iend, 0.0)
else:
self._apply_label (labels, Istart, Imaxback, 0.0)
# label forward region if meets size requirement
if Vmaxfwd >= self.minamp:
self._apply_label (labels, Istart, Imaxfwd, dir)
self._apply_label (labels, Imaxfwd+1, Imaxback-1, 0.0)
else:
self._apply_label (labels, Istart, Imaxback, 0.0)

# label backward region is meets size requirement
if Vmaxback >= self.minamp:
self._apply_label (labels, Imaxback, Iend, dir)
else:
self._apply_label (labels, max(Imaxback, Imaxfwd+1), Iend, 0.0)
# label backward region if meets size requirement
if Vmaxback >= self.minamp:
self._apply_label (labels, Imaxback, Iend, dir)
else:
self._apply_label (labels, max(Imaxback, Imaxfwd+1), Iend, 0.0)

Ipos = Iend+1

Expand Down

0 comments on commit 3cdf2bf

Please sign in to comment.