Skip to content

Commit

Permalink
diffimTools: fix for numpy 1.17
Browse files Browse the repository at this point in the history
Sogo Mineo (NAOJ) points out that this change is necessary

> in order for ip_diffim's tests to pass. I think this is
> because I am using numpy 1.17, in which numpy.random
> changed largely. rand.poisson() no longer accepts
> lam >= 9.223372006484772e+18 or lam = nan.
  • Loading branch information
PaulPrice committed Aug 30, 2019
1 parent 5f9ea2f commit 4c59a15
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions python/lsst/ip/diffim/diffimTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def makePoissonNoiseImage(im):
noiseIm = im.Factory(im.getBBox())
noiseArr = noiseIm.getArray()

with np.errstate(invalid='ignore'):
intNoiseArr = rand.poisson(imArr)
intNoiseArr = rand.poisson(np.where(np.isfinite(imArr), imArr, 0.0))

noiseArr[:, :] = intNoiseArr.astype(noiseArr.dtype)
return noiseIm
Expand Down

0 comments on commit 4c59a15

Please sign in to comment.