def overlap(sma, low_1, high_1, low_2, high_2, threshold=1):
    """ Tests for non_overlap between array sets 1 and 2

    Args:
        sma (arr): Test parameters, preferably a numpy arange object
        low_1 (scipy.interpolate.interp1d): interp object for the lower bounds of set 1
        high_1 (scipy.interpolate.interp1d): interp object for the higher bounds of set 1
        low_2 (scipy.interpolate.interp1d): interp object for the lower bounds of set 2
        high_2 (scipy.interpolate.interp1d): interp object for the higher bounds of set 2
        threshold (int): How many consecutive times you see non-overlap between the two profiles.

    Returns:
        The index where the sufficient overlap is broken.
    """
    count, i = 0, 0
    for i in sma:
        overlapping = not ((high_2(i) < low_1(i)) or (low_2(i) > high_1(i)))
        if overlapping:
            count = 0
        if count == threshold:
            break
        count += 1

    return i