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
|
include "../lib/apphot.h"
include "../lib/noise.h"
include "../lib/center.h"
include "../lib/fitsky.h"
include "../lib/phot.h"
include "../lib/radprof.h"
include "../lib/display.h"
# AP_RPCOLON -- Show/set radprof parameters.
procedure ap_rpcolon (ap, im, cl, out, stid, ltid, cmdstr, newimage,
newcenterbuf, newcenter, newskybuf, newsky, newbuf, newfit)
pointer ap # pointer to the apphot structure
pointer im # pointer to iraf image
int cl # coord file descriptor
int out # output file descriptor
int stid # output file sequence number
int ltid # coord list sequence number
char cmdstr[ARB] # command string
int newimage # new image
int newcenterbuf, newcenter # new sky fit
int newskybuf, newsky # new sky buffer
int newbuf, newfit # new aperture
pointer sp, incmd, outcmd
int strdic()
begin
call smark (sp)
call salloc (incmd, SZ_LINE, TY_CHAR)
call salloc (outcmd, SZ_LINE, TY_CHAR)
# Get the commands.
call sscan (cmdstr)
call gargwrd (Memc[incmd], SZ_LINE)
if (Memc[incmd] == EOS) {
call sfree (sp)
return
}
# Process the command.
if (strdic (Memc[incmd], Memc[outcmd], SZ_LINE, CCMDS) != 0)
call apccolon (ap, out, stid, cmdstr, newcenterbuf, newcenter)
else if (strdic (Memc[incmd], Memc[outcmd], SZ_LINE, SCMDS) != 0)
call apscolon (ap, out, stid, cmdstr, newskybuf, newsky)
else if (strdic (Memc[incmd], Memc[outcmd], SZ_LINE, RPCMDS) != 0)
call ap_profcolon (ap, out, stid, cmdstr, newbuf, newfit)
else if (strdic (Memc[incmd], Memc[outcmd], SZ_LINE, PCMDS) != 0)
call apmagcolon (ap, out, stid, cmdstr, newbuf, newfit)
else if (strdic (Memc[incmd], Memc[outcmd], SZ_LINE, APCMDS) != 0)
call ap_apcolon (ap, im, cl, out, stid, ltid, cmdstr, newimage,
newcenterbuf, newcenter, newskybuf, newsky, newbuf, newfit)
else if (strdic (Memc[incmd], Memc[outcmd], SZ_LINE, NCMDS) != 0)
call ap_nscolon (ap, im, out, stid, cmdstr, newcenterbuf,
newcenter, newskybuf, newsky, newbuf, newfit)
else
call ap_rpimcolon (ap, cmdstr)
call sfree (sp)
end
# AP_PROFCOLON -- Procedure to display and modify radprof parameters.
procedure ap_profcolon (ap, out, stid, cmdstr, newbuf, newfit)
pointer ap # pointer to apphot structure
int out # output file descriptor
int stid # output file number
char cmdstr[ARB] # command string
int newbuf # new aperture buffers
int newfit # compute new magnitudes
int ival, ncmd
pointer sp, cmd
real rval
int strdic(), nscan(), apstati()
real apstatr()
begin
# Get the command.
call smark (sp)
call salloc (cmd, SZ_LINE, TY_CHAR)
call sscan (cmdstr)
call gargwrd (Memc[cmd], SZ_LINE)
if (Memc[cmd] == EOS) {
call sfree (sp)
return
}
# Process the colon command.
ncmd = strdic (Memc[cmd], Memc[cmd], SZ_LINE, RPCMDS)
switch (ncmd) {
case RCMD_RADIUS:
call gargr (rval)
if (nscan() == 1) {
call printf ("%s = %g %s\n")
call pargstr (KY_RPRADIUS)
call pargr (apstatr (ap, RPRADIUS))
call pargstr (UN_RSCALEUNIT)
} else {
call apsetr (ap, RPRADIUS, rval)
if (stid > 1)
call ap_rparam (out, KY_RPRADIUS, rval, UN_RSCALEUNIT,
"fitting radius")
newbuf = YES; newfit = YES
}
case RCMD_STEPSIZE:
call gargr (rval)
if (nscan() == 1) {
call printf ("%s = %g %s\n")
call pargstr (KY_RPSTEP)
call pargr (apstatr (ap, RPSTEP))
call pargstr (UN_RSCALEUNIT)
} else {
call apsetr (ap, RPSTEP, rval)
if (stid > 1)
call ap_rparam (out, KY_RPSTEP, rval, UN_RSCALEUNIT,
"step size in radius")
newfit = YES
}
case RCMD_ORDER:
call gargi (ival)
if (nscan() == 1) {
call printf ("%s = %d\n")
call pargstr (KY_RPORDER)
call pargi (apstati (ap, RPORDER))
} else {
call apseti (ap, RPORDER, ival)
if (stid > 1)
call ap_iparam (out, KY_RPORDER, ival, UN_RNUMBER,
"maximum number of rejection cycels")
newfit = YES
}
case RCMD_KREJECT:
call gargr (rval)
if (nscan() == 1) {
call printf ("%s = %g %s\n")
call pargstr (KY_RPKSIGMA)
call pargr (apstatr (ap, RPKSIGMA))
call pargstr (UN_RSIGMA)
} else {
call apsetr (ap, RPKSIGMA, rval)
if (stid > 1)
call ap_rparam (out, KY_RPKSIGMA, rval, UN_RSIGMA,
"k-sigma rejection criteron")
newfit = YES
}
case RCMD_NREJECT:
call gargi (ival)
if (nscan() == 1) {
call printf ("%s = %d\n")
call pargstr (KY_RPNREJECT)
call pargi (apstati (ap, RPNREJECT))
} else {
call apseti (ap, RPNREJECT, ival)
if (stid > 1)
call ap_iparam (out, KY_RPNREJECT, ival, UN_RNUMBER,
"maximum number of rejection cycles")
newfit = YES
}
default:
call printf ("Unknown or ambiguous colon command\7\n")
}
call sfree (sp)
end
# AP_RPIMCOLON -- Show/set quantities which are not radprof parameters.
procedure ap_rpimcolon (ap, cmdstr)
pointer ap # pointer to the apphot structure
char cmdstr[ARB] # command string
bool bval
int ncmd
pointer sp, cmd
bool itob()
int apstati(), strdic(), nscan(), btoi()
begin
call smark (sp)
call salloc (cmd, SZ_LINE, TY_CHAR)
# Get the command.
call sscan (cmdstr)
call gargwrd (Memc[cmd], SZ_LINE)
if (Memc[cmd] == EOS) {
call sfree (sp)
return
}
# Process the command.
ncmd = strdic (Memc[cmd], Memc[cmd], SZ_LINE, MISC)
switch (ncmd) {
case ACMD_SHOW:
call gargwrd (Memc[cmd], SZ_LINE)
ncmd = strdic (Memc[cmd], Memc[cmd], SZ_LINE, RPSHOWARGS)
switch (ncmd) {
case RCMD_CENTER:
call printf ("\n")
call ap_cpshow (ap)
call printf ("\n")
case RCMD_SKY:
call printf ("\n")
call ap_spshow (ap)
call printf ("\n")
case RCMD_PHOT:
call printf ("\n")
call ap_mpshow (ap)
call printf ("\n")
case RCMD_FIT:
call printf ("\n")
call ap_rppshow (ap)
call printf ("\n")
case RCMD_DATA:
call printf ("\n")
call ap_nshow (ap)
call printf ("\n")
default:
call printf ("\n")
call ap_rprofshow (ap)
call printf ("\n")
}
case ACMD_RADPLOTS:
call gargb (bval)
if (nscan() == 1) {
call printf ("%s = %b\n")
call pargstr (KY_RADPLOTS)
call pargb (itob (apstati (ap, RADPLOTS)))
} else
call apseti (ap, RADPLOTS, btoi (bval))
default:
call printf ("Unknown or ambiguous colon command\7\n")
}
call sfree (sp)
end
|