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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
include <gset.h>
include "../lib/apphot.h"
include "../lib/center.h"
include "../lib/fitsky.h"
include "../lib/phot.h"
include "../lib/polyphot.h"
include "../lib/radprof.h"
# APMARK -- Procedure to mark center, fitsky and phot parameters on the display.
procedure apmark (ap, id, mkcenter, mksky, mkapert)
pointer ap # apphot pointer
pointer id # pointer to image display stream
int mkcenter # mark the computed center
int mksky # mark the sky annulus
int mkapert # mark the aperture(s)
int i, marktype
pointer sp, temp
real inner_sky, outer_sky, apert
int apstati(), gstati()
real apstatr()
errchk greactivate, gdeactivate, gamove, gadraw, gmark
begin
if (id == NULL)
return
if (mkcenter == NO && mksky == NO && mkapert == NO)
return
iferr {
call greactivate (id, 0)
} then {
return
}
marktype = gstati (id, G_PMLTYPE)
# Mark the center and shift on the display.
if (mkcenter == YES) {
iferr {
call gseti (id, G_PMLTYPE, GL_SOLID)
call gamove (id, (apstatr (ap, XCENTER) - apstatr (ap, XSHIFT)),
(apstatr (ap, YCENTER) - apstatr (ap, YSHIFT)))
call gadraw (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER))
call gmark (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER),
GM_PLUS, -2.0, -2.0)
} then
;
}
# Draw the sky annuli on the display.
if (mksky == YES) {
iferr {
call gseti (id, G_PMLTYPE, GL_DASHED)
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_PLUS, -2.0, -2.0)
inner_sky = 2.0 * apstatr (ap, SCALE) * apstatr (ap, ANNULUS)
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_CIRCLE, -inner_sky, -inner_sky)
outer_sky = 2.0 * apstatr (ap, SCALE) * (apstatr (ap,
ANNULUS) + apstatr (ap, DANNULUS))
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_CIRCLE, -outer_sky, -outer_sky)
} then
;
}
# Draw the apertures on the display.
if (mkapert == YES) {
iferr {
call smark (sp)
call salloc (temp, apstati (ap, NAPERTS), TY_REAL)
call ap_arrayr (ap, APERTS, Memr[temp])
call gseti (id, G_PMLTYPE, GL_DASHED)
call gmark (id, apstatr (ap, PXCUR), apstatr (ap, PYCUR),
GM_PLUS, -2.0, -2.0)
do i = 1, apstati (ap, NAPERTS) {
apert = 2.0 * apstatr (ap, SCALE) * Memr[temp+i-1]
call gmark (id, apstatr (ap, PXCUR), apstatr (ap, PYCUR),
GM_CIRCLE, -apert, -apert)
}
call sfree (sp)
} then
call sfree (sp)
}
# Restore the mark type.
call gseti (id, G_PMLTYPE, marktype)
iferr {
call gdeactivate (id, 0)
} then
return
end
# APPYMARK -- Procedure to mark center, fitsky and polyphot parameters on the
# display.
procedure appymark (ap, id, x, y, nver, mkcenter, mksky, mkpolygon)
pointer ap # apphot pointer
pointer id # pointer to image display stream
real x[ARB] # coordinates of x vertices
real y[ARB] # coordinates of y vertices
int nver # number of vertices
int mkcenter # mark the computed center
int mksky # mark the sky annulus
int mkpolygon # mark the aperture(s)
int marktype, linetype
real inner_sky, outer_sky
int gstati()
real apstatr()
errchk greactivate, gdeactivate, gamove, gadraw, gmark, gline
begin
if (id == NULL)
return
if (mkcenter == NO && mksky == NO && mkpolygon == NO)
return
iferr {
call greactivate (id, 0)
} then
return
marktype = gstati (id, G_PMLTYPE)
linetype = gstati (id, G_PLTYPE)
if (mkcenter == YES) {
iferr {
call gseti (id, G_PMLTYPE, GL_SOLID)
call gamove (id, (apstatr (ap, XCENTER) - apstatr (ap, XSHIFT)),
(apstatr (ap, YCENTER) - apstatr (ap, YSHIFT)))
call gadraw (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER))
call gmark (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER),
GM_PLUS, -2.0, -2.0)
} then
;
}
if (mksky == YES) {
iferr {
call gseti (id, G_PMLTYPE, GL_DASHED)
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_PLUS, -2.0, -2.0)
inner_sky = 2.0 * apstatr (ap, SCALE) * apstatr (ap, ANNULUS)
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_CIRCLE, -inner_sky, -inner_sky)
outer_sky = 2.0 * apstatr (ap, SCALE) * (apstatr (ap,
ANNULUS) + apstatr (ap, DANNULUS))
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_CIRCLE, -outer_sky, -outer_sky)
} then
;
}
if (mkpolygon == YES) {
iferr {
call gseti (id, G_PLTYPE, GL_DASHED)
call gmark (id, apstatr (ap, PYCX), apstatr (ap, PYCY),
GM_PLUS, -2.0, -2.0)
call gpline (id, x, y, nver)
} then
;
}
call gseti (id, G_PMLTYPE, marktype)
call gseti (id, G_PLTYPE, linetype)
iferr (call gdeactivate (id, 0))
return
end
# APRMARK -- Procedure to mark center, fitsky and radprof parameters on the
# display.
procedure aprmark (ap, id, mkcenter, mksky, mkapert)
pointer ap # apphot pointer
pointer id # pointer to image display stream
int mkcenter # mark the computed center
int mksky # mark the sky annulus
int mkapert # mark the aperture(s)
int i, marktype
pointer sp, temp
real inner_sky, outer_sky, apert, radius, xc, yc
int apstati(), gstati()
real apstatr()
errchk greactivate, gdeactivate, gamove, gadraw, gmark
begin
if (id == NULL)
return
if (mkcenter == NO && mksky == NO && mkapert == NO)
return
iferr {
call greactivate (id, 0)
} then
return
marktype = gstati (id, G_PMLTYPE)
# Mark the center and shift on the display.
if (mkcenter == YES) {
iferr {
call gseti (id, G_PMLTYPE, GL_SOLID)
call gamove (id, (apstatr (ap, XCENTER) - apstatr (ap, XSHIFT)),
(apstatr (ap, YCENTER) - apstatr (ap, YSHIFT)))
call gadraw (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER))
call gmark (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER),
GM_PLUS, -2.0, -2.0)
call gflush (id)
} then
;
}
# Draw the sky annuli on the display.
if (mksky == YES) {
iferr {
call gseti (id, G_PMLTYPE, GL_DASHED)
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_PLUS, -2.0, -2.0)
inner_sky = 2.0 * apstatr (ap, SCALE) * apstatr (ap, ANNULUS)
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_CIRCLE, -inner_sky, -inner_sky)
outer_sky = 2.0 * apstatr (ap, SCALE) * (apstatr (ap,
ANNULUS) + apstatr (ap, DANNULUS))
call gmark (id, apstatr (ap, SXCUR), apstatr (ap, SYCUR),
GM_CIRCLE, -outer_sky, -outer_sky)
call gflush (id)
} then
;
}
# Draw the apertures on the display.
if (mkapert == YES) {
iferr {
call smark (sp)
call salloc (temp, apstati (ap, NAPERTS), TY_REAL)
call gseti (id, G_PMLTYPE, GL_DASHED)
call gmark (id, apstatr (ap, XCENTER), apstatr (ap, YCENTER),
GM_PLUS, -2.0, -2.0)
call ap_arrayr (ap, APERTS, Memr[temp])
do i = 1, apstati (ap, NAPERTS) {
apert = 2.0 * apstatr (ap, SCALE) * Memr[temp+i-1]
call gmark (id, apstatr (ap, XCENTER), apstatr (ap,
YCENTER), GM_CIRCLE, -apert, -apert)
}
xc = apstatr (ap, XCENTER)
yc = apstatr (ap, YCENTER)
radius = apstatr (ap, SCALE) * apstatr (ap, RPRADIUS)
call gamove (id, xc - radius, yc - radius)
call gadraw (id, xc + radius, yc - radius)
call gadraw (id, xc + radius, yc + radius)
call gadraw (id, xc - radius, yc + radius)
call gadraw (id, xc - radius, yc - radius)
call sfree (sp)
} then
call sfree (sp)
}
call gseti (id, G_PMLTYPE, marktype)
iferr (call gdeactivate (id, 0))
return
end
|