aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/phot/appmag.x
blob: 9bc7e43c0eebdbccc53380c6f5177a2e9d4fa957 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
include "../lib/apphotdef.h"
include "../lib/apphot.h"
include "../lib/center.h"
include "../lib/fitsky.h"
include "../lib/photdef.h"
include "../lib/phot.h"

# AP_PMAG -- Procedure to write the results of the phot task to the output 
# file.

procedure ap_pmag (ap, fd, id, lid, cier, sier, pier)

pointer	ap	# pointer to apphot structure
int 	fd	# output text file
int	id	# id number of str
int	lid	# list id of star
int	cier	# centering error
int	sier	# sky fitting error
int	pier	# photometric error

int	i, naperts
int	apstati()
real	apstatr()

begin
	# Initialize.
	if (fd == NULL)
	    return

	# Write out the object id parameters.
	call ap_wid (ap, fd, apstatr (ap, OXINIT), apstatr(ap, OYINIT),
	    id, lid, '\\')

	# Write out the centering results.
	call ap_wcres (ap, fd, cier, '\\')

	# Write out the sky fitting results.
	call ap_wsres (ap, fd, sier, '\\')

	# Write out the photometry results.
	naperts = apstati (ap, NAPERTS)
	if (naperts == 0)
	    call ap_wmres (ap, fd, 0, pier, "  ")
	else {
	    do i = 1, naperts {
	        if (naperts == 1)
		    call ap_wmres (ap, fd, i, pier, "  ")
	        else if (i == naperts)
		    call ap_wmres (ap, fd, i, pier, "* ")
	        else
		    call ap_wmres (ap, fd, i, pier, "*\\")
	    }
	}
end


# AP_QPMAG -- Procedure to print a quick summary of the phot output on the
# standard output.

procedure ap_qpmag (ap, cier, sier, pier)

pointer	ap	# pointer to apphot structure
int	cier	# centering error
int	sier	# sky fitting error
int	pier	# photometry error

int	i
pointer	sp, imname, phot
real	apstatr()

begin
	# Initialize.
	call smark (sp)
	call salloc (imname, SZ_FNAME, TY_CHAR)
	phot = AP_PPHOT(ap)

	# Print the center and sky value.
	call apstats (ap, IMROOT, Memc[imname], SZ_FNAME)
	call printf ("%s  %8.2f %8.2f  %8g  ")
	    call pargstr (Memc[imname])
	    call pargr (apstatr (ap, OPXCUR))
	    call pargr (apstatr (ap, OPYCUR))
	    call pargr (apstatr (ap, SKY_MODE))

	# Print out the magnitudes and errors.
	do i = 1, AP_NAPERTS(phot) {
	    if (i == AP_NAPERTS(phot))
		call printf ("%7.3f  ")
	    else
	        call printf ("%7.3f  ")
		call pargr (Memr[AP_MAGS(phot)+i-1])
	}

	# Print out the error codes.
	if (cier != AP_OK || sier != AP_OK || pier != AP_OK) {
	    call printf ("err\n")
	} else {
	    call printf ("ok\n")
	}

	call sfree (sp)
end


# AP_MAGHDR -- Procedure to print the banner for the phot task on the
# standard output.

procedure ap_maghdr (ap, fd)

pointer	ap		# pointer to apphot strucuture
int	fd		# output file descriptor

begin
	if (fd == NULL)
	    return
	call ap_idhdr (ap, fd)
	call ap_chdr (ap, fd)
	call ap_shdr (ap, fd)
	call ap_mhdr (ap, fd)
end