latools/filtering/signal_optimiser.py
def calc_windows(fn, s, min_points):
    """
    Apply fn to all contiguous regions in s that have at least min_points.
    """
    max_points = np.sum(~np.isnan(s))
    n_points = max_points - min_points

    out = np.full((n_points, s.size), np.nan)

    # skip nans, for speed
    ind = ~np.isnan(s)
    s = s[ind]

    for i, w in enumerate(range(min_points, s.size)):
        r = rolling_window(s, w, pad=np.nan)
        out[i, ind] = np.apply_along_axis(fn, 1, r)

    return out
def calc_windows(fn, s, min_points):
    """
    Apply fn to all contiguous regions in s that have at least min_points.
    """
    max_points = np.sum(~np.isnan(s))
    n_points = max_points - min_points

    out = np.full((n_points, s.size), np.nan)

    # skip nans, for speed
    ind = ~np.isnan(s)
    s = s[ind]

    for i, w in enumerate(range(min_points, s.size)):
        r = rolling_window(s, w, pad=np.nan)
        out[i, ind] = np.apply_along_axis(fn, 1, r)

    return out
def calc_windows ( fn , s , min_points ) : max_points = np . sum ( ~ np . isnan ( s ) ) n_points = max_points - min_points out = np . full ( ( n_points , s . size ) , np . nan ) # skip nans, for speed ind = ~ np . isnan ( s ) s = s [ ind ] for i , w in enumerate ( range ( min_points , s . size ) ) : r = rolling_window ( s , w , pad = np . nan ) out [ i , ind ] = np . apply_along_axis ( fn , 1 , r ) return out
Apply fn to all contiguous regions in s that have at least min_points.
Apply fn to all contiguous regions in s that have at least min_points .