aboutsummaryrefslogtreecommitdiff
path: root/noao/astcat/src/attools/atalloc.x
blob: 7a46c9368cd598ea08241eb9beed9504085c40f2 (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
include "../../lib/astromdef.h"
include "../../lib/astrom.h"
include "../../lib/acatalog.h"
include "../../lib/aimparsdef.h"
include "../../lib/aimpars.h"


# AT_AINIT -- Initialize the main astrometry structure.

procedure at_ainit (at)

pointer	at			#I the pointer to the astrometry descriptor

begin
	call calloc (at, LEN_ASTROM, TY_STRUCT)
	AT_PIO(at) = NULL
	AT_PRCENTER(at) = NULL
	AT_PFILTER(at) = NULL
end


# AT_AFREE -- Free the main astrometry structure.

procedure at_afree (at)

pointer	at			#I the pointer to the astrometry descriptor

begin
	call mfree (at, TY_STRUCT)
end


# AT_RCINIT -- Initialize the field center structure.

procedure at_rcinit (at)

pointer	at			#I the pointer to the astrometry descriptor

pointer	fc

begin
	call calloc (fc, LEN_PRCENTER, TY_STRUCT)

	# Set the default field.
	AT_RCRA(fc) = 0.0d0
	AT_RCDEC(fc) = 0.0d0
	AT_RCRAWIDTH(fc) = 1.0d0
	AT_RCDECWIDTH(fc) = 1.0d0
	AT_RCRAUNITS(fc) = AT_HOURS
	AT_RCDECUNITS(fc) = AT_DEGREES
	call strcpy ("J2000", AT_RCSYSTEM(fc), SZ_FNAME)
	call strcpy ("", AT_RCSOURCE(fc), SZ_FNAME)

	# Initialize the internal data structures.
	#AT_RCCC(fc) = NULL
	AT_RCST(fc) = NULL

	AT_PRCENTER(at) = fc
end


# AT_RCFREE -- Free the field center structure.

procedure at_rcfree (at)

pointer	at			#I the pointer to the astrometry descriptor

pointer	fc

begin
	fc = AT_PRCENTER(at)

	# Close the field center symbol table.
	if (AT_RCST(fc) != NULL)
	    call stclose (AT_RCST(fc))
	AT_RCST(fc) = NULL

	# Close the coordinate structure.
	#if (AT_RCCC(fc) != NULL)
	    #call sk_close (AT_RCCC(fc))
	#AT_RCCC(fc) = NULL

	call mfree (AT_PRCENTER(at), TY_STRUCT)
	AT_PRCENTER(at) = NULL
end


# AT_IOINIT -- Initialize the i/o structure.

procedure at_ioinit (at)

pointer	at			#I the pointer to the i/o descriptor

pointer	io	

begin
	call calloc (io, LEN_PIO, TY_STRUCT)

	AT_CATALOGS(io) = EOS
	AT_SURVEYS(io) = EOS
	AT_IMAGES(io) = EOS
	AT_INPUT(io) = EOS
	AT_OUTPUT(io) = EOS
	AT_CATNAME(io) = EOS
	AT_SVNAME(io) = EOS
	AT_IMNAME(io) = EOS
	AT_INFNAME(io) = EOS
	AT_OUTFNAME(io) = EOS
	AT_CATDB(io) = EOS
	AT_IMDB(io) = EOS

	AT_PIO(at) = io
end


# AT_IOFREE -- Free the i/o structure.

procedure at_iofree (at)

pointer	at			#I the pointer to the i/o descriptor

pointer	io

begin
	io = AT_PIO(at)

	call mfree (io, TY_STRUCT)
	AT_PIO(at) = NULL
end


# AT_FSINIT -- Initialize the filtering / selection structure.

procedure at_fsinit (at)

pointer	at			#I the pointer to the astrometry descriptor

pointer	fs

begin
	call calloc (fs, LEN_PFILTER, TY_STRUCT)

	AT_FSORT(fs) = EOS
	AT_FREVERSE(fs) = NO
	AT_FREPLACE(fs) = YES

	call strcpy ("J2000", AT_FOSYSTEM(fs), SZ_LINE)
	call strcpy ("ra", AT_FIRA(fs), SZ_LINE)
	call strcpy ("dec", AT_FIDEC(fs), SZ_LINE)
	AT_FORAFORMAT(fs) = EOS
	AT_FODECFORMAT(fs) = EOS
	AT_FORAUNITS(fs) = AT_HOURS
	AT_FODECUNITS(fs) = AT_DEGREES

	call strcpy ("xp", AT_FIXP(fs), SZ_LINE)
	call strcpy ("yp", AT_FIYP(fs), SZ_LINE)
	call strcpy ("xc", AT_FIXC(fs), SZ_LINE)
	call strcpy ("yc", AT_FIYC(fs), SZ_LINE)
	AT_FOXFORMAT(fs) = EOS
	AT_FOYFORMAT(fs) = EOS

	call strcpy ("*", AT_FIELDS(fs), SZ_LINE)
	call strcpy ("yes", AT_FEXPR(fs), SZ_LINE)
	AT_FNAMES(fs) = EOS
	AT_FNTYPES(fs) = EOS
	AT_FNUNITS(fs) = EOS
	AT_FNFORMATS(fs) = EOS

	AT_PFILTER(at) = fs
end


# AT_FSFREE -- Free the filtering / selection structure.

procedure at_fsfree (at)

pointer	at			#I the pointer to the astrometry descriptor

pointer	fs

begin
	fs = AT_PFILTER(at)
	call mfree (fs, TY_STRUCT)
	AT_PFILTER(at) = NULL
end


# AT_WCINIT -- Initialize the default WCS structure

procedure at_wcinit (at)

pointer	at			#I the mail astrometry package descriptor

pointer	wc

begin
	call calloc (wc, LEN_PWCS, TY_STRUCT)
	AT_WXREF(wc) = INDEFD
	AT_WYREF(wc) = INDEFD
	AT_WXMAG(wc) = 1.0
	AT_WYMAG(wc) = 1.0
	AT_WXROT(wc) = 0.0
	AT_WYROT(wc) = 0.0
	AT_WRAREF(wc) = 0.0
	AT_WDECREF(wc) = 0.0
	AT_WRAUNITS(wc) = 0
	AT_WDECUNITS(wc) = 0
	AT_WPROJ(wc) = EOS
	AT_WSYSTEM(wc) = EOS

	AT_WCST(wc) = NULL

	AT_PWCS(at) = wc
end


# AT_WCFREE -- Free the default WCS structure

procedure at_wcfree (at)

pointer	at			#I the mail astrometry package descriptor

pointer	wc

begin
	wc = AT_PWCS(at)

	# Close the default wcspars parameters symbol table.
	if (AT_WCST(wc) != NULL)
	    call stclose(AT_WCST(wc))
	AT_WCST(wc) = NULL

	call mfree (wc, TY_STRUCT)
	AT_PWCS(at) = NULL
end


# AT_IMINIT -- Initialize the default mage data structure

procedure at_iminit (at)

pointer	at			#I the mail astrometry package descriptor

pointer	ip

begin
	call calloc (ip, LEN_PIMPARS, TY_STRUCT)
	AT_ESITELNG(ip) = INDEFD
	AT_ESITELAT(ip) = INDEFD
	AT_EMJDOBS(ip) = INDEFD

	AT_ESITEALT(ip) = INDEFR
	AT_ESITETZ(ip) = INDEFR
	AT_EDATAMIN(ip) = INDEFR
	AT_EDATAMAX(ip) = INDEFR
	AT_EGAIN(ip) = 1.0
	AT_ERDNOISE(ip) = 0.0
	AT_EWAVLEN(ip) = INDEFR
	AT_ETEMP(ip) = INDEFR
	AT_EPRESS(ip) = INDEFR

	AT_OBSERVAT(ip) = EOS

	AT_IMST(ip) = NULL

	AT_PIMPARS(at) = ip
end


# AT_IMFREE -- Free the default image data structure

procedure at_imfree (at)

pointer	at			#I the mail astrometry package descriptor

pointer	ip

begin
	ip = AT_PIMPARS(at)

	# Close the default wcspars parameters symbol table.
	if (AT_IMST(ip) != NULL)
	    call stclose(AT_IMST(ip))
	AT_IMST(ip) = NULL

	call mfree (ip, TY_STRUCT)
	AT_PIMPARS(at) = NULL
end