aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aplib/aprdnoise.x
blob: e4fbda2cc797584599a8cc3a02fb188da1e5c406 (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
include <imhdr.h>
include "../lib/noise.h"

# AP_RDNOISE -  Procedure to set the image read noise parameter.

procedure ap_rdnoise (im, ap)

pointer	im		# pointer to IRAF image
pointer	ap		# pointer to apphot structure

pointer	sp, key
real	rdnoise
real	imgetr(), apstatr()

begin
	call smark (sp)
	call salloc (key, SZ_FNAME, TY_CHAR)
	call apstats (ap, CCDREAD, Memc[key], SZ_FNAME)
	if (Memc[key] == EOS)
	    rdnoise = apstatr (ap, READNOISE)
	else {
	    iferr {
	        rdnoise = imgetr (im, Memc[key])
	    } then {
		rdnoise = apstatr (ap, READNOISE)
		call eprintf ("Warning: Image %s  Keyword %s not found.\n")
		    call pargstr (IM_HDRFILE(im))
		    call pargstr (Memc[key])
	    }
	}
	if (IS_INDEFR(rdnoise) || rdnoise <= 0.0)
	    call apsetr (ap, READNOISE, 0.0)
	else
	    call apsetr (ap, READNOISE, rdnoise)
	call sfree (sp)
end