aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aplib/appadu.x
blob: 121decaf2e88f265f9ac6e46a5364c0a0a1b83aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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