aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aplib/appadu.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/digiphot/apphot/aplib/appadu.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/digiphot/apphot/aplib/appadu.x')
-rw-r--r--noao/digiphot/apphot/aplib/appadu.x37
1 files changed, 37 insertions, 0 deletions
diff --git a/noao/digiphot/apphot/aplib/appadu.x b/noao/digiphot/apphot/aplib/appadu.x
new file mode 100644
index 00000000..121decaf
--- /dev/null
+++ b/noao/digiphot/apphot/aplib/appadu.x
@@ -0,0 +1,37 @@
+include <imhdr.h>
+include "../lib/noise.h"
+
+# AP_PADU -- Procedure to set the gain parameter for the noise model
+# computation.
+
+procedure ap_padu (im, ap)
+
+pointer im # pointer to IRAF image
+pointer ap # pointer to apphot structure
+
+pointer sp, key
+real padu
+real imgetr(), apstatr()
+
+begin
+ call smark (sp)
+ call salloc (key, SZ_FNAME, TY_CHAR)
+ call apstats (ap, GAIN, Memc[key], SZ_FNAME)
+ if (Memc[key] == EOS)
+ padu = apstatr (ap, EPADU)
+ else {
+ iferr {
+ padu = imgetr (im, Memc[key])
+ } then {
+ padu = apstatr (ap, EPADU)
+ call eprintf ("Warning: Image %s Keyword %s not found.\n")
+ call pargstr (IM_HDRFILE(im))
+ call pargstr (Memc[key])
+ }
+ }
+ if (IS_INDEFR(padu) || padu <= 0.0)
+ call apsetr (ap, EPADU, 1.0)
+ else
+ call apsetr (ap, EPADU, padu)
+ call sfree (sp)
+end