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
|
include "../lib/daophotdef.h"
include "../lib/allstardef.h"
# DP_ALLSTARSETUP -- Procedure to set up the ALLSTAR parameters.
procedure dp_allstarsetup (dp)
pointer dp # pointer to daophot structure
pointer allstar
begin
# Allocate memory.
call malloc (DP_ALLSTAR(dp), LEN_ALLSTARSTRUCT, TY_STRUCT)
allstar = DP_ALLSTAR(dp)
DP_DATA(allstar) = NULL
DP_SUBT(allstar) = NULL
DP_WEIGHTS(allstar) = NULL
DP_DBUF(allstar) = NULL
DP_SBUF(allstar) = NULL
DP_WBUF(allstar) = NULL
DP_ANUMER(allstar) = NULL
DP_ADENOM(allstar) = NULL
DP_ASUMWT(allstar) = NULL
DP_ARPIXSQ(allstar) = NULL
DP_ASKIP(allstar) = NULL
DP_AXCLAMP(allstar) = NULL
DP_AYCLAMP(allstar) = NULL
DP_AXOLD(allstar) = NULL
DP_AYOLD(allstar) = NULL
DP_AX(allstar) = NULL
DP_AV(allstar) = NULL
DP_AC(allstar) = NULL
DP_ALAST(allstar) = NULL
DP_ANPIX(allstar) = NULL
DP_AIER(allstar) = NULL
end
# DP_ALMEMSTAR -- Procedure to allocate sufficient memory for ALLSTAR.
procedure dp_almemstar (dao, max_star, max_group)
pointer dao # pointer to daophot structure
int max_star # maximum number of stars
int max_group # maximum group size
pointer allstar
begin
allstar = DP_ALLSTAR(dao)
if (DP_ANUMER (allstar) != NULL)
call mfree (DP_ANUMER (allstar), TY_REAL)
call malloc (DP_ANUMER (allstar), max_star, TY_REAL)
if (DP_ADENOM (allstar) != NULL)
call mfree (DP_ADENOM (allstar), TY_REAL)
call malloc (DP_ADENOM (allstar), max_star, TY_REAL)
if (DP_ARPIXSQ (allstar) != NULL)
call mfree (DP_ARPIXSQ (allstar), TY_REAL)
call malloc (DP_ARPIXSQ (allstar), max_star, TY_REAL)
if (DP_ASUMWT (allstar) != NULL)
call mfree (DP_ASUMWT (allstar), TY_REAL)
call malloc (DP_ASUMWT (allstar), max_star, TY_REAL)
if (DP_ANPIX (allstar) != NULL)
call mfree (DP_ANPIX (allstar), TY_INT)
call malloc (DP_ANPIX (allstar), max_star, TY_INT)
if (DP_AIER (allstar) != NULL)
call mfree (DP_AIER (allstar), TY_INT)
call malloc (DP_AIER (allstar), max_star, TY_INT)
if (DP_ASKIP (allstar) != NULL)
call mfree (DP_ASKIP (allstar), TY_INT)
call malloc (DP_ASKIP (allstar), max_star, TY_INT)
if (DP_ALAST (allstar) != NULL)
call mfree (DP_ALAST (allstar), TY_INT)
call malloc (DP_ALAST (allstar), max_star, TY_INT)
if (DP_AXCLAMP (allstar) != NULL)
call mfree (DP_AXCLAMP (allstar), TY_REAL)
call malloc (DP_AXCLAMP (allstar), max_star, TY_REAL)
if (DP_AYCLAMP (allstar) != NULL)
call mfree (DP_AYCLAMP (allstar), TY_REAL)
call malloc (DP_AYCLAMP (allstar), max_star, TY_REAL)
if (DP_AXOLD (allstar) != NULL)
call mfree (DP_AXOLD (allstar), TY_REAL)
call malloc (DP_AXOLD (allstar), max_star, TY_REAL)
if (DP_AYOLD (allstar) != NULL)
call mfree (DP_AYOLD (allstar), TY_REAL)
call malloc (DP_AYOLD (allstar), max_star, TY_REAL)
# Allocate space for the fitting matrices. Note that nine
# times less space is required if recentering is turned
# off.
if (DP_RECENTER(dao) == YES) {
if (DP_AX (allstar) != NULL)
call mfree (DP_AX (allstar), TY_REAL)
call malloc (DP_AX (allstar), 3 * max_group + 1, TY_REAL)
if (DP_AV (allstar) != NULL)
call mfree (DP_AV (allstar), TY_REAL)
call malloc (DP_AV (allstar), 3 * max_group + 1, TY_REAL)
if (DP_AC (allstar) != NULL)
call mfree (DP_AC (allstar), TY_REAL)
call malloc (DP_AC (allstar), (3 * max_group + 1) *
(3 * max_group + 1), TY_REAL)
} else {
if (DP_AX (allstar) != NULL)
call mfree (DP_AX (allstar), TY_REAL)
call malloc (DP_AX (allstar), max_group + 1, TY_REAL)
if (DP_AV (allstar) != NULL)
call mfree (DP_AV (allstar), TY_REAL)
call malloc (DP_AV (allstar), max_group + 1, TY_REAL)
if (DP_AC (allstar) != NULL)
call mfree (DP_AC (allstar), TY_REAL)
call malloc (DP_AC (allstar), (max_group + 1) * (max_group + 1),
TY_REAL)
}
end
# DP_ALCLOSE -- Procedure to close up the ALLSTAR parameters.
procedure dp_alclose (dp)
pointer dp # pointer to daophot structure
pointer allstar
begin
allstar = DP_ALLSTAR(dp)
if (DP_ANUMER (allstar) != NULL)
call mfree (DP_ANUMER (allstar), TY_REAL)
if (DP_ADENOM (allstar) != NULL)
call mfree (DP_ADENOM (allstar), TY_REAL)
if (DP_ARPIXSQ (allstar) != NULL)
call mfree (DP_ARPIXSQ (allstar), TY_REAL)
if (DP_ASUMWT (allstar) != NULL)
call mfree (DP_ASUMWT (allstar), TY_REAL)
if (DP_ASKIP (allstar) != NULL)
call mfree (DP_ASKIP (allstar), TY_INT)
if (DP_ALAST (allstar) != NULL)
call mfree (DP_ALAST (allstar), TY_INT)
if (DP_AXCLAMP (allstar) != NULL)
call mfree (DP_AXCLAMP (allstar), TY_REAL)
if (DP_AYCLAMP (allstar) != NULL)
call mfree (DP_AYCLAMP (allstar), TY_REAL)
if (DP_AXOLD (allstar) != NULL)
call mfree (DP_AXOLD (allstar), TY_REAL)
if (DP_AYOLD (allstar) != NULL)
call mfree (DP_AYOLD (allstar), TY_REAL)
if (DP_AX (allstar) != NULL)
call mfree (DP_AX (allstar), TY_REAL)
if (DP_AV (allstar) != NULL)
call mfree (DP_AV (allstar), TY_REAL)
if (DP_AC (allstar) != NULL)
call mfree (DP_AC (allstar), TY_REAL)
if (DP_ANPIX (allstar) != NULL)
call mfree (DP_ANPIX (allstar), TY_INT)
if (DP_AIER (allstar) != NULL)
call mfree (DP_AIER (allstar), TY_INT)
call mfree (allstar, TY_STRUCT)
end
|