Permalink
Browse files

silence a numpy RuntimeWarning

  • Loading branch information...
1 parent 488b02a commit ef1adda5342c63b68d9eefe5a1b0ea59ab7b7a30 @kwgoodman committed Oct 26, 2015
Showing with 9 additions and 8 deletions.
  1. +9 −8 la/farray/normalize.py
View
@@ -208,14 +208,15 @@ def push(x, n, axis=-1):
fidx = np.isfinite(y)
recent = np.nan * np.ones(y.shape[:-1])
count = np.nan * np.ones(y.shape[:-1])
- for i in range(y.shape[-1]):
- idx = (i - count) > n
- recent[idx] = np.nan
- idx = ~fidx[...,i]
- y[idx, i] = recent[idx]
- idx = fidx[...,i]
- count[idx] = i
- recent[idx] = y[idx, i]
+ with np.errstate(invalid='ignore'):
+ for i in range(y.shape[-1]):
+ idx = (i - count) > n
+ recent[idx] = np.nan
+ idx = ~fidx[...,i]
+ y[idx, i] = recent[idx]
+ idx = fidx[...,i]
+ count[idx] = i
+ recent[idx] = y[idx, i]
if axis != -1 or axis != x.ndim-1:
y = np.rollaxis(y, x.ndim-1, axis)
if x.ndim == 1:

0 comments on commit ef1adda

Please sign in to comment.