nevermind, the current behavior makes complete sense.
(as usual, it takes posting to a list for me to understand my mistake).
Looks like you'd like a centered moving median. The moving median in
bottleneck, however, puts the moving median in the position of the
last element in the window:
>> bn.move_median([0,1,2], 3)
array([ nan, nan, 1.])
BTW, how would a centered moving median work for an even window?
I do that all the time. It works even better, BTW, when you post to a
large list like NumPy.
yes, i was looking for centered, came up with this:
def centered_median(a, window):
"""
centered moving median
"""
assert window % 2 != 0
w = (window - 1) / 2
t = bn.move_median(a, window)
t = np.roll(t, -w)
t[:w] = a[:w]
t[-w:] = a[-w:]
return t