def test_ignore_nan(self):
""" Test that NaNs are handled correctly """
stream = [np.random.random(size = (16,12)) for _ in range(5)]
for s in stream:
s[randint(0, 15), randint(0,11)] = np.nan
with catch_warnings():
simplefilter('ignore')
from_iaverage = last(iaverage(stream, ignore_nan = True))
from_numpy = np.nanmean(np.dstack(stream), axis = 2)
self.assertTrue(np.allclose(from_iaverage, from_numpy))
评论列表
文章目录