aboutsummaryrefslogtreecommitdiff
path: root/noao/astcat/src/attools/atinpars.x
blob: df0f5d95a49e8c565363e295da00d9d2501a423a (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
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
include "../../lib/astrom.h"
include "../../lib/acatalog.h"
include "../../lib/aimpars.h"


# AT_GRCPSET -- Read in the region definition parameters. 

procedure at_grcpset (psetname, at)

char	psetname[ARB]		#I the input pset name 
pointer at                      #I the pointer to the main astrom structure

double	dval
pointer	sp, str, pp
int	ival, nchars
double	clgpsetd()
pointer	clopset()
int	ctod(), strlen(), strdic()

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

	pp = clopset (psetname)

	# Get the field center and width.
	call clgpset (pp, "rcra", Memc[str], SZ_FNAME)
	nchars = strlen (Memc[str])
	ival = 1
	if (nchars != 0 && (ctod (Memc[str], ival, dval) == nchars))
	    call at_setd (at, RCRA, dval)
	else
	    call error (0, "Parameter not a legal number (aregpars.rcra)")

	call clgpset (pp, "rcdec", Memc[str], SZ_FNAME)
	nchars = strlen (Memc[str])
	ival = 1
	if (nchars != 0 && (ctod (Memc[str], ival, dval) == nchars))
	    call at_setd (at, RCDEC, dval)
	else
	    call error (0, "Parameter not a legal number (aregpars.rcdec)")

	call at_setd (at, RCRAWIDTH, clgpsetd (pp, "rrawidth"))
	call at_setd (at, RCDECWIDTH, clgpsetd (pp, "rdecwidth"))

	# Get the field center units.
	call clgpset (pp, "rcraunits", Memc[str], SZ_FNAME)
	ival = strdic (Memc[str], Memc[str], SZ_FNAME, AT_RA_UNITS) 
	if (ival <= 0)
	    call at_seti (at, RCRAUNITS, 0)
	else
	    call at_seti (at, RCRAUNITS, ival)
	call clgpset (pp, "rcdecunits", Memc[str], SZ_FNAME)
	ival = strdic (Memc[str], Memc[str], SZ_FNAME, AT_DEC_UNITS) 
	if (ival <= 0)
	    call at_seti (at, RCDECUNITS, 0)
	else
	    call at_seti (at, RCDECUNITS, ival)

	# Get the field center celestial coordinate system.
	call clgpset (pp, "rcsystem", Memc[str], SZ_FNAME)
	call at_sets (at, RCSYSTEM, Memc[str])

	call clcpset (pp)

        call sfree (sp)
end


# AT_GFSPSET -- Read in the input catalog filtering / selection parameters.

procedure at_gfspset (psetname, at)

char	psetname[ARB]		#I the input pset name 
pointer at                      #I the pointer to the main astrom structure

pointer	sp, str, pp
int	ival
pointer	clopset()
int	btoi(), strdic()
bool	clgpsetb()

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

	pp = clopset (psetname)

	call clgpset (pp, "fields", Memc[str], SZ_LINE)
	call at_sets (at, FIELDS, Memc[str])
	call clgpset (pp, "fexpr", Memc[str], SZ_LINE)
	call at_sets (at, FEXPR, Memc[str])
	call clgpset (pp, "fnames", Memc[str], SZ_LINE)
	call at_sets (at, FNAMES, Memc[str])
	call clgpset (pp, "fntypes", Memc[str], SZ_LINE)
	call at_sets (at, FNTYPES, Memc[str])
	call clgpset (pp, "fnunits", Memc[str], SZ_LINE)
	call at_sets (at, FNUNITS, Memc[str])
	call clgpset (pp, "fnformats", Memc[str], SZ_LINE)
	call at_sets (at, FNFORMATS, Memc[str])

	call clgpset (pp, "fsort", Memc[str], SZ_LINE)
	call at_sets (at, FSORT, Memc[str])
	call at_seti (at, FREVERSE, btoi (clgpsetb (pp, "freverse")))

	#call at_seti (at, FREPLACE, btoi (clgpsetb (pp, "freplace")))
	call clgpset (pp, "fosystem", Memc[str], SZ_LINE)
	call at_sets (at, FOSYSTEM, Memc[str])

	call clgpset (pp, "fira", Memc[str], SZ_LINE)
	call at_sets (at, FIRA, Memc[str])
	call clgpset (pp, "fidec", Memc[str], SZ_LINE)
	call at_sets (at, FIDEC, Memc[str])
	call clgpset (pp, "foraunits", Memc[str], SZ_LINE)
	ival = strdic (Memc[str], Memc[str], SZ_FNAME, AT_RA_UNITS) 
	if (ival <= 0)
	    call at_seti (at, FORAUNITS, 0)
	else
	    call at_seti (at, FORAUNITS, ival)
	call clgpset (pp, "fodecunits", Memc[str], SZ_LINE)
	ival = strdic (Memc[str], Memc[str], SZ_FNAME, AT_DEC_UNITS) 
	if (ival <= 0)
	    call at_seti (at, FODECUNITS, 0)
	else
	    call at_seti (at, FODECUNITS, ival)
	call clgpset (pp, "foraformat", Memc[str], SZ_LINE)
	call at_sets (at, FORAFORMAT, Memc[str])
	call clgpset (pp, "fodecformat", Memc[str], SZ_LINE)
	call at_sets (at, FODECFORMAT, Memc[str])

	call clgpset (pp, "fixp", Memc[str], SZ_LINE)
	call at_sets (at, FIXP, Memc[str])
	call clgpset (pp, "fiyp", Memc[str], SZ_LINE)
	call at_sets (at, FIYP, Memc[str])
	call clgpset (pp, "fixc", Memc[str], SZ_LINE)
	call at_sets (at, FIXC, Memc[str])
	call clgpset (pp, "fiyc", Memc[str], SZ_LINE)
	call at_sets (at, FIYC, Memc[str])

	call clgpset (pp, "foxformat", Memc[str], SZ_LINE)
	call at_sets (at, FOXFORMAT, Memc[str])
	call clgpset (pp, "foyformat", Memc[str], SZ_LINE)
	call at_sets (at, FOYFORMAT, Memc[str])

	call clcpset (pp)

        call sfree (sp)
end


# AT_GWCPSET -- Read in the default image wcs parameters.

procedure at_gwcpset (psetname, at)

char	psetname[ARB]		#I the input pset name 
pointer at                      #I the pointer to the main astrom structure

double	dval
pointer	sp, str, pp, st, sym
int	ip, ival
pointer clopset(), stopen(), stenter()
int	ctod(), strdic()
bool	streq()

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

	st = stopen ("wcslist", 2 * DEF_LEN_WCST, DEF_LEN_WCST,
	    10 * DEF_LEN_WCST)
	call at_setp (at, WCST, st)

	pp = clopset (psetname)

	call clgpset (pp, "wxref", Memc[str], SZ_LINE)
	sym = stenter (st, "wxref", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WXREF, dval)

	call clgpset (pp, "wyref", Memc[str], SZ_LINE)
	sym = stenter (st, "wyref", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WYREF, dval)

	call clgpset (pp, "wxmag", Memc[str], SZ_LINE)
	sym = stenter (st, "wxmag", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WXMAG, dval)

	call clgpset (pp, "wymag", Memc[str], SZ_LINE)
	sym = stenter (st, "wymag", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WYMAG, dval)

	call clgpset (pp, "wxrot", Memc[str], SZ_LINE)
	sym = stenter (st, "wxrot", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WXROT, dval)

	call clgpset (pp, "wyrot", Memc[str], SZ_LINE)
	sym = stenter (st, "wyrot", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WYROT, dval)

	call clgpset (pp, "wraref", Memc[str], SZ_LINE)
	sym = stenter (st, "wraref", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WRAREF, dval)

	call clgpset (pp, "wdecref", Memc[str], SZ_LINE)
	sym = stenter (st, "wdecref", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, WDECREF, dval)

	call clgpset (pp, "wraunits", Memc[str], SZ_LINE)
	sym = stenter (st, "wraunits", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ival = strdic (Memc[str], Memc[str], SZ_FNAME, AT_RA_UNITS) 
	if (ival <= 0)
	    call at_seti (at, WRAUNITS, 0)
	else
	    call at_seti (at, WRAUNITS, ival)

	call clgpset (pp, "wdecunits", Memc[str], SZ_LINE)
	sym = stenter (st, "wdecunits", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	ival = strdic (Memc[str], Memc[str], SZ_FNAME, AT_DEC_UNITS) 
	if (ival <= 0)
	    call at_seti (at, WDECUNITS, 0)
	else
	    call at_seti (at, WDECUNITS, ival)

	call clgpset (pp, "wproj", Memc[str], SZ_LINE)
	sym = stenter (st, "wproj", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	if (streq (Memc[str], "INDEF"))
	    call at_sets (at, WPROJ, "tan")
	else
	    call at_sets (at, WPROJ, Memc[str])

	call clgpset (pp, "wsystem", Memc[str], SZ_LINE)
	sym = stenter (st, "wsystem", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	if (streq (Memc[str], "INDEF"))
	    call at_sets (at, WSYSTEM, "J2000")
	else
	    call at_sets (at, WSYSTEM, Memc[str])

	call clcpset (pp)

        call sfree (sp)
end



# AT_GIMPSET -- Read in the default image data parameters.

procedure at_gimpset (psetname, at)

char	psetname[ARB]		#I the input pset name 
pointer at                      #I the pointer to the main astrom structure

double	dval
real	rval
pointer	sp, str, pp, st, sym
int	ip
pointer clopset(), stopen(), stenter()
int	ctod(), ctor()

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

	pp = clopset (psetname)
	st = stopen ("imlist", 2 * DEF_LEN_IMST, DEF_LEN_IMST,
	    10 * DEF_LEN_IMST)
	call at_setp (at, IMST, st)

	call clgpset (pp, "esitelng", Memc[str], SZ_LINE)
	sym = stenter (st, "esitelng", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, ESITELNG, dval)

	call clgpset (pp, "esitelat", Memc[str], SZ_LINE)
	sym = stenter (st, "esitelat", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, ESITELAT, dval)

	call clgpset (pp, "esitealt", Memc[str], SZ_LINE)
	sym = stenter (st, "esitealt", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, ESITEALT, rval)

	call clgpset (pp, "esitetz", Memc[str], SZ_LINE)
	sym = stenter (st, "esitetz", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, ESITETZ, rval)

	call clgpset (pp, "emjdobs", Memc[str], SZ_LINE)
	sym = stenter (st, "emjdobs", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctod (Memc[str], ip, dval) <= 0)
	    dval = INDEFD
	call at_setd (at, EMJDOBS, dval)

	call clgpset (pp, "edatamin", Memc[str], SZ_LINE)
	sym = stenter (st, "edatamin", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, EDATAMIN, rval)

	call clgpset (pp, "edatamax", Memc[str], SZ_LINE)
	sym = stenter (st, "edatamax", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, EDATAMAX, rval)

	call clgpset (pp, "egain", Memc[str], SZ_LINE)
	sym = stenter (st, "egain", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, EGAIN, rval)

	call clgpset (pp, "erdnoise", Memc[str], SZ_LINE)
	sym = stenter (st, "erdnoise", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, ERDNOISE, rval)

	call clgpset (pp, "ewavlen", Memc[str], SZ_LINE)
	sym = stenter (st, "ewavlen", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, EWAVLEN, rval)

	call clgpset (pp, "etemp", Memc[str], SZ_LINE)
	sym = stenter (st, "etemp", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, ETEMP, rval)

	call clgpset (pp, "epress", Memc[str], SZ_LINE)
	sym = stenter (st, "epress", LEN_IMST_STRUCT)
	call strcpy (Memc[str], AT_IMSTKVAL(sym), LEN_IMST_STRUCT)
	ip = 1
	if (ctor (Memc[str], ip, rval) <= 0)
	    rval = INDEFR
	call at_setr (at, EPRESS, rval)

	call clgpset (pp, "observat", Memc[str], SZ_LINE)
	sym = stenter (st, "observat", LEN_WCST_STRUCT)
	call strcpy (Memc[str], AT_WCSTKVAL(sym), LEN_WCST_STRUCT)
	call at_sets (at, OBSERVAT, Memc[str])


	call clcpset (pp)

        call sfree (sp)
end