aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aplib/apinpars2.x
blob: ff9cf3eb37fe46d5ee00fcecaba7cf06acf7b40b (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
include "../lib/display.h"
include "../lib/center.h"
include "../lib/fitsky.h"
include "../lib/phot.h"
include "../lib/polyphot.h"

# AP_GCEPARS -- Read in the centering algorithm parameters from the 
# centerpars parameter file.

procedure ap_gcepars (ap)

pointer	ap			# pointer to the apphot structure

int	function
pointer	sp, str, pp
bool	clgpsetb()
int	strdic(), btoi(), clgpseti()
pointer	clopset()
real	clgpsetr()

begin
	call smark (sp)
	call salloc (str, SZ_LINE, TY_CHAR)

	# Open the pset parameter file.
	pp = clopset ("centerpars")

	# Get the centering parameters.
	call clgpset (pp, "calgorithm", Memc[str], SZ_LINE)
	function = strdic (Memc[str], Memc[str], SZ_LINE, CFUNCS)
	call apsets (ap, CSTRING, Memc[str])
	call apseti (ap, CENTERFUNCTION, function)
	call apsetr (ap, CAPERT, clgpsetr (pp, "cbox") / 2.0)
	call apsetr (ap, CTHRESHOLD, clgpsetr (pp, "cthreshold"))
	call apsetr (ap, MINSNRATIO, clgpsetr (pp, "minsnratio"))
	call apseti (ap, CMAXITER, clgpseti (pp, "cmaxiter"))
	call apsetr (ap, MAXSHIFT, clgpsetr (pp, "maxshift"))
	call apseti (ap, CLEAN, btoi (clgpsetb (pp, "clean")))
	call apsetr (ap, RCLEAN, clgpsetr (pp, "rclean"))
	call apsetr (ap, RCLIP, clgpsetr (pp, "rclip"))
	call apsetr (ap, SIGMACLEAN, clgpsetr (pp, "kclean"))

	call apseti (ap, MKCENTER, btoi (clgpsetb (pp, "mkcenter")))


	# Close the parameter set file.
	call clcpset (pp)

	call sfree (sp)
end


# AP_GSAPARS -- Read in the sky fitting parameters from the fitskypars
# parameter file.

procedure ap_gsapars (ap)

pointer	ap		# pointer to the apphot strucuture

int	function
pointer	sp, str, pp
bool	clgpsetb()
int	strdic(), clgpseti(), btoi()
pointer	clopset()
real	clgpsetr()

begin
	call smark (sp)
	call salloc (str, SZ_LINE, TY_CHAR)

	# Open the pset parameter file.
	pp = clopset ("fitskypars")

	# Get the sky fitting algorithm parameters.
	call clgpset (pp, "salgorithm", Memc[str], SZ_LINE)
	function = strdic (Memc[str], Memc[str], SZ_LINE, SFUNCS)
	call apsets (ap, SSTRING, Memc[str])
	call apseti (ap, SKYFUNCTION, function)
	call apsetr (ap, SKY_BACKGROUND, clgpsetr (pp, "skyvalue"))
	call apsetr (ap, ANNULUS, clgpsetr (pp, "annulus"))
	call apsetr (ap, DANNULUS, clgpsetr (pp, "dannulus"))
	call apsetr (ap, K1, clgpsetr (pp, "khist"))
	call apsetr (ap, BINSIZE, clgpsetr (pp, "binsize"))
	call apseti (ap, SMOOTH, btoi (clgpsetb (pp, "smooth")))
	call apseti (ap, SMAXITER, clgpseti (pp, "smaxiter"))
	call apsetr (ap, SLOCLIP, clgpsetr (pp, "sloclip"))
	call apsetr (ap, SHICLIP, clgpsetr (pp, "shiclip"))
	call apseti (ap, SNREJECT, clgpseti (pp, "snreject"))
	call apsetr (ap, SLOREJECT, clgpsetr (pp, "sloreject"))
	call apsetr (ap, SHIREJECT, clgpsetr (pp, "shireject"))
	call apsetr (ap, RGROW, clgpsetr (pp, "rgrow"))

	# Get the marking parameter.
	call apseti (ap, MKSKY, btoi (clgpsetb (pp, "mksky")))

	# Close the parameter set file.
	call clcpset (pp)

	call sfree (sp)
end


# AP_GPHPARS -- Get the photometry algorithm parameters from the photometry
# file.

procedure ap_gphars (ap)

pointer	ap		# pointer to the apphot strucuture

pointer	sp, str, pp
bool	clgpsetb()
int	btoi()
pointer	clopset()
real	clgpsetr()

begin
	call smark (sp)
	call salloc (str, SZ_LINE, TY_CHAR)

	# Open the pset parameter file.
	pp = clopset ("photpars")

	# Get the photometry parameters.
	call clgpset (pp, "apertures", Memc[str], SZ_LINE)
	call apsets (ap, APERTS, Memc[str])
	call apsetr (ap, ZMAG, clgpsetr (pp, "zmag"))
	call apseti (ap, MKAPERT, btoi (clgpsetb (pp, "mkapert")))
	call apsets (ap, PWSTRING, "constant")
	call apseti (ap, PWEIGHTS, AP_PWCONSTANT)

	# Close the parameter set file.
	call clcpset (pp)

	call sfree (sp)
end


# AP_GPOPARS -- Get the polygonal aperture photometry parameters.

procedure ap_gpopars (ap)

pointer	ap		# pointer to the apphot strucuture

pointer	sp, str, pp
bool	clgpsetb()
int	btoi()
pointer	clopset()
real	clgpsetr()

begin
	call smark (sp)
	call salloc (str, SZ_LINE, TY_CHAR)

	# Open the pset parameter file.
	pp = clopset ("polypars")

	# Get the parameters.
	call apsetr (ap, PYZMAG, clgpsetr (pp, "zmag"))
	call apseti (ap, MKPOLYGON, btoi (clgpsetb (pp, "mkpolygon")))

	# Close the parameter set file.
	call clcpset (pp)

	call sfree (sp)
end


# AP_GWHPARS -- Get the photometry algorithm parameters from the photometry
# file.

procedure ap_gwhars (ap)

pointer	ap		# pointer to the apphot strucuture

int	weight
pointer	sp, str, pp
bool	clgpsetb()
int	btoi(), strdic()
pointer	clopset()
real	clgpsetr()

begin
	call smark (sp)
	call salloc (str, SZ_LINE, TY_CHAR)

	# Open the pset parameter file.
	pp = clopset ("photpars")

	# Get the photometry parameters.
	call clgpset (pp, "apertures", Memc[str], SZ_LINE)
	call apsets (ap, APERTS, Memc[str])
	call apsetr (ap, ZMAG, clgpsetr (pp, "zmag"))
	call apseti (ap, MKAPERT, btoi (clgpsetb (pp, "mkapert")))
	call apsets (ap, PWSTRING, "constant")
	call apseti (ap, PWEIGHTS, AP_PWCONSTANT)

	# Get the major parameters.
	call clgpset (pp, "weighting", Memc[str], SZ_LINE)
	weight = strdic (Memc[str], Memc[str], SZ_LINE, PWFUNCS)
	call apsets (ap, PWSTRING, Memc[str])
	call apseti (ap, PWEIGHTS, weight)

	# Close the parameter set file.
	call clcpset (pp)

	call sfree (sp)
end