[Scipy-tickets] [SciPy] #1398: problem with numpy 0's in stats.poisson.rvs

SciPy Trac scipy-tickets@scipy....
Sat Apr 9 01:29:21 CDT 2011

#1398: problem with numpy 0's in stats.poisson.rvs
 Reporter:  parejkoj     |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:          
Component:  scipy.stats  |     Version:  0.8.0   
 Keywords:               |  
Changes (by schwarz):

 * cc: schwarz (added)


 I would like to describe a case, where I need a poisson with mu=0:

 Often, I have to create simulated observations of astronomical sources. In
 that process, I assume a shaped source in a 2d array (source_image). This
 source has values >0  in its pixels. Outside the source, the image has
 pixel values = 0 (Because no photons should come from that regions).
 The observation is then simple to simulate:

 obs = poisson.rvs(source_image)

 But since the biggest part of the image is =0, I get "Domain errors". SO:
 currently I'm doing

 obs = poisson.rvs(source_image + 0.000001)

 While this helps, it is certainly wrong in a scientific way and I would
 prefer to use the true values.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1398#comment:4>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list