def filter_ends(wv, min_score, shape, border=10):
    '\n  Return candidate ends for joining.\n\n  Returns an iterator yielding (Whisker_Seg, side).\n  '
    (maxy, maxx) = [(x - border) for x in shape]
    (minx, miny) = (border, border)
    test_point = (lambda x, y: ((x > minx) and (x < maxx) and (y > miny) and (y < maxy)))
    bordertest = (lambda e, side: test_point(e.x[side], e.y[side]))
    scoretest = (lambda e, side: (e.scores[side] > min_score))
    sides = [0, (- 1)]
    for e in wv:
        for s in sides:
            if (bordertest(e, s) and scoretest(e, s)):
                (yield (e, s))
Return candidate ends for joining.

Returns an iterator yielding (Whisker_Seg, side).
def filter_ends(wv, min_score, shape, border=10):
    '\n  Return candidate ends for joining.\n\n  Returns an iterator yielding (Whisker_Seg, side).\n  '
    (maxy, maxx) = [(x - border) for x in shape]
    (minx, miny) = (border, border)
    test_point = (lambda x, y: ((x > minx) and (x < maxx) and (y > miny) and (y < maxy)))
    bordertest = (lambda e, side: test_point(e.x[side], e.y[side]))
    scoretest = (lambda e, side: (e.scores[side] > min_score))
    sides = [0, (- 1)]
    for e in wv:
        for s in sides:
            if (bordertest(e, s) and scoretest(e, s)):
                (yield (e, s))