aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/fitpsf/apppsf.x
blob: c3604c875b5dc92bc2158b83f3198d25cf9c31b6 (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
121
122
123
include "../lib/apphotdef.h"
include "../lib/fitpsfdef.h"
include "../lib/apphot.h"
include "../lib/fitpsf.h"

# AP_PPSF -- Procedure to write the results of fitpsf to the output file.

procedure ap_ppsf (ap, fd, id, lid, ier)

pointer	ap	# pointer to apphot structure
int	fd	# output file descriptor
int	id	# sequence number of star
int	lid	# list id of star
int	ier	# comment string

real	apstatr()

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

	# Print the stars id.
	call ap_wid (ap, fd, apstatr (ap, OPFXCUR), apstatr (ap, OPFYCUR), id,
	    lid, '\\')

	# Print the parameters.
	call ap_wfres (ap, fd, ier)
end


# AP_QPPSF -- Procedure to print the results of fitpsf on the standard output
# in short form.

procedure ap_qppsf (ap, ier)

pointer	ap	# pointer to apphot structure
int	ier	# comment string

pointer	sp, imname, psf

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

	# Print the parameters on the standard output.
	call apstats (ap, IMROOT, Memc[imname], SZ_FNAME)
	switch (AP_PSFUNCTION(psf)) {
	case AP_RADGAUSS:
	    call printf (
	    "%s  %8.2f %8.2f  %6.3f %8g %8g  %s\n") 
		call pargstr (Memc[imname])
		call pargr (Memr[AP_PPARS(psf)+1])
		call pargr (Memr[AP_PPARS(psf)+2])
		call pargr (Memr[AP_PPARS(psf)+3])
		call pargr (Memr[AP_PPARS(psf)])
		call pargr (Memr[AP_PPARS(psf)+4])
		if (ier != AP_OK)
		    call pargstr ("err")
		else
		    call pargstr ("ok")
	case AP_ELLGAUSS:
	    call printf ("%s  %8.2f %8.2f  %6.3f %6.3f  ")
		call pargstr (Memc[imname])
		call pargr (Memr[AP_PPARS(psf)+1])
		call pargr (Memr[AP_PPARS(psf)+2])
		call pargr (Memr[AP_PPARS(psf)+3])
		call pargr (Memr[AP_PPARS(psf)+4])
	    call printf ("%6.1f %8g %8g  %s\n")
		call pargr (Memr[AP_PPARS(psf)+5])
		call pargr (Memr[AP_PPARS(psf)])
		call pargr (Memr[AP_PPARS(psf)+6])
		if (ier != AP_OK)
		    call pargstr ("err")
		else
		    call pargstr ("ok")
	case AP_MOMENTS:
	    call printf ("%s  %8.2f %8.2f  %6.3f %6.3f ")
		call pargstr (Memc[imname])
		call pargr (Memr[AP_PPARS(psf)+1])
		call pargr (Memr[AP_PPARS(psf)+2])
		call pargr (Memr[AP_PPARS(psf)+3])
		call pargr (Memr[AP_PPARS(psf)+4])
	    call printf ("%6.1f  %8g %8g  %s\n")
		call pargr (Memr[AP_PPARS(psf)+5])
		call pargr (Memr[AP_PPARS(psf)])
		call pargr (Memr[AP_PPARS(psf)+6])
		if (ier != AP_OK)
		    call pargstr ("err")
		else
		    call pargstr ("ok")
	}

	call sfree (sp)
end


# AP_PFHDR -- Procedure to write the banner for the fitpsf output file.

procedure ap_pfhdr (ap, fd)

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

int	apstati()

begin
	if (fd == NULL)
	    return

	switch (apstati (ap, PSFUNCTION)) {
	case AP_RADGAUSS:
	    call radhdr (ap, fd)
	case AP_ELLGAUSS:
	    call elhdr (ap, fd)
	case AP_MOMENTS:
	    call momhdr (ap, fd)
	default:
	    ;
	}
end