Skip to content

Commit

Permalink
Replace DAORAN with URAND
Browse files Browse the repository at this point in the history
The IRAF osb library already contains a good random number generator
with the same API as DAORAN, so we can replace it. The URAND random
number generator presented by D. Knuth has generally a very good
reputation in literature.

Reference: D. E. Knuth, The Art of Computer Programming, Vol. 2: Seminumerical
           Algorithms, Addison-Wesley, Reading, MA, 1981.
  • Loading branch information
olebole committed Nov 14, 2017
1 parent feea0a1 commit b84e95c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 117 deletions.
20 changes: 10 additions & 10 deletions noao/digiphot/daophot/addstar/dpartstar.x
Expand Up @@ -208,7 +208,7 @@ int iseed[ARB] # random number seed array
int ix, iy
pointer psffit
real dx, dy, dxsq, dysq, radsq, dvdx, dvdy, value, err
real dp_usepsf(), dp_nrml(), daoran()
real dp_usepsf(), dp_nrml(), urand()

begin
psffit = DP_PSFFIT(dao)
Expand All @@ -226,7 +226,7 @@ begin
Memr[DP_PSFLUT(psffit)], DP_PSFSIZE(psffit),
DP_NVLTABLE(psffit), DP_NFEXTABLE(psffit),
xfrom_psf, yfrom_psf, dvdx, dvdy)
err = daoran (iseed[mod(ix+iy,3)+1])
err = urand (iseed[mod(ix+iy,3)+1])
err = sqrt (max (0.0, value / gain)) * dp_nrml (err)
subin[ix,iy] = subin[ix,iy] + value + err
}
Expand All @@ -252,12 +252,12 @@ real minmag # minimum magnitude
real mwide # the magnitude range
int iseed[ARB] # seed array for random number genrator

real daoran()
real urand()

begin
x = xmin + daoran (iseed[1]) * xwide
y = ymin + daoran (iseed[2]) * ywide
mag = minmag + daoran (iseed[3]) * mwide
x = xmin + urand (iseed[1]) * xwide
y = ymin + urand (iseed[2]) * ywide
mag = minmag + urand (iseed[3]) * mwide
end


Expand All @@ -269,13 +269,13 @@ int seed # initial seed value
int iseed[ARB] # the seed array

int idum
real daoran()
real urand()

begin
idum = seed
iseed[1] = int (524288.* daoran (idum)) + 1
iseed[2] = int (524288.* daoran (idum)) + 1
iseed[3] = int (524288.* daoran (idum)) + 1
iseed[1] = int (524288.* urand (idum)) + 1
iseed[2] = int (524288.* urand (idum)) + 1
iseed[3] = int (524288.* urand (idum)) + 1
end


Expand Down
43 changes: 0 additions & 43 deletions noao/digiphot/daophot/daolib/daoran.x

This file was deleted.

1 change: 0 additions & 1 deletion noao/digiphot/daophot/daolib/mkpkg
Expand Up @@ -36,7 +36,6 @@ libpkg.a:
dpwparam.x
dpwcs.x <imio.h> ../lib/daophotdef.h
bicubic.x
daoran.x
erf.x
invers.f
invers2.x
Expand Down
63 changes: 0 additions & 63 deletions noao/digiphot/daophot/daolib/ran3.x

This file was deleted.

0 comments on commit b84e95c

Please sign in to comment.