def calc_window_mean_std(s, min_points, ind=None):
max_points = np.sum(~np.isnan(s))<EOL>n_points = max_points - min_points<EOL>mean = np.full((n_points, s.size), np.nan)<EOL>std = np.full((n_points, s.size), np.nan)<EOL>if ind is None:<EOL><INDENT>ind = ~np.isnan(s)<EOL><DEDENT>else:<EOL><INDENT>ind = ind & ~np.isnan(s)<EOL><DEDENT>s = s[ind]<EOL>for i, w in enumerate(range(min_points, s.size)):<EOL><INDENT>r = rolling_window(s, w, pad=np.nan)<EOL>mean[i, ind] = r.sum(<NUM_LIT:1>) / w<EOL>std[i, ind] = (((r - mean[i, ind][:, np.newaxis])**<NUM_LIT:2>).sum(<NUM_LIT:1>) / (w - <NUM_LIT:1>))**<NUM_LIT:0.5><EOL><DEDENT>return mean, std<EOL>
Apply fn to all contiguous regions in s that have at least min_points.