Commit 79bf9cea authored by alexander.dornheim's avatar alexander.dornheim
Browse files

ProxPython is now using the built-in random generator numpy.random.poisson....

ProxPython is now using the built-in random generator numpy.random.poisson. According to the comments in PossionRan the argument is the mean (often called lambda). I also checked Numerical Recipes p. 294. Therefore calling


should yield the same as calling


This resolves the overflow issue with PoissonRan, but I still get the following warnings:

../proxtoolbox/ProxOperators/ RuntimeWarning: divide by zero encountered in true_divide
tmp = U_sq/data_sq[:,:,j];
../proxtoolbox/ProxOperators/ RuntimeWarning: invalid value encountered in true_divide
tmp = U_sq/data_sq[:,:,j];

Therefore I had a look at the following line in JWST_data_processor:


From my understanding it is very likely to get zeros when rounding.

I noted that after commenting out above line, there were no further warnings and the algorithm did converge nicely.
parent 62221e42
......@@ -98,7 +98,7 @@ def JWST_data_processor(config):
for ii in range(newres):
for jj in range(newres):
k[ii,jj,i]= Utilities.PoissonRan(k[ii,jj,i])*snr;
k[ii,jj,i]= np.random.poisson(k[ii,jj,i])*snr #use built in numpy possion instead of Utilities.PoissonRan(k[ii,jj,i])*snr;
rt_k[:,:,i]= np.sqrt(k[:,:,i]);
......@@ -60,7 +60,7 @@ new_config = {
# What are the noise characteristics (Poisson or Gaussian or none)?
'noise' : 'none', #'Poisson',
'noise' : 'Poisson', #'Poisson',
# Algorithm parameters
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment