signal = np.concatenate((x[wing:], x[:-wing-1:-1]))
// Calculate the rolling median at each subsequent point
for i, item in enumerate(signal):
old = window.popleft()
window.append(item)
del sortwin[bisect_left(sortwin, old)]
insort(sortwin, item)
result[i] = sortwin[wing]
After Change
// Pad the edges of the original array with mirror copies
signal = np.concatenate((x[wing-1::-1], x, x[:-wing-1:-1]))
rolled = pd.rolling_median(signal, 2 * wing + 1, center=True)
return rolled[wing:-wing]
def rolling_quantile(x, width, quantile):
Rolling quantile (0--1) with mirrored edges.