From: Sebastian H. <ha...@ms...> - 2004-05-19 19:17:07
|
On Wednesday 19 May 2004 12:03 pm, you wrote: > On Wed, 2004-05-19 at 14:25, Sebastian Haase wrote: > > Hi, > > > > the random_array poisson functions returns negative values if mean=0: > > >>>from numarray import random_array as ra > > >>> ra.seed(x=1, y=1) > > >>> ra.poisson(0) > > > > 5 > > > > >>> ra.poisson(0) > > > > -2 > > > > My "math book" tells me that it should be always zero. > > This seems to be a constructed case, but I'm using this to put > > "quantum statistic" into a simulated image: > > obj = na.array( something ) > > imageFromDetector = ra.poisson( obj ) + gaussianNoiseArray > > The object array might have lots of zeros surrounding the "actual > > object". Thinking of a fluorescent object sending out photons it makes > > sense to not get any photons at all from 'empty' regions. > > I'm using numarray 0.8; > > I tried this on Fedora-1 i386 with Python-2.3.3 and it returned zero > consistently. What platform are you on? > > Regards, > Todd I running debian (Woody) $ uname -a Linux baboon 2.4.18 #1 Tue Dec 16 14:11:01 PST 2003 i686 unknown $python -v <snip> Python 2.2.1 (#1, Feb 28 2004, 00:52:10) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 and I get this: >>> ra.poisson(0, 100000).min() -4 >>> ra.poisson(0, 100000).min() -4 >>> ra.poisson(0, 100000).mean() 1.9383 >>> ra.poisson(0, 100000).mean() 1.9607 >>> ra.poisson(0, 100000).max() 29 >>> ra.poisson(0, 100000).max() 28 Thanks for checking, Sebastian |