Esempio n. 1
0
 def median_iter(y, w):
     if all(ww == w[0] for ww in w):
         for m, d in rolling_median_dev(y):
             yield m, d
     else:
         for j in range(1, len(y) + 1):
             m = step_detect.weighted_median(y[:j], w[:j])
             d = sum(ww * abs(yy - m) for yy, ww in zip(y[:j], w[:j]))
             yield m, d
Esempio n. 2
0
 def median_iter(y, w):
     if all(ww == w[0] for ww in w):
         for m, d in rolling_median_dev(y):
             yield m, d
     else:
         for j in range(1, len(y) + 1):
             m = step_detect.weighted_median(y[:j], w[:j])
             d = sum(ww*abs(yy - m) for yy, ww in zip(y[:j], w[:j]))
             yield m, d