| 1 |
2 |
bertin |
/*
|
| 2 |
233 |
bertin |
* catout.c
|
| 3 |
2 |
bertin |
*
|
| 4 |
233 |
bertin |
* Functions related to catalogue output.
|
| 5 |
2 |
bertin |
*
|
| 6 |
233 |
bertin |
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
| 7 |
2 |
bertin |
*
|
| 8 |
233 |
bertin |
* This file part of: SExtractor
|
| 9 |
2 |
bertin |
*
|
| 10 |
233 |
bertin |
* Copyright: (C) 1993,1998-2010 IAP/CNRS/UPMC
|
| 11 |
|
|
* (C) 1994,1997 ESO
|
| 12 |
|
|
* (C) 1995,1996 Sterrewacht Leiden
|
| 13 |
2 |
bertin |
*
|
| 14 |
233 |
bertin |
* Author: Emmanuel Bertin (IAP)
|
| 15 |
|
|
*
|
| 16 |
|
|
* License: GNU General Public License
|
| 17 |
|
|
*
|
| 18 |
|
|
* SExtractor is free software: you can redistribute it and/or modify
|
| 19 |
|
|
* it under the terms of the GNU General Public License as published by
|
| 20 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
| 21 |
|
|
* (at your option) any later version.
|
| 22 |
|
|
* SExtractor is distributed in the hope that it will be useful,
|
| 23 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 24 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 25 |
|
|
* GNU General Public License for more details.
|
| 26 |
|
|
* You should have received a copy of the GNU General Public License
|
| 27 |
|
|
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
|
| 28 |
|
|
*
|
| 29 |
|
|
* Last modified: 11/10/2010
|
| 30 |
|
|
*
|
| 31 |
|
|
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
| 32 |
|
|
|
| 33 |
2 |
bertin |
#ifdef HAVE_CONFIG_H
|
| 34 |
|
|
#include "config.h"
|
| 35 |
|
|
#endif
|
| 36 |
|
|
|
| 37 |
|
|
#include <math.h>
|
| 38 |
|
|
#include <stdio.h>
|
| 39 |
|
|
#include <stdlib.h>
|
| 40 |
|
|
#include <string.h>
|
| 41 |
|
|
|
| 42 |
|
|
#include "define.h"
|
| 43 |
|
|
#include "globals.h"
|
| 44 |
|
|
#include "prefs.h"
|
| 45 |
|
|
#include "fits/fitscat.h"
|
| 46 |
|
|
#include "param.h"
|
| 47 |
|
|
#include "sexhead.h"
|
| 48 |
|
|
#include "sexhead1.h"
|
| 49 |
|
|
#include "sexheadsc.h"
|
| 50 |
15 |
bertin |
#include "xml.h"
|
| 51 |
2 |
bertin |
|
| 52 |
|
|
catstruct *fitscat;
|
| 53 |
17 |
bertin |
tabstruct *objtab = NULL;
|
| 54 |
2 |
bertin |
FILE *ascfile;
|
| 55 |
|
|
char *buf;
|
| 56 |
16 |
bertin |
int catopen_flag = 0;
|
| 57 |
2 |
bertin |
|
| 58 |
|
|
/******************************* readcatparams *******************************/
|
| 59 |
|
|
/*
|
| 60 |
|
|
Read the catalog config file
|
| 61 |
|
|
*/
|
| 62 |
|
|
void readcatparams(char *filename)
|
| 63 |
|
|
{
|
| 64 |
|
|
keystruct *key;
|
| 65 |
|
|
FILE *infile;
|
| 66 |
|
|
char str[MAXCHAR], *keyword, *sstr;
|
| 67 |
|
|
int i, size;
|
| 68 |
|
|
|
| 69 |
|
|
/* Prepare the OBJECTS tables*/
|
| 70 |
|
|
objtab = new_tab("OBJECTS");
|
| 71 |
|
|
|
| 72 |
|
|
if ((infile = fopen(filename,"r")) == NULL)
|
| 73 |
|
|
error(EXIT_FAILURE, "*ERROR*: can't read ", filename);
|
| 74 |
|
|
|
| 75 |
|
|
/* Scan the catalog config file*/
|
| 76 |
|
|
thecat.nparam = 0;
|
| 77 |
|
|
while (fgets(str, MAXCHAR, infile))
|
| 78 |
|
|
{
|
| 79 |
|
|
sstr = str + strspn(str," \t");
|
| 80 |
|
|
if (*sstr!=(char)'#' && *sstr!=(char)'\n')
|
| 81 |
|
|
{
|
| 82 |
|
|
keyword = strtok(sstr, " \t{[(\n\r");
|
| 83 |
|
|
if (keyword &&
|
| 84 |
|
|
(i = findkey(keyword,(char *)objkey,sizeof(keystruct)))!=RETURN_ERROR)
|
| 85 |
|
|
{
|
| 86 |
|
|
key = objkey+i;
|
| 87 |
|
|
add_key(key, objtab, 0);
|
| 88 |
|
|
*((char *)key->ptr) = (char)'\1';
|
| 89 |
|
|
thecat.nparam++;
|
| 90 |
|
|
if (key->naxis)
|
| 91 |
|
|
{
|
| 92 |
|
|
for (i=0; i<key->naxis; i++)
|
| 93 |
|
|
key->naxisn[i] = 1;
|
| 94 |
|
|
size=t_size[key->ttype];
|
| 95 |
|
|
for (i=0; (sstr = strtok(NULL, " \t,;.)]}\r")) && *sstr!=(char)'#'
|
| 96 |
|
|
&& *sstr!=(char)'\n'; i++)
|
| 97 |
|
|
{
|
| 98 |
|
|
if (i>=key->naxis)
|
| 99 |
|
|
error(EXIT_FAILURE, "*Error*: too many dimensions for keyword ",
|
| 100 |
|
|
keyword);
|
| 101 |
|
|
if (!(size*=(key->naxisn[i]=atoi(sstr))))
|
| 102 |
|
|
error(EXIT_FAILURE, "*Error*: wrong array syntax for keyword ",
|
| 103 |
|
|
keyword);
|
| 104 |
|
|
}
|
| 105 |
|
|
key->nbytes = size;
|
| 106 |
|
|
}
|
| 107 |
|
|
}
|
| 108 |
|
|
else
|
| 109 |
|
|
warning(keyword, " catalog parameter unknown");
|
| 110 |
|
|
}
|
| 111 |
|
|
}
|
| 112 |
|
|
|
| 113 |
|
|
fclose(infile);
|
| 114 |
|
|
|
| 115 |
|
|
/* Now we copy the flags to the proper structures */
|
| 116 |
|
|
|
| 117 |
|
|
flagobj = outobj;
|
| 118 |
|
|
flagobj2 = outobj2;
|
| 119 |
|
|
/* Differentiate between outobj and outobj2 vectors */
|
| 120 |
|
|
memset(&outobj2, 0, sizeof(outobj2));
|
| 121 |
|
|
updateparamflags();
|
| 122 |
|
|
|
| 123 |
173 |
bertin |
return;
|
| 124 |
|
|
}
|
| 125 |
|
|
|
| 126 |
|
|
|
| 127 |
|
|
/******************************* alloccatparams ******************************/
|
| 128 |
|
|
/*
|
| 129 |
|
|
Allocate memory for parameter arrays
|
| 130 |
|
|
*/
|
| 131 |
|
|
void alloccatparams(void)
|
| 132 |
|
|
{
|
| 133 |
|
|
keystruct *key;
|
| 134 |
|
|
int i;
|
| 135 |
|
|
|
| 136 |
2 |
bertin |
/* Go back to multi-dimensional arrays for memory allocation */
|
| 137 |
|
|
if (thecat.nparam)
|
| 138 |
|
|
for (i=objtab->nkey, key=objtab->key; i--; key = key->nextkey)
|
| 139 |
|
|
if (key->naxis)
|
| 140 |
|
|
{
|
| 141 |
|
|
/*------ Only outobj2 vectors are dynamic */
|
| 142 |
|
|
if (!*((char **)key->ptr))
|
| 143 |
|
|
{
|
| 144 |
|
|
QMALLOC(*((char **)key->ptr), char, key->nbytes);
|
| 145 |
|
|
key->ptr = *((char **)key->ptr);
|
| 146 |
|
|
key->allocflag = 1;
|
| 147 |
|
|
}
|
| 148 |
|
|
}
|
| 149 |
|
|
|
| 150 |
|
|
return;
|
| 151 |
|
|
}
|
| 152 |
|
|
|
| 153 |
173 |
bertin |
/*************************** changecatparamarrays ****************************/
|
| 154 |
|
|
/*
|
| 155 |
|
|
Change parameter array dimensions
|
| 156 |
|
|
*/
|
| 157 |
|
|
void changecatparamarrays(char *keyword, int *axisn, int naxis)
|
| 158 |
|
|
{
|
| 159 |
|
|
keystruct *key;
|
| 160 |
|
|
int d,i, size;
|
| 161 |
2 |
bertin |
|
| 162 |
173 |
bertin |
if (thecat.nparam)
|
| 163 |
|
|
for (i=objtab->nkey, key=objtab->key; i--; key = key->nextkey)
|
| 164 |
|
|
if (key->naxis && !strcmp(keyword, key->name))
|
| 165 |
|
|
{
|
| 166 |
|
|
size = t_size[key->ttype];
|
| 167 |
|
|
if (key->naxis != naxis)
|
| 168 |
|
|
key->naxis = naxis;
|
| 169 |
|
|
for (d=0; d<naxis; d++)
|
| 170 |
|
|
size *= (key->naxisn[d]=axisn[d]);
|
| 171 |
|
|
key->nbytes = size;
|
| 172 |
|
|
break;
|
| 173 |
|
|
}
|
| 174 |
|
|
|
| 175 |
|
|
return;
|
| 176 |
|
|
}
|
| 177 |
|
|
|
| 178 |
2 |
bertin |
/***************************** updateparamflags ******************************/
|
| 179 |
|
|
/*
|
| 180 |
|
|
Update parameter flags according to their mutual dependencies.
|
| 181 |
|
|
*/
|
| 182 |
|
|
void updateparamflags()
|
| 183 |
|
|
|
| 184 |
|
|
{
|
| 185 |
|
|
int i;
|
| 186 |
|
|
|
| 187 |
173 |
bertin |
/*----------------------------- Model-fitting -----------------------------*/
|
| 188 |
|
|
|
| 189 |
|
|
prefs.pattern_flag |= FLAG(obj2.prof_disk_patternvector)
|
| 190 |
|
|
| FLAG(obj2.prof_disk_patternmodvector)
|
| 191 |
|
|
| FLAG(obj2.prof_disk_patternargvector)
|
| 192 |
|
|
| FLAG(obj2.prof_disk_patternspiral);
|
| 193 |
|
|
FLAG(obj2.prof_disk_scale) |= prefs.pattern_flag;
|
| 194 |
|
|
|
| 195 |
209 |
bertin |
FLAG(obj2.prof_concentration) |= FLAG(obj2.prof_concentrationerr);
|
| 196 |
173 |
bertin |
FLAG(obj2.poserraw_prof) |= FLAG(obj2.poserrbw_prof);
|
| 197 |
|
|
FLAG(obj2.poserrcxxw_prof) |= FLAG(obj2.poserrcyyw_prof)
|
| 198 |
|
|
| FLAG(obj2.poserrcxyw_prof);
|
| 199 |
|
|
FLAG(obj2.poserrthetas_prof) |= FLAG(obj2.poserrtheta1950_prof)
|
| 200 |
|
|
| FLAG(obj2.poserrtheta2000_prof);
|
| 201 |
|
|
FLAG(obj2.poserrthetaw_prof) |= FLAG(obj2.poserrthetas_prof);
|
| 202 |
|
|
|
| 203 |
|
|
FLAG(obj2.poserrmx2w_prof) |= FLAG(obj2.poserrmy2w_prof)
|
| 204 |
|
|
| FLAG(obj2.poserrmxyw_prof)
|
| 205 |
|
|
| FLAG(obj2.poserrthetaw_prof)|FLAG(obj2.poserraw_prof)
|
| 206 |
|
|
| FLAG(obj2.poserrcxxw_prof);
|
| 207 |
|
|
|
| 208 |
|
|
FLAG(obj2.poserra_prof) |= FLAG(obj2.poserrb_prof)
|
| 209 |
|
|
| FLAG(obj2.poserrtheta_prof)
|
| 210 |
|
|
| FLAG(obj2.poserraw_prof);
|
| 211 |
|
|
FLAG(obj2.poserrcxx_prof) |= FLAG(obj2.poserrcyy_prof)
|
| 212 |
|
|
| FLAG(obj2.poserrcxy_prof);
|
| 213 |
221 |
bertin |
FLAG(obj2.poserrmx2_prof) |= FLAG(obj2.poserrmy2_prof)
|
| 214 |
|
|
| FLAG(obj2.poserrmxy_prof)
|
| 215 |
|
|
| FLAG(obj2.poserrmx2w_prof);
|
| 216 |
173 |
bertin |
FLAG(obj2.alpha1950_prof) |= FLAG(obj2.delta1950_prof)
|
| 217 |
|
|
| FLAG(obj2.poserrtheta1950_prof);
|
| 218 |
|
|
FLAG(obj2.alpha2000_prof) |= FLAG(obj2.delta2000_prof)
|
| 219 |
|
|
| FLAG(obj2.alpha1950_prof)
|
| 220 |
|
|
| FLAG(obj2.poserrtheta2000_prof);
|
| 221 |
|
|
FLAG(obj2.alphas_prof) |= FLAG(obj2.deltas_prof)
|
| 222 |
|
|
| FLAG(obj2.alpha2000_prof);
|
| 223 |
|
|
FLAG(obj2.xw_prof) |= FLAG(obj2.yw_prof)
|
| 224 |
|
|
| FLAG(obj2.alphas_prof);
|
| 225 |
199 |
bertin |
FLAG(obj2.xf_prof) |= FLAG(obj2.yf_prof);
|
| 226 |
173 |
bertin |
FLAG(obj2.x_prof) |= FLAG(obj2.y_prof)
|
| 227 |
|
|
| FLAG(obj2.xw_prof)
|
| 228 |
199 |
bertin |
| FLAG(obj2.xf_prof)
|
| 229 |
173 |
bertin |
| FLAG(obj2.poserra_prof)
|
| 230 |
179 |
bertin |
| FLAG(obj2.poserrcxx_prof)
|
| 231 |
221 |
bertin |
| FLAG(obj2.poserrmx2_prof)
|
| 232 |
179 |
bertin |
| FLAG(obj2.prof_concentration)
|
| 233 |
|
|
| FLAG(obj2.prof_class_star);
|
| 234 |
199 |
bertin |
|
| 235 |
209 |
bertin |
FLAG(obj2.fluxerr_prof) |= FLAG(obj2.magerr_prof)
|
| 236 |
|
|
| FLAG(obj2.prof_concentrationerr);
|
| 237 |
173 |
bertin |
FLAG(obj2.flux_prof) |= FLAG(obj2.mag_prof) | FLAG(obj2.fluxerr_prof);
|
| 238 |
233 |
bertin |
FLAG(obj2.prof_dirac_mag) |= FLAG(obj2.prof_dirac_magerr);
|
| 239 |
173 |
bertin |
FLAG(obj2.prof_spheroid_mag) |= FLAG(obj2.prof_spheroid_magerr);
|
| 240 |
|
|
FLAG(obj2.prof_spheroid_reff) |= FLAG(obj2.prof_spheroid_refferr);
|
| 241 |
|
|
FLAG(obj2.prof_spheroid_aspect) |= FLAG(obj2.prof_spheroid_aspecterr);
|
| 242 |
|
|
FLAG(obj2.prof_spheroid_theta) |= FLAG(obj2.prof_spheroid_thetaerr);
|
| 243 |
|
|
FLAG(obj2.prof_spheroid_sersicn) |= FLAG(obj2.prof_spheroid_sersicnerr);
|
| 244 |
|
|
FLAG(obj2.prof_disk_mag) |= FLAG(obj2.prof_disk_magerr);
|
| 245 |
|
|
FLAG(obj2.prof_disk_scale) |= FLAG(obj2.prof_disk_scaleerr);
|
| 246 |
|
|
FLAG(obj2.prof_disk_aspect) |= FLAG(obj2.prof_disk_aspecterr);
|
| 247 |
|
|
FLAG(obj2.prof_disk_inclination) |= FLAG(obj2.prof_disk_inclinationerr);
|
| 248 |
|
|
FLAG(obj2.prof_disk_theta) |= FLAG(obj2.prof_disk_thetaerr);
|
| 249 |
|
|
FLAG(obj2.prof_bar_mag) |= FLAG(obj2.prof_bar_magerr);
|
| 250 |
|
|
FLAG(obj2.prof_bar_length) |= FLAG(obj2.prof_bar_lengtherr);
|
| 251 |
|
|
FLAG(obj2.prof_bar_aspect) |= FLAG(obj2.prof_bar_aspecterr);
|
| 252 |
|
|
FLAG(obj2.prof_bar_theta) |= FLAG(obj2.prof_bar_thetaerr);
|
| 253 |
|
|
FLAG(obj2.prof_arms_mag) |= FLAG(obj2.prof_arms_magerr);
|
| 254 |
226 |
bertin |
FLAG(obj2.prof_e1errw) |= FLAG(obj2.prof_e2errw) | FLAG(obj2.prof_e12corrw);
|
| 255 |
|
|
FLAG(obj2.prof_e1w) |= FLAG(obj2.prof_e2w) | FLAG(obj2.prof_e1errw);
|
| 256 |
|
|
FLAG(obj2.prof_pol1errw) |= FLAG(obj2.prof_pol2errw)
|
| 257 |
|
|
| FLAG(obj2.prof_pol12corrw);
|
| 258 |
|
|
FLAG(obj2.prof_pol1w) |= FLAG(obj2.prof_pol2w) | FLAG(obj2.prof_pol1errw);
|
| 259 |
206 |
bertin |
FLAG(obj2.prof_aw) |= FLAG(obj2.prof_bw);
|
| 260 |
|
|
FLAG(obj2.prof_cxxw) |= FLAG(obj2.prof_cyyw) | FLAG(obj2.prof_cxyw);
|
| 261 |
|
|
FLAG(obj2.prof_thetas) |= FLAG(obj2.prof_theta1950)
|
| 262 |
|
|
| FLAG(obj2.prof_theta2000);
|
| 263 |
|
|
FLAG(obj2.prof_thetaw) |= FLAG(obj2.prof_thetas);
|
| 264 |
|
|
|
| 265 |
|
|
FLAG(obj2.prof_mx2w) |= FLAG(obj2.prof_my2w)
|
| 266 |
|
|
| FLAG(obj2.prof_mxyw)
|
| 267 |
|
|
| FLAG(obj2.prof_thetaw) | FLAG(obj2.prof_aw)
|
| 268 |
|
|
| FLAG(obj2.prof_cxxw)
|
| 269 |
225 |
bertin |
| FLAG(obj2.prof_e1w) | FLAG(obj2.prof_pol1w);
|
| 270 |
206 |
bertin |
|
| 271 |
|
|
FLAG(obj2.dtheta1950) |= FLAG(obj2.prof_theta1950)
|
| 272 |
|
|
| FLAG(obj2.prof_spheroid_theta1950)
|
| 273 |
173 |
bertin |
| FLAG(obj2.prof_disk_theta1950)
|
| 274 |
|
|
// | FLAG(obj2.prof_arms_theta1950)
|
| 275 |
|
|
| FLAG(obj2.prof_bar_theta1950)
|
| 276 |
|
|
| FLAG(obj2.poserrtheta1950_psf)
|
| 277 |
|
|
| FLAG(obj2.win_theta1950)
|
| 278 |
|
|
| FLAG(obj2.winposerr_theta1950)
|
| 279 |
|
|
| FLAG(obj2.poserr_theta1950)
|
| 280 |
|
|
| FLAG(obj2.theta1950)
|
| 281 |
|
|
| FLAG(obj2.poserrtheta1950_prof);
|
| 282 |
206 |
bertin |
FLAG(obj2.dtheta2000) |= FLAG(obj2.prof_theta2000)
|
| 283 |
|
|
| FLAG(obj2.prof_spheroid_theta2000)
|
| 284 |
173 |
bertin |
| FLAG(obj2.prof_disk_theta2000)
|
| 285 |
|
|
// | FLAG(obj2.prof_arms_theta2000)
|
| 286 |
|
|
| FLAG(obj2.prof_bar_theta2000)
|
| 287 |
|
|
| FLAG(obj2.poserrtheta2000_psf)
|
| 288 |
|
|
| FLAG(obj2.win_theta2000)
|
| 289 |
|
|
| FLAG(obj2.winposerr_theta2000)
|
| 290 |
|
|
| FLAG(obj2.poserr_theta2000)
|
| 291 |
|
|
| FLAG(obj2.theta2000)
|
| 292 |
|
|
| FLAG(obj2.poserrtheta2000_prof);
|
| 293 |
|
|
|
| 294 |
|
|
|
| 295 |
|
|
FLAG(obj2.prof_spheroid_thetas) |= FLAG(obj2.prof_spheroid_theta2000)
|
| 296 |
|
|
| FLAG(obj2.prof_spheroid_theta1950);
|
| 297 |
|
|
FLAG(obj2.prof_spheroid_thetaw) |= FLAG(obj2.prof_spheroid_thetas);
|
| 298 |
|
|
FLAG(obj2.prof_disk_thetas) |= FLAG(obj2.prof_disk_theta2000)
|
| 299 |
|
|
| FLAG(obj2.prof_disk_theta1950);
|
| 300 |
|
|
FLAG(obj2.prof_disk_thetaw) |= FLAG(obj2.prof_disk_thetas);
|
| 301 |
|
|
FLAG(obj2.prof_bar_thetas) |= FLAG(obj2.prof_bar_theta2000)
|
| 302 |
|
|
| FLAG(obj2.prof_bar_theta1950);
|
| 303 |
|
|
FLAG(obj2.prof_bar_thetaw) |= FLAG(obj2.prof_bar_thetas);
|
| 304 |
|
|
/*
|
| 305 |
|
|
FLAG(obj2.prof_arms_thetaw) |= FLAG(obj2.prof_arms_thetas)
|
| 306 |
|
|
| FLAG(obj2.prof_arms_theta2000)
|
| 307 |
|
|
| FLAG(obj2.prof_arms_theta1950);
|
| 308 |
|
|
*/
|
| 309 |
|
|
FLAG(obj2.prof_arms_scalew) |= FLAG(obj2.prof_arms_startw)
|
| 310 |
|
|
| FLAG(obj2.prof_arms_scaleerrw)
|
| 311 |
|
|
| FLAG(obj2.prof_arms_starterrw);
|
| 312 |
|
|
|
| 313 |
|
|
FLAG(obj2.prof_bar_lengthw) |= FLAG(obj2.prof_bar_aspectw)
|
| 314 |
|
|
| FLAG(obj2.prof_bar_thetaw)
|
| 315 |
|
|
| FLAG(obj2.prof_bar_lengtherrw)
|
| 316 |
|
|
| FLAG(obj2.prof_bar_aspecterrw)
|
| 317 |
|
|
| FLAG(obj2.prof_bar_thetaerrw);
|
| 318 |
|
|
|
| 319 |
|
|
FLAG(obj2.prof_disk_scalew) |= FLAG(obj2.prof_disk_aspectw)
|
| 320 |
|
|
| FLAG(obj2.prof_disk_thetaw)
|
| 321 |
|
|
| FLAG(obj2.prof_disk_scaleerrw)
|
| 322 |
|
|
| FLAG(obj2.prof_disk_aspecterrw)
|
| 323 |
|
|
| FLAG(obj2.prof_disk_thetaerrw)
|
| 324 |
|
|
| FLAG(obj2.prof_arms_scalew);
|
| 325 |
207 |
bertin |
FLAG(obj2.prof_disk_fluxmean) |= FLAG(obj2.prof_disk_mumean);
|
| 326 |
206 |
bertin |
FLAG(obj2.prof_disk_fluxeff) |= FLAG(obj2.prof_disk_mueff);
|
| 327 |
|
|
FLAG(obj2.prof_disk_peak) |= FLAG(obj2.prof_disk_mumax)
|
| 328 |
207 |
bertin |
| FLAG(obj2.prof_disk_fluxeff)
|
| 329 |
|
|
| FLAG(obj2.prof_disk_fluxmean);
|
| 330 |
173 |
bertin |
|
| 331 |
|
|
FLAG(obj2.prof_spheroid_reffw) |= FLAG(obj2.prof_spheroid_aspectw)
|
| 332 |
|
|
| FLAG(obj2.prof_spheroid_thetaw)
|
| 333 |
|
|
| FLAG(obj2.prof_spheroid_refferrw)
|
| 334 |
|
|
| FLAG(obj2.prof_spheroid_aspecterrw)
|
| 335 |
|
|
| FLAG(obj2.prof_spheroid_thetaerrw);
|
| 336 |
|
|
|
| 337 |
207 |
bertin |
FLAG(obj2.prof_spheroid_fluxmean) |= FLAG(obj2.prof_spheroid_mumean);
|
| 338 |
206 |
bertin |
FLAG(obj2.prof_spheroid_fluxeff) |= FLAG(obj2.prof_spheroid_mueff);
|
| 339 |
|
|
FLAG(obj2.prof_spheroid_peak) |= FLAG(obj2.prof_spheroid_mumax)
|
| 340 |
207 |
bertin |
| FLAG(obj2.prof_spheroid_fluxeff)
|
| 341 |
|
|
| FLAG(obj2.prof_spheroid_fluxmean);
|
| 342 |
206 |
bertin |
|
| 343 |
173 |
bertin |
FLAG(obj2.prof_flagw) |= FLAG(obj2.prof_spheroid_reffw)
|
| 344 |
|
|
| FLAG(obj2.prof_disk_scalew)
|
| 345 |
|
|
| FLAG(obj2.prof_bar_lengthw)
|
| 346 |
206 |
bertin |
| FLAG(obj2.prof_arms_scalew)
|
| 347 |
|
|
| FLAG(obj2.prof_mx2w);
|
| 348 |
225 |
bertin |
|
| 349 |
226 |
bertin |
FLAG(obj2.prof_e1err) |= FLAG(obj2.prof_e2err) | FLAG(obj2.prof_e12corr)
|
| 350 |
|
|
| FLAG(obj2.prof_e1errw);
|
| 351 |
173 |
bertin |
|
| 352 |
206 |
bertin |
FLAG(obj2.prof_e1) |= FLAG(obj2.prof_e2)
|
| 353 |
226 |
bertin |
| FLAG(obj2.prof_e1err) | FLAG(obj2.prof_e1w);
|
| 354 |
|
|
FLAG(obj2.prof_pol1err) |= FLAG(obj2.prof_pol2err)
|
| 355 |
|
|
| FLAG(obj2.prof_pol12corr) | FLAG(obj2.prof_pol1errw);
|
| 356 |
225 |
bertin |
FLAG(obj2.prof_pol1) |= FLAG(obj2.prof_pol2)
|
| 357 |
226 |
bertin |
| FLAG(obj2.prof_pol1err) | FLAG(obj2.prof_pol1w);
|
| 358 |
206 |
bertin |
FLAG(obj2.prof_a) |= FLAG(obj2.prof_b) | FLAG(obj2.prof_theta)
|
| 359 |
|
|
| FLAG(obj2.prof_aw);
|
| 360 |
|
|
FLAG(obj2.prof_cxx) |= FLAG(obj2.prof_cyy)
|
| 361 |
|
|
| FLAG(obj2.prof_cxy) | FLAG(obj2.prof_cxxw);
|
| 362 |
173 |
bertin |
FLAG(obj2.prof_mx2) |= FLAG(obj2.prof_my2) | FLAG(obj2.prof_mxy)
|
| 363 |
225 |
bertin |
| FLAG(obj2.prof_e1) | FLAG(obj2.prof_pol1)
|
| 364 |
206 |
bertin |
| FLAG(obj2.prof_a) | FLAG(obj2.prof_cxx)
|
| 365 |
|
|
| FLAG(obj2.prof_mx2w);
|
| 366 |
207 |
bertin |
FLAG(obj2.fluxmean_prof) |= FLAG(obj2.mumean_prof);
|
| 367 |
|
|
FLAG(obj2.fluxeff_prof) |= FLAG(obj2.mueff_prof)
|
| 368 |
|
|
| FLAG(obj2.fluxmean_prof);
|
| 369 |
221 |
bertin |
FLAG(obj2.peak_prof) |= FLAG(obj2.mumax_prof);
|
| 370 |
206 |
bertin |
|
| 371 |
173 |
bertin |
FLAG(obj2.prof_arms_flux) |= FLAG(obj2.prof_arms_fluxerr)
|
| 372 |
|
|
| FLAG(obj2.prof_arms_mag)
|
| 373 |
|
|
| FLAG(obj2.prof_arms_scalew)
|
| 374 |
|
|
| FLAG(obj2.prof_arms_scale)
|
| 375 |
|
|
| FLAG(obj2.prof_arms_posang)
|
| 376 |
|
|
| FLAG(obj2.prof_arms_pitch)
|
| 377 |
|
|
| FLAG(obj2.prof_arms_start)
|
| 378 |
|
|
| FLAG(obj2.prof_arms_quadfrac);
|
| 379 |
|
|
FLAG(obj2.prof_bar_theta) |= FLAG(obj2.prof_bar_lengthw);
|
| 380 |
|
|
FLAG(obj2.prof_bar_flux) |= FLAG(obj2.prof_bar_fluxerr)
|
| 381 |
|
|
| FLAG(obj2.prof_bar_mag)
|
| 382 |
|
|
| FLAG(obj2.prof_bar_lengthw)
|
| 383 |
|
|
| FLAG(obj2.prof_bar_length)
|
| 384 |
|
|
| FLAG(obj2.prof_bar_aspect)
|
| 385 |
|
|
| FLAG(obj2.prof_bar_posang)
|
| 386 |
|
|
| FLAG(obj2.prof_bar_theta)
|
| 387 |
|
|
| FLAG(obj2.prof_arms_flux);
|
| 388 |
|
|
FLAG(obj2.prof_disk_flux) |= FLAG(obj2.prof_disk_fluxerr)
|
| 389 |
|
|
| FLAG(obj2.prof_disk_mag)
|
| 390 |
|
|
| FLAG(obj2.prof_disk_scalew)
|
| 391 |
|
|
| FLAG(obj2.prof_disk_scale)
|
| 392 |
|
|
| FLAG(obj2.prof_disk_aspect)
|
| 393 |
|
|
| FLAG(obj2.prof_disk_inclination)
|
| 394 |
|
|
| FLAG(obj2.prof_disk_theta)
|
| 395 |
206 |
bertin |
| FLAG(obj2.prof_disk_peak)
|
| 396 |
173 |
bertin |
| FLAG(obj2.prof_bar_flux);
|
| 397 |
|
|
FLAG(obj2.prof_spheroid_flux) |= FLAG(obj2.prof_spheroid_fluxerr)
|
| 398 |
|
|
| FLAG(obj2.prof_spheroid_mag)
|
| 399 |
|
|
| FLAG(obj2.prof_spheroid_reffw)
|
| 400 |
|
|
| FLAG(obj2.prof_spheroid_reff)
|
| 401 |
|
|
| FLAG(obj2.prof_spheroid_aspect)
|
| 402 |
|
|
| FLAG(obj2.prof_spheroid_theta)
|
| 403 |
206 |
bertin |
| FLAG(obj2.prof_spheroid_sersicn)
|
| 404 |
|
|
| FLAG(obj2.prof_spheroid_peak);
|
| 405 |
233 |
bertin |
FLAG(obj2.prof_dirac_flux) |= FLAG(obj2.prof_dirac_fluxerr)
|
| 406 |
|
|
| FLAG(obj2.prof_dirac_mag);
|
| 407 |
|
|
FLAG(obj2.prof_offset_flux) |= FLAG(obj2.prof_offset_fluxerr);
|
| 408 |
173 |
bertin |
prefs.prof_flag |= FLAG(obj2.prof_chi2) | FLAG(obj2.prof_niter)
|
| 409 |
|
|
| FLAG(obj2.prof_vector) | FLAG(obj2.prof_errvector)
|
| 410 |
208 |
bertin |
| FLAG(obj2.prof_errmatrix)
|
| 411 |
173 |
bertin |
| FLAG(obj2.x_prof) | FLAG(obj2.y_prof)
|
| 412 |
211 |
bertin |
| FLAG(obj2.prof_flag)
|
| 413 |
|
|
| FLAG(obj2.flux_prof)
|
| 414 |
173 |
bertin |
| FLAG(obj2.prof_mx2)
|
| 415 |
207 |
bertin |
| FLAG(obj2.peak_prof)
|
| 416 |
173 |
bertin |
| FLAG(obj2.prof_disk_flux)
|
| 417 |
233 |
bertin |
| FLAG(obj2.prof_spheroid_flux)
|
| 418 |
|
|
| FLAG(obj2.prof_dirac_flux)
|
| 419 |
|
|
| FLAG(obj2.prof_offset_flux);
|
| 420 |
173 |
bertin |
|
| 421 |
|
|
|
| 422 |
|
|
/* If only global parameters are requested, fit a Sersic model */
|
| 423 |
|
|
if (prefs.prof_flag && !(FLAG(obj2.prof_spheroid_flux)
|
| 424 |
233 |
bertin |
| FLAG(obj2.prof_disk_flux)
|
| 425 |
|
|
| FLAG(obj2.prof_dirac_flux)
|
| 426 |
|
|
| FLAG(obj2.prof_offset_flux)))
|
| 427 |
173 |
bertin |
{
|
| 428 |
|
|
FLAG(obj2.prof_spheroid_flux) |= prefs.prof_flag;
|
| 429 |
|
|
FLAG(obj2.prof_spheroid_sersicn) |= prefs.prof_flag;
|
| 430 |
|
|
}
|
| 431 |
|
|
|
| 432 |
|
|
|
| 433 |
2 |
bertin |
/*------------------------------ Astrometry ---------------------------------*/
|
| 434 |
|
|
FLAG(obj2.win_aw) |= FLAG(obj2.win_bw) | FLAG(obj2.win_polarw);
|
| 435 |
|
|
FLAG(obj2.win_cxxw) |= FLAG(obj2.win_cyyw) | FLAG(obj2.win_cxyw);
|
| 436 |
|
|
FLAG(obj2.win_thetas) |= FLAG(obj2.win_theta1950)
|
| 437 |
|
|
| FLAG(obj2.win_theta2000);
|
| 438 |
|
|
FLAG(obj2.win_thetaw) |= FLAG(obj2.win_thetas);
|
| 439 |
|
|
|
| 440 |
|
|
FLAG(obj2.win_mx2w) |= FLAG(obj2.win_my2w)
|
| 441 |
|
|
| FLAG(obj2.win_mxyw)
|
| 442 |
|
|
| FLAG(obj2.win_thetaw) | FLAG(obj2.win_aw)
|
| 443 |
|
|
| FLAG(obj2.win_cxxw);
|
| 444 |
|
|
|
| 445 |
|
|
FLAG(obj2.win_a) |= FLAG(obj2.win_b) | FLAG(obj2.win_theta)
|
| 446 |
3 |
bertin |
| FLAG(obj2.win_polar) | FLAG(obj2.win_aw);
|
| 447 |
2 |
bertin |
FLAG(obj2.win_cxx) |= FLAG(obj2.win_cyy)
|
| 448 |
3 |
bertin |
| FLAG(obj2.win_cxy) | FLAG(obj2.win_cxxw);
|
| 449 |
2 |
bertin |
FLAG(obj2.win_mx2) |= FLAG(obj2.win_my2)
|
| 450 |
|
|
| FLAG(obj2.win_mxy)
|
| 451 |
|
|
| FLAG(obj2.win_a) | FLAG(obj2.win_cxx)
|
| 452 |
|
|
| FLAG(obj2.win_mx2w);
|
| 453 |
|
|
|
| 454 |
|
|
FLAG(obj2.winposerr_aw) |= FLAG(obj2.winposerr_bw);
|
| 455 |
|
|
FLAG(obj2.winposerr_cxxw) |= FLAG(obj2.winposerr_cyyw)
|
| 456 |
|
|
| FLAG(obj2.winposerr_cxyw);
|
| 457 |
|
|
FLAG(obj2.winposerr_thetas) |= FLAG(obj2.winposerr_theta1950)
|
| 458 |
|
|
| FLAG(obj2.winposerr_theta2000);
|
| 459 |
|
|
FLAG(obj2.winposerr_thetaw) |= FLAG(obj2.winposerr_thetas);
|
| 460 |
|
|
|
| 461 |
|
|
FLAG(obj2.winposerr_mx2w) |= FLAG(obj2.winposerr_my2w)
|
| 462 |
|
|
| FLAG(obj2.winposerr_mxyw)
|
| 463 |
|
|
| FLAG(obj2.winposerr_thetaw) | FLAG(obj2.winposerr_aw)
|
| 464 |
|
|
| FLAG(obj2.winposerr_cxxw);
|
| 465 |
|
|
|
| 466 |
|
|
FLAG(obj2.winposerr_a) |= FLAG(obj2.winposerr_b) | FLAG(obj2.winposerr_theta);
|
| 467 |
|
|
FLAG(obj2.winposerr_cxx) |= FLAG(obj2.winposerr_cyy)
|
| 468 |
|
|
| FLAG(obj2.winposerr_cxy);
|
| 469 |
|
|
FLAG(obj2.winposerr_mx2) |= FLAG(obj2.winposerr_my2)
|
| 470 |
|
|
| FLAG(obj2.winposerr_mxy)
|
| 471 |
|
|
| FLAG(obj2.winposerr_a) | FLAG(obj2.winposerr_cxx)
|
| 472 |
224 |
bertin |
| FLAG(obj2.winposerr_mx2w)
|
| 473 |
|
|
| FLAG(obj2.fluxerr_win) | FLAG(obj2.magerr_win);
|
| 474 |
2 |
bertin |
|
| 475 |
|
|
FLAG(obj2.winpos_alpha1950) |= FLAG(obj2.winpos_delta1950)
|
| 476 |
|
|
| FLAG(obj2.win_theta1950)
|
| 477 |
|
|
| FLAG(obj2.winposerr_theta1950);
|
| 478 |
|
|
FLAG(obj2.winpos_alpha2000) |= FLAG(obj2.winpos_delta2000)
|
| 479 |
|
|
| FLAG(obj2.winpos_alpha1950)
|
| 480 |
|
|
| FLAG(obj2.win_theta2000)
|
| 481 |
|
|
| FLAG(obj2.winposerr_theta2000);
|
| 482 |
|
|
FLAG(obj2.winpos_alphas) |= FLAG(obj2.winpos_deltas)
|
| 483 |
|
|
| FLAG(obj2.winpos_alpha2000);
|
| 484 |
199 |
bertin |
FLAG(obj2.winpos_xf) |= FLAG(obj2.winpos_yf);
|
| 485 |
2 |
bertin |
FLAG(obj2.winpos_xw) |= FLAG(obj2.winpos_yw)
|
| 486 |
|
|
| FLAG(obj2.winpos_alphas);
|
| 487 |
|
|
|
| 488 |
|
|
FLAG(obj2.poserr_aw) |= FLAG(obj2.poserr_bw);
|
| 489 |
|
|
FLAG(obj2.poserr_cxxw) |= FLAG(obj2.poserr_cyyw) | FLAG(obj2.poserr_cxyw);
|
| 490 |
|
|
FLAG(obj2.poserr_thetas) |= FLAG(obj2.poserr_theta1950)
|
| 491 |
|
|
| FLAG(obj2.poserr_theta2000);
|
| 492 |
|
|
FLAG(obj2.poserr_thetaw) |= FLAG(obj2.poserr_thetas);
|
| 493 |
|
|
|
| 494 |
|
|
FLAG(obj2.poserr_mx2w) |= FLAG(obj2.poserr_my2w) | FLAG(obj2.poserr_mxyw)
|
| 495 |
|
|
| FLAG(obj2.poserr_thetaw) | FLAG(obj2.poserr_aw)
|
| 496 |
|
|
| FLAG(obj2.poserr_cxxw);
|
| 497 |
|
|
|
| 498 |
3 |
bertin |
FLAG(obj2.poserr_a) |= FLAG(obj2.poserr_b) | FLAG(obj2.poserr_theta)
|
| 499 |
|
|
| FLAG(obj2.winposerr_a);
|
| 500 |
2 |
bertin |
FLAG(obj2.poserr_cxx) |= FLAG(obj2.poserr_cyy) | FLAG(obj2.poserr_cxy);
|
| 501 |
|
|
FLAG(obj.poserr_mx2) |= FLAG(obj.poserr_my2) | FLAG(obj.poserr_mxy)
|
| 502 |
|
|
| FLAG(obj2.poserr_a) | FLAG(obj2.poserr_cxx)
|
| 503 |
3 |
bertin |
| FLAG(obj2.poserr_mx2w) | FLAG(obj2.winposerr_mx2);
|
| 504 |
2 |
bertin |
|
| 505 |
|
|
FLAG(obj2.peakalpha1950) |= FLAG(obj2.peakdelta1950);
|
| 506 |
|
|
FLAG(obj2.alpha1950) |= FLAG(obj2.delta1950) | FLAG(obj2.theta1950)
|
| 507 |
173 |
bertin |
| FLAG(obj2.poserr_theta1950) | FLAG(obj2.dtheta1950);
|
| 508 |
|
|
;
|
| 509 |
2 |
bertin |
FLAG(obj2.peakalpha2000) |= FLAG(obj2.peakdelta2000)
|
| 510 |
|
|
| FLAG(obj2.peakalpha1950);
|
| 511 |
|
|
FLAG(obj2.alpha2000) |= FLAG(obj2.delta2000) | FLAG(obj2.alpha1950)
|
| 512 |
173 |
bertin |
| FLAG(obj2.dtheta2000);
|
| 513 |
2 |
bertin |
FLAG(obj2.peakalphas) |= FLAG(obj2.peakdeltas) | FLAG(obj2.peakalpha2000);
|
| 514 |
|
|
FLAG(obj2.alphas) |= FLAG(obj2.deltas) | FLAG(obj2.alpha2000);
|
| 515 |
|
|
FLAG(obj2.thetas) |= FLAG(obj2.theta1950) | FLAG(obj2.theta2000);
|
| 516 |
|
|
FLAG(obj2.thetaw) |= FLAG(obj2.thetas);
|
| 517 |
|
|
FLAG(obj2.aw) |= FLAG(obj2.bw) | FLAG(obj2.polarw);
|
| 518 |
|
|
FLAG(obj2.cxxw) |= FLAG(obj2.cyyw) | FLAG(obj2.cxyw);
|
| 519 |
|
|
|
| 520 |
|
|
FLAG(obj2.mx2w) |= FLAG(obj2.my2w) | FLAG(obj2.mxyw)
|
| 521 |
206 |
bertin |
| FLAG(obj2.thetaw) | FLAG(obj2.aw) | FLAG(obj2.cxxw);
|
| 522 |
2 |
bertin |
|
| 523 |
199 |
bertin |
FLAG(obj2.peakxw) |= FLAG(obj2.peakyf);
|
| 524 |
2 |
bertin |
FLAG(obj2.peakxw) |= FLAG(obj2.peakyw) | FLAG(obj2.peakalphas);
|
| 525 |
199 |
bertin |
FLAG(obj.peakx) |= FLAG(obj.peaky) | FLAG(obj2.peakxw) | FLAG(obj2.peakxf);
|
| 526 |
2 |
bertin |
|
| 527 |
199 |
bertin |
FLAG(obj2.mxf) |= FLAG(obj2.myf);
|
| 528 |
|
|
|
| 529 |
2 |
bertin |
FLAG(obj2.mxw) |= FLAG(obj2.myw) | FLAG(obj2.mx2w) | FLAG(obj2.alphas)
|
| 530 |
|
|
| FLAG(obj2.poserr_mx2w);
|
| 531 |
|
|
FLAG(obj2.mamaposx) |= FLAG(obj2.mamaposy);
|
| 532 |
|
|
FLAG(obj2.flux_win) |= FLAG(obj2.mag_win)|FLAG(obj2.magerr_win)
|
| 533 |
|
|
| FLAG(obj2.flux_win) | FLAG(obj2.fluxerr_win);
|
| 534 |
|
|
FLAG(obj2.winpos_x) |= FLAG(obj2.winpos_y)
|
| 535 |
|
|
| FLAG(obj2.winposerr_mx2) | FLAG(obj2.win_mx2)
|
| 536 |
199 |
bertin |
| FLAG(obj2.winpos_xw) | FLAG(obj2.winpos_xf)
|
| 537 |
|
|
| FLAG(obj2.win_flag)
|
| 538 |
2 |
bertin |
| FLAG(obj2.flux_win) |FLAG(obj2.winpos_niter);
|
| 539 |
|
|
|
| 540 |
206 |
bertin |
FLAG(obj2.area_flagw) |= FLAG(obj2.npixw) | FLAG(obj2.fdnpixw)
|
| 541 |
|
|
| FLAG(obj2.fwhmw)
|
| 542 |
|
|
| FLAG(obj2.maxmu) | FLAG(obj2.threshmu)
|
| 543 |
|
|
| FLAG(obj2.prof_spheroid_mumax)
|
| 544 |
207 |
bertin |
| FLAG(obj2.prof_disk_mumax)
|
| 545 |
|
|
| FLAG(obj2.mumax_prof);
|
| 546 |
206 |
bertin |
|
| 547 |
2 |
bertin |
/*------------------------------ Photometry ---------------------------------*/
|
| 548 |
|
|
|
| 549 |
|
|
FLAG(obj2.fluxerr_best) |= FLAG(obj2.magerr_best);
|
| 550 |
|
|
|
| 551 |
|
|
FLAG(obj2.flux_best) |= FLAG(obj2.mag_best) | FLAG(obj2.fluxerr_best);
|
| 552 |
|
|
|
| 553 |
173 |
bertin |
FLAG(obj2.hl_radius) |= FLAG(obj2.winpos_x) | prefs.prof_flag;
|
| 554 |
2 |
bertin |
|
| 555 |
|
|
FLAG(obj2.flux_auto) |= FLAG(obj2.mag_auto) | FLAG(obj2.magerr_auto)
|
| 556 |
|
|
| FLAG(obj2.fluxerr_auto)
|
| 557 |
|
|
| FLAG(obj2.kronfactor)
|
| 558 |
|
|
| FLAG(obj2.flux_best)
|
| 559 |
|
|
| FLAG(obj2.flux_radius)
|
| 560 |
|
|
| FLAG(obj2.hl_radius);
|
| 561 |
|
|
FLAG(obj2.flux_petro) |= FLAG(obj2.mag_petro) | FLAG(obj2.magerr_petro)
|
| 562 |
|
|
| FLAG(obj2.fluxerr_petro)
|
| 563 |
|
|
| FLAG(obj2.petrofactor);
|
| 564 |
|
|
|
| 565 |
|
|
FLAG(obj2.fluxerr_isocor) |= FLAG(obj2.magerr_isocor)
|
| 566 |
|
|
| FLAG(obj2.fluxerr_best);
|
| 567 |
|
|
|
| 568 |
|
|
FLAG(obj2.flux_isocor) |= FLAG(obj2.mag_isocor) | FLAG(obj2.fluxerr_isocor)
|
| 569 |
|
|
| FLAG(obj2.flux_best);
|
| 570 |
|
|
|
| 571 |
|
|
FLAG(obj2.flux_aper) |= FLAG(obj2.mag_aper)|FLAG(obj2.magerr_aper)
|
| 572 |
|
|
| FLAG(obj2.fluxerr_aper);
|
| 573 |
|
|
|
| 574 |
|
|
FLAG(obj2.flux_galfit) |= FLAG(obj2.mag_galfit) | FLAG(obj2.magerr_galfit)
|
| 575 |
|
|
| FLAG(obj2.fluxerr_galfit);
|
| 576 |
|
|
|
| 577 |
|
|
/*---------------------------- External flags -------------------------------*/
|
| 578 |
|
|
VECFLAG(obj.imaflag) |= VECFLAG(obj.imanflag);
|
| 579 |
|
|
|
| 580 |
|
|
/*------------------------------ PSF-fitting --------------------------------*/
|
| 581 |
|
|
FLAG(obj2.poserraw_psf) |= FLAG(obj2.poserrbw_psf);
|
| 582 |
|
|
FLAG(obj2.poserrcxxw_psf) |= FLAG(obj2.poserrcyyw_psf)
|
| 583 |
|
|
| FLAG(obj2.poserrcxyw_psf);
|
| 584 |
|
|
FLAG(obj2.poserrthetas_psf) |= FLAG(obj2.poserrtheta1950_psf)
|
| 585 |
|
|
| FLAG(obj2.poserrtheta2000_psf);
|
| 586 |
|
|
FLAG(obj2.poserrthetaw_psf) |= FLAG(obj2.poserrthetas_psf);
|
| 587 |
|
|
|
| 588 |
|
|
FLAG(obj2.poserrmx2w_psf) |= FLAG(obj2.poserrmy2w_psf)
|
| 589 |
|
|
| FLAG(obj2.poserrmxyw_psf)
|
| 590 |
|
|
| FLAG(obj2.poserrthetaw_psf) | FLAG(obj2.poserraw_psf)
|
| 591 |
|
|
| FLAG(obj2.poserrcxxw_psf);
|
| 592 |
|
|
|
| 593 |
|
|
FLAG(obj2.poserra_psf) |= FLAG(obj2.poserrb_psf)
|
| 594 |
|
|
| FLAG(obj2.poserrtheta_psf);
|
| 595 |
|
|
FLAG(obj2.poserrcxx_psf) |= FLAG(obj2.poserrcyy_psf)
|
| 596 |
|
|
| FLAG(obj2.poserrcxy_psf);
|
| 597 |
|
|
FLAG(obj2.poserrmx2_psf) |= FLAG(obj2.poserrmy2_psf)
|
| 598 |
|
|
| FLAG(obj2.poserrmxy_psf)
|
| 599 |
|
|
| FLAG(obj2.poserra_psf) | FLAG(obj2.poserrcxx_psf)
|
| 600 |
|
|
| FLAG(obj2.poserrmx2w_psf);
|
| 601 |
|
|
|
| 602 |
|
|
FLAG(obj2.alpha1950_psf) |= FLAG(obj2.delta1950_psf)
|
| 603 |
|
|
| FLAG(obj2.poserrtheta1950_psf);
|
| 604 |
|
|
FLAG(obj2.alpha2000_psf) |= FLAG(obj2.delta2000_psf)
|
| 605 |
|
|
| FLAG(obj2.alpha1950_psf)
|
| 606 |
|
|
| FLAG(obj2.poserrtheta2000_psf);
|
| 607 |
|
|
FLAG(obj2.alphas_psf) |= FLAG(obj2.deltas_psf) | FLAG(obj2.alpha2000_psf);
|
| 608 |
|
|
|
| 609 |
|
|
FLAG(obj2.xw_psf) |= FLAG(obj2.yw_psf) | FLAG(obj2.poserrmx2w_psf)
|
| 610 |
|
|
| FLAG(obj2.alphas_psf);
|
| 611 |
|
|
|
| 612 |
|
|
FLAG(obj2.fluxerr_psf) |= FLAG(obj2.poserrmx2_psf) | FLAG(obj2.magerr_psf);
|
| 613 |
|
|
|
| 614 |
|
|
FLAG(obj2.mx2_pc) |= FLAG(obj2.my2_pc) | FLAG(obj2.mxy_pc)
|
| 615 |
|
|
| FLAG(obj2.a_pc) | FLAG(obj2.b_pc)
|
| 616 |
|
|
| FLAG(obj2.theta_pc) | FLAG(obj2.vector_pc)
|
| 617 |
|
|
| FLAG(obj2.gdposang) | FLAG(obj2.gdscale)
|
| 618 |
|
|
| FLAG(obj2.gdaspect) | FLAG(obj2.flux_galfit)
|
| 619 |
|
|
| FLAG(obj2.gde1) | FLAG(obj2.gde2)
|
| 620 |
|
|
| FLAG(obj2.gbposang) | FLAG(obj2.gbscale)
|
| 621 |
|
|
| FLAG(obj2.gbaspect) | FLAG(obj2.gbratio);
|
| 622 |
|
|
|
| 623 |
|
|
FLAG(obj2.flux_psf) |= FLAG(obj2.mag_psf) | FLAG(obj2.x_psf)
|
| 624 |
|
|
| FLAG(obj2.y_psf) | FLAG(obj2.xw_psf)
|
| 625 |
|
|
| FLAG(obj2.fluxerr_psf)
|
| 626 |
|
|
| FLAG(obj2.niter_psf)
|
| 627 |
|
|
| FLAG(obj2.chi2_psf)
|
| 628 |
|
|
| FLAG(obj2.mx2_pc);
|
| 629 |
|
|
|
| 630 |
|
|
/*-------------------------------- Others -----------------------------------*/
|
| 631 |
|
|
FLAG(obj.fwhm) |= FLAG(obj2.fwhmw);
|
| 632 |
|
|
|
| 633 |
|
|
FLAG(obj.iso[0]) |= FLAG(obj2.sprob);
|
| 634 |
|
|
for (i=0; i<NISO; i++)
|
| 635 |
|
|
FLAG(obj.iso[0]) |= FLAG(obj.iso[i]);
|
| 636 |
|
|
|
| 637 |
210 |
bertin |
FLAG(obj.wflag) |= FLAG(obj.nzwpix) | FLAG(obj.nzdwpix);
|
| 638 |
|
|
|
| 639 |
2 |
bertin |
return;
|
| 640 |
|
|
}
|
| 641 |
|
|
|
| 642 |
|
|
|
| 643 |
173 |
bertin |
/********************************** dumpparams *******************************/
|
| 644 |
|
|
/*
|
| 645 |
|
|
Initialize the catalog header
|
| 646 |
|
|
*/
|
| 647 |
|
|
void dumpparams(void)
|
| 648 |
|
|
{
|
| 649 |
|
|
int i;
|
| 650 |
|
|
|
| 651 |
|
|
for (i=0; *objkey[i].name ; i++)
|
| 652 |
|
|
if (*objkey[i].unit)
|
| 653 |
209 |
bertin |
printf("#%-24.24s %-57.57s [%s]\n",
|
| 654 |
173 |
bertin |
objkey[i].name, objkey[i].comment, objkey[i].unit);
|
| 655 |
|
|
else
|
| 656 |
209 |
bertin |
printf("#%-24.24s %-57.57s\n",
|
| 657 |
173 |
bertin |
objkey[i].name, objkey[i].comment);
|
| 658 |
|
|
|
| 659 |
|
|
return;
|
| 660 |
|
|
}
|
| 661 |
|
|
|
| 662 |
|
|
|
| 663 |
2 |
bertin |
/********************************** initcat **********************************/
|
| 664 |
|
|
/*
|
| 665 |
|
|
Initialize the catalog header
|
| 666 |
|
|
*/
|
| 667 |
|
|
void initcat(void)
|
| 668 |
|
|
{
|
| 669 |
|
|
keystruct *key;
|
| 670 |
17 |
bertin |
int i, n;
|
| 671 |
2 |
bertin |
|
| 672 |
|
|
if (prefs.cat_type == CAT_NONE)
|
| 673 |
|
|
return;
|
| 674 |
|
|
|
| 675 |
17 |
bertin |
update_tab(objtab);
|
| 676 |
11 |
bertin |
if (prefs.cat_type == ASCII_HEAD || prefs.cat_type == ASCII ||
|
| 677 |
|
|
prefs.cat_type == ASCII_SKYCAT || prefs.cat_type == ASCII_VO)
|
| 678 |
2 |
bertin |
{
|
| 679 |
|
|
if (prefs.pipe_flag)
|
| 680 |
|
|
ascfile = stdout;
|
| 681 |
|
|
else
|
| 682 |
|
|
if (!(ascfile = fopen(prefs.cat_name, "w+")))
|
| 683 |
|
|
error(EXIT_FAILURE,"*Error*: cannot open ", prefs.cat_name);
|
| 684 |
206 |
bertin |
// setlinebuf(ascfile);
|
| 685 |
2 |
bertin |
if (prefs.cat_type == ASCII_HEAD && (key = objtab->key))
|
| 686 |
|
|
for (i=0,n=1; i++<objtab->nkey; key=key->nextkey)
|
| 687 |
|
|
{
|
| 688 |
|
|
if (*key->unit)
|
| 689 |
173 |
bertin |
fprintf(ascfile, "# %3d %-22.22s %-58.58s [%s]\n",
|
| 690 |
2 |
bertin |
n, key->name,key->comment, key->unit);
|
| 691 |
|
|
else
|
| 692 |
173 |
bertin |
fprintf(ascfile, "# %3d %-22.22s %-58.58s\n",
|
| 693 |
2 |
bertin |
n, key->name,key->comment);
|
| 694 |
|
|
n += key->nbytes/t_size[key->ttype];
|
| 695 |
|
|
}
|
| 696 |
|
|
else if (prefs.cat_type == ASCII_SKYCAT && (key = objtab->key))
|
| 697 |
|
|
{
|
| 698 |
|
|
if (objtab->nkey<3)
|
| 699 |
|
|
error(EXIT_FAILURE,"The SkyCat format requires at least 4 parameters:",
|
| 700 |
|
|
" Id Ra Dec Mag");
|
| 701 |
|
|
/*--- We add a tab between rows, as required by Skycat */
|
| 702 |
|
|
fprintf(ascfile, skycathead, 8.0);
|
| 703 |
|
|
for (i=1,key=key->nextkey; i++<objtab->nkey; key=key->nextkey)
|
| 704 |
|
|
{
|
| 705 |
|
|
if (i>4)
|
| 706 |
|
|
fprintf(ascfile, "\t%s", key->name);
|
| 707 |
|
|
sprintf(gstr, "\t%s", key->printf);
|
| 708 |
|
|
strcpy(key->printf, gstr);
|
| 709 |
|
|
}
|
| 710 |
|
|
fprintf(ascfile, "\n------------------\n");
|
| 711 |
|
|
}
|
| 712 |
17 |
bertin |
else if (prefs.cat_type == ASCII_VO && objtab->key)
|
| 713 |
|
|
{
|
| 714 |
|
|
write_xml_header(ascfile);
|
| 715 |
|
|
write_vo_fields(ascfile);
|
| 716 |
|
|
fprintf(ascfile, " <DATA><TABLEDATA>\n");
|
| 717 |
|
|
}
|
| 718 |
2 |
bertin |
}
|
| 719 |
|
|
else
|
| 720 |
|
|
{
|
| 721 |
|
|
fitscat = new_cat(1);
|
| 722 |
|
|
init_cat(fitscat);
|
| 723 |
|
|
strcpy(fitscat->filename, prefs.cat_name);
|
| 724 |
|
|
if (open_cat(fitscat, WRITE_ONLY) != RETURN_OK)
|
| 725 |
|
|
error(EXIT_FAILURE,"*Error*: cannot open for writing ",prefs.cat_name);
|
| 726 |
|
|
switch(prefs.cat_type)
|
| 727 |
|
|
{
|
| 728 |
|
|
case FITS_LDAC:
|
| 729 |
|
|
case FITS_TPX:
|
| 730 |
|
|
/*------ Save a "pure" primary HDU */
|
| 731 |
|
|
save_tab(fitscat, fitscat->tab);
|
| 732 |
|
|
break;
|
| 733 |
|
|
|
| 734 |
|
|
case FITS_10:
|
| 735 |
|
|
/*------ Add to the primary HDU extraction parameters */
|
| 736 |
|
|
key = headkey1;
|
| 737 |
|
|
while (*key->name)
|
| 738 |
|
|
addkeyto_head(fitscat->tab, key++);
|
| 739 |
|
|
save_tab(fitscat, fitscat->tab);
|
| 740 |
|
|
break;
|
| 741 |
|
|
default:
|
| 742 |
|
|
error (EXIT_FAILURE, "*Internal Error*: Unknown FITS type in ",
|
| 743 |
|
|
"initcat()");
|
| 744 |
|
|
}
|
| 745 |
|
|
}
|
| 746 |
|
|
|
| 747 |
16 |
bertin |
catopen_flag = 1;
|
| 748 |
|
|
|
| 749 |
2 |
bertin |
return;
|
| 750 |
|
|
}
|
| 751 |
|
|
|
| 752 |
|
|
|
| 753 |
17 |
bertin |
/****** write_vo_fields *******************************************************
|
| 754 |
|
|
PROTO int write_vo_fields(FILE *file)
|
| 755 |
|
|
PURPOSE Write the list of columns to an XML-VOTable file or stream
|
| 756 |
|
|
INPUT Pointer to the output file (or stream).
|
| 757 |
|
|
OUTPUT -.
|
| 758 |
|
|
NOTES -.
|
| 759 |
|
|
AUTHOR E. Bertin (IAP)
|
| 760 |
|
|
VERSION 14/07/2006
|
| 761 |
|
|
***/
|
| 762 |
|
|
void write_vo_fields(FILE *file)
|
| 763 |
|
|
{
|
| 764 |
|
|
keystruct *key;
|
| 765 |
|
|
char datatype[40], arraysize[40], str[40];
|
| 766 |
|
|
int i, d;
|
| 767 |
|
|
|
| 768 |
|
|
if (!objtab || !objtab->key)
|
| 769 |
|
|
return;
|
| 770 |
|
|
key=objtab->key;
|
| 771 |
|
|
for (i=0; i++<objtab->nkey; key=key->nextkey)
|
| 772 |
|
|
{
|
| 773 |
|
|
/*--- indicate datatype, arraysize, width and precision attributes */
|
| 774 |
|
|
/*--- Handle multidimensional arrays */
|
| 775 |
|
|
arraysize[0] = '\0';
|
| 776 |
|
|
if (key->naxis>1)
|
| 777 |
|
|
{
|
| 778 |
|
|
for (d=0; d<key->naxis; d++)
|
| 779 |
|
|
{
|
| 780 |
|
|
sprintf(str, "%s%d", d?"x":" arraysize=\"", key->naxisn[d]);
|
| 781 |
|
|
strcat(arraysize, str);
|
| 782 |
|
|
}
|
| 783 |
|
|
strcat(arraysize, "\"");
|
| 784 |
|
|
}
|
| 785 |
|
|
switch(key->ttype)
|
| 786 |
|
|
{
|
| 787 |
|
|
case T_BYTE: strcpy(datatype, "unsignedByte"); break;
|
| 788 |
|
|
case T_SHORT: strcpy(datatype, "short"); break;
|
| 789 |
|
|
case T_LONG: strcpy(datatype, "int"); break;
|
| 790 |
|
|
case T_FLOAT: strcpy(datatype, "float"); break;
|
| 791 |
|
|
case T_DOUBLE: strcpy(datatype, "double"); break;
|
| 792 |
|
|
default: error(EXIT_FAILURE,
|
| 793 |
|
|
"*Internal Error*: Unknown datatype in ",
|
| 794 |
|
|
"initcat()");
|
| 795 |
|
|
}
|
| 796 |
|
|
fprintf(file,
|
| 797 |
|
|
" <FIELD name=\"%s\" ucd=\"%s\" datatype=\"%s\" unit=\"%s\"%s>\n",
|
| 798 |
|
|
key->name, key->voucd, datatype,key->vounit, arraysize);
|
| 799 |
|
|
fprintf(file, " <DESCRIPTION>%s</DESCRIPTION>\n", key->comment);
|
| 800 |
|
|
fprintf(file, " </FIELD>\n");
|
| 801 |
|
|
}
|
| 802 |
|
|
|
| 803 |
|
|
return;
|
| 804 |
|
|
}
|
| 805 |
|
|
|
| 806 |
|
|
|
| 807 |
2 |
bertin |
/********************************* reinitcat *********************************/
|
| 808 |
|
|
/*
|
| 809 |
|
|
Initialize the catalog header
|
| 810 |
|
|
*/
|
| 811 |
|
|
void reinitcat(picstruct *field)
|
| 812 |
|
|
{
|
| 813 |
|
|
tabstruct *tab, *asctab;
|
| 814 |
|
|
keystruct *key;
|
| 815 |
|
|
|
| 816 |
|
|
if (prefs.cat_type == CAT_NONE)
|
| 817 |
|
|
return;
|
| 818 |
|
|
|
| 819 |
11 |
bertin |
if (prefs.cat_type != ASCII_HEAD && prefs.cat_type != ASCII &&
|
| 820 |
|
|
prefs.cat_type != ASCII_SKYCAT && prefs.cat_type != ASCII_VO)
|
| 821 |
2 |
bertin |
{
|
| 822 |
|
|
update_tab(objtab);
|
| 823 |
|
|
switch(prefs.cat_type)
|
| 824 |
|
|
{
|
| 825 |
|
|
case FITS_LDAC:
|
| 826 |
|
|
/*------ We create a dummy table (only used through its header) */
|
| 827 |
|
|
QCALLOC(asctab, tabstruct, 1);
|
| 828 |
173 |
bertin |
asctab->headnblock = field->tab->headnblock;
|
| 829 |
|
|
QMEMCPY(field->tab->headbuf, asctab->headbuf, char,
|
| 830 |
|
|
asctab->headnblock*FBSIZE);
|
| 831 |
2 |
bertin |
key = headkey;
|
| 832 |
|
|
while (*key->name)
|
| 833 |
|
|
addkeyto_head(asctab, key++);
|
| 834 |
|
|
tab = new_tab("LDAC_IMHEAD");
|
| 835 |
|
|
add_tab(tab, fitscat, 0);
|
| 836 |
|
|
key = new_key("Field Header Card");
|
| 837 |
|
|
key->ptr = asctab->headbuf;
|
| 838 |
|
|
asctab->headbuf = NULL;
|
| 839 |
|
|
free_tab(asctab);
|
| 840 |
|
|
key->htype = H_STRING;
|
| 841 |
|
|
key->ttype = T_STRING;
|
| 842 |
|
|
key->nobj = 1;
|
| 843 |
|
|
key->nbytes = 80*(fitsfind(key->ptr, "END ")+1);
|
| 844 |
|
|
key->naxis = 2;
|
| 845 |
|
|
QMALLOC(key->naxisn, int, key->naxis);
|
| 846 |
|
|
key->naxisn[0] = 80;
|
| 847 |
|
|
key->naxisn[1] = key->nbytes/80;
|
| 848 |
|
|
add_key(key, tab, 0);
|
| 849 |
|
|
save_tab(fitscat, tab);
|
| 850 |
|
|
strcpy(objtab->extname, "LDAC_OBJECTS");
|
| 851 |
|
|
break;
|
| 852 |
|
|
|
| 853 |
|
|
case FITS_TPX:
|
| 854 |
|
|
/*------ We create a dummy table (only used through its header) */
|
| 855 |
|
|
QCALLOC(asctab, tabstruct, 1);
|
| 856 |
173 |
bertin |
asctab->headnblock = field->tab->headnblock;
|
| 857 |
|
|
QMEMCPY(field->tab->headbuf, asctab->headbuf, char,
|
| 858 |
|
|
asctab->headnblock*FBSIZE);
|
| 859 |
2 |
bertin |
key = headkey;
|
| 860 |
|
|
while (*key->name)
|
| 861 |
|
|
addkeyto_head(asctab, key++);
|
| 862 |
|
|
tab = new_tab("TPX_IMHEAD");
|
| 863 |
|
|
add_tab(tab, fitscat, 0);
|
| 864 |
|
|
key = new_key("Field Header Card");
|
| 865 |
|
|
key->ptr = asctab->headbuf;
|
| 866 |
|
|
asctab->headbuf = NULL;
|
| 867 |
|
|
free_tab(asctab);
|
| 868 |
|
|
key->htype = H_STRING;
|
| 869 |
|
|
key->ttype = T_STRING;
|
| 870 |
|
|
key->nobj = fitsfind(key->ptr, "END ")+1;
|
| 871 |
|
|
key->nbytes = 80;
|
| 872 |
|
|
key->naxis = 1;
|
| 873 |
|
|
QMALLOC(key->naxisn, int, key->naxis);
|
| 874 |
|
|
key->naxisn[0] = 80;
|
| 875 |
|
|
add_key(key, tab, 0);
|
| 876 |
|
|
save_tab(fitscat, tab);
|
| 877 |
|
|
strcpy(objtab->extname, "TPX_OBJECTS");
|
| 878 |
|
|
break;
|
| 879 |
|
|
|
| 880 |
|
|
case FITS_10:
|
| 881 |
|
|
/*------ Add to the primary HDU extraction parameters */
|
| 882 |
|
|
/*
|
| 883 |
|
|
key = headkey1;
|
| 884 |
|
|
while (*key->name)
|
| 885 |
|
|
addkeyto_head(fitscat->tab, key++);
|
| 886 |
|
|
save_tab(fitscat, fitscat->tab);
|
| 887 |
|
|
*/
|
| 888 |
|
|
break;
|
| 889 |
|
|
|
| 890 |
|
|
default:
|
| 891 |
|
|
error (EXIT_FAILURE, "*Internal Error*: Unknown FITS type in ",
|
| 892 |
|
|
"reinitcat()");
|
| 893 |
|
|
}
|
| 894 |
|
|
|
| 895 |
|
|
objtab->cat = fitscat;
|
| 896 |
|
|
init_writeobj(fitscat, objtab, &buf);
|
| 897 |
|
|
}
|
| 898 |
|
|
|
| 899 |
|
|
return;
|
| 900 |
|
|
}
|
| 901 |
|
|
|
| 902 |
|
|
|
| 903 |
|
|
/********************************* writecat **********************************/
|
| 904 |
|
|
/*
|
| 905 |
|
|
Write out in the catalog each one object.
|
| 906 |
|
|
*/
|
| 907 |
|
|
void writecat(int n, objliststruct *objlist)
|
| 908 |
|
|
{
|
| 909 |
|
|
outobj = objlist->obj[n];
|
| 910 |
|
|
|
| 911 |
|
|
switch(prefs.cat_type)
|
| 912 |
|
|
{
|
| 913 |
|
|
case FITS_10:
|
| 914 |
|
|
case FITS_LDAC:
|
| 915 |
|
|
case FITS_TPX:
|
| 916 |
|
|
write_obj(objtab, buf);
|
| 917 |
|
|
break;
|
| 918 |
|
|
|
| 919 |
|
|
case ASCII:
|
| 920 |
|
|
case ASCII_HEAD:
|
| 921 |
|
|
case ASCII_SKYCAT:
|
| 922 |
|
|
print_obj(ascfile, objtab);
|
| 923 |
|
|
break;
|
| 924 |
11 |
bertin |
case ASCII_VO:
|
| 925 |
|
|
voprint_obj(ascfile, objtab);
|
| 926 |
|
|
break;
|
| 927 |
2 |
bertin |
|
| 928 |
|
|
case CAT_NONE:
|
| 929 |
|
|
break;
|
| 930 |
|
|
|
| 931 |
|
|
default:
|
| 932 |
|
|
error (EXIT_FAILURE, "*Internal Error*: Unknown catalog type", "");
|
| 933 |
|
|
}
|
| 934 |
|
|
|
| 935 |
|
|
return;
|
| 936 |
|
|
}
|
| 937 |
|
|
|
| 938 |
|
|
|
| 939 |
|
|
/********************************** endcat ***********************************/
|
| 940 |
|
|
/*
|
| 941 |
|
|
Terminate the catalog output.
|
| 942 |
|
|
*/
|
| 943 |
16 |
bertin |
void endcat(char *error)
|
| 944 |
2 |
bertin |
{
|
| 945 |
|
|
keystruct *key;
|
| 946 |
|
|
int i;
|
| 947 |
|
|
|
| 948 |
16 |
bertin |
if (!catopen_flag)
|
| 949 |
|
|
{
|
| 950 |
|
|
if (prefs.cat_type == ASCII_VO)
|
| 951 |
17 |
bertin |
write_xmlerror(prefs.cat_name, error);
|
| 952 |
|
|
return;
|
| 953 |
16 |
bertin |
}
|
| 954 |
2 |
bertin |
switch(prefs.cat_type)
|
| 955 |
|
|
{
|
| 956 |
|
|
case ASCII:
|
| 957 |
|
|
case ASCII_HEAD:
|
| 958 |
|
|
if (!prefs.pipe_flag)
|
| 959 |
|
|
fclose(ascfile);
|
| 960 |
|
|
break;
|
| 961 |
|
|
|
| 962 |
|
|
case ASCII_SKYCAT:
|
| 963 |
11 |
bertin |
fprintf(ascfile, skycattail);
|
| 964 |
2 |
bertin |
if (!prefs.pipe_flag)
|
| 965 |
|
|
fclose(ascfile);
|
| 966 |
|
|
break;
|
| 967 |
|
|
|
| 968 |
11 |
bertin |
case ASCII_VO:
|
| 969 |
17 |
bertin |
fprintf(ascfile, " </TABLEDATA></DATA>\n");
|
| 970 |
11 |
bertin |
fprintf(ascfile, " </TABLE>\n");
|
| 971 |
15 |
bertin |
/*---- Add configuration file meta-data */
|
| 972 |
16 |
bertin |
write_xml_meta(ascfile, error);
|
| 973 |
11 |
bertin |
fprintf(ascfile, "</RESOURCE>\n");
|
| 974 |
|
|
fprintf(ascfile, "</VOTABLE>\n");
|
| 975 |
|
|
|
| 976 |
|
|
if (!prefs.pipe_flag)
|
| 977 |
|
|
fclose(ascfile);
|
| 978 |
|
|
break;
|
| 979 |
|
|
|
| 980 |
2 |
bertin |
case FITS_LDAC:
|
| 981 |
|
|
case FITS_TPX:
|
| 982 |
|
|
case FITS_10:
|
| 983 |
|
|
free_cat(&fitscat,1);
|
| 984 |
|
|
break;
|
| 985 |
|
|
|
| 986 |
|
|
case CAT_NONE:
|
| 987 |
|
|
break;
|
| 988 |
|
|
|
| 989 |
|
|
default:
|
| 990 |
|
|
break;
|
| 991 |
|
|
}
|
| 992 |
|
|
|
| 993 |
|
|
/* Free allocated memory for arrays */
|
| 994 |
|
|
key = objtab->key;
|
| 995 |
|
|
for (i=objtab->nkey; i--; key=key->nextkey)
|
| 996 |
|
|
if (key->naxis && key->allocflag)
|
| 997 |
|
|
free(key->ptr);
|
| 998 |
|
|
|
| 999 |
|
|
objtab->key = NULL;
|
| 1000 |
|
|
objtab->nkey = 0;
|
| 1001 |
|
|
free_tab(objtab);
|
| 1002 |
17 |
bertin |
objtab = NULL;
|
| 1003 |
2 |
bertin |
|
| 1004 |
|
|
return;
|
| 1005 |
|
|
}
|
| 1006 |
|
|
|
| 1007 |
|
|
|
| 1008 |
|
|
/******************************** reendcat ***********************************/
|
| 1009 |
|
|
/*
|
| 1010 |
|
|
Terminate the catalog output.
|
| 1011 |
|
|
*/
|
| 1012 |
|
|
void reendcat()
|
| 1013 |
|
|
{
|
| 1014 |
|
|
keystruct *key;
|
| 1015 |
|
|
tabstruct *tab;
|
| 1016 |
|
|
OFF_T pos;
|
| 1017 |
|
|
char *head;
|
| 1018 |
|
|
|
| 1019 |
|
|
switch(prefs.cat_type)
|
| 1020 |
|
|
{
|
| 1021 |
|
|
case ASCII:
|
| 1022 |
|
|
case ASCII_HEAD:
|
| 1023 |
|
|
case ASCII_SKYCAT:
|
| 1024 |
11 |
bertin |
case ASCII_VO:
|
| 1025 |
2 |
bertin |
break;
|
| 1026 |
|
|
|
| 1027 |
|
|
case FITS_LDAC:
|
| 1028 |
|
|
case FITS_TPX:
|
| 1029 |
|
|
end_writeobj(fitscat, objtab, buf);
|
| 1030 |
|
|
key = NULL;
|
| 1031 |
|
|
if (!(tab=fitscat->tab->prevtab)
|
| 1032 |
|
|
|| !(key=name_to_key(tab, "Field Header Card")))
|
| 1033 |
|
|
error(EXIT_FAILURE,"*Error*: cannot update table ", "ASCFIELD");
|
| 1034 |
|
|
head = key->ptr;
|
| 1035 |
|
|
fitswrite(head, "SEXNDET ", &thecat.ndetect,H_INT,T_LONG);
|
| 1036 |
|
|
fitswrite(head, "SEXNFIN ", &thecat.ntotal, H_INT,T_LONG);
|
| 1037 |
173 |
bertin |
fitswrite(head, "SEXDATE ", thecat.ext_date, H_STRING, T_STRING);
|
| 1038 |
|
|
fitswrite(head, "SEXTIME ", thecat.ext_time, H_STRING, T_STRING);
|
| 1039 |
2 |
bertin |
fitswrite(head, "SEXELAPS", &thecat.ext_elapsed, H_FLOAT, T_DOUBLE);
|
| 1040 |
|
|
QFTELL(fitscat->file, pos, fitscat->filename);
|
| 1041 |
|
|
QFSEEK(fitscat->file, tab->headpos, SEEK_SET, fitscat->filename);
|
| 1042 |
|
|
save_tab(fitscat, tab);
|
| 1043 |
|
|
QFSEEK(fitscat->file, pos, SEEK_SET, fitscat->filename);
|
| 1044 |
|
|
break;
|
| 1045 |
|
|
|
| 1046 |
|
|
case FITS_10:
|
| 1047 |
|
|
end_writeobj(fitscat, objtab, buf);
|
| 1048 |
|
|
fitswrite(fitscat->tab->headbuf,"SEXNDET ",&thecat.ndetect,H_INT,T_LONG);
|
| 1049 |
|
|
fitswrite(fitscat->tab->headbuf,"SEXNFIN ",&thecat.ntotal, H_INT,T_LONG);
|
| 1050 |
|
|
QFTELL(fitscat->file, pos, fitscat->filename);
|
| 1051 |
|
|
QFSEEK(fitscat->file, fitscat->tab->headpos, SEEK_SET,fitscat->filename);
|
| 1052 |
|
|
save_tab(fitscat, fitscat->tab);
|
| 1053 |
|
|
QFSEEK(fitscat->file, pos, SEEK_SET, fitscat->filename);
|
| 1054 |
|
|
break;
|
| 1055 |
|
|
|
| 1056 |
|
|
case CAT_NONE:
|
| 1057 |
|
|
break;
|
| 1058 |
|
|
|
| 1059 |
|
|
default:
|
| 1060 |
|
|
break;
|
| 1061 |
|
|
}
|
| 1062 |
|
|
|
| 1063 |
|
|
return;
|
| 1064 |
|
|
}
|
| 1065 |
|
|
|
| 1066 |
|
|
|