aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aplib/apitime.x
blob: c01dfc9efd5d95ab4d8c57064e380f006f290446 (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/apphot.h"

# AP_ITIME -  Procedure to set the image exposure time .

procedure ap_itime (im, ap)

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

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

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