Changeset 27581
- Timestamp:
- Apr 2, 2010, 3:55:04 PM (16 years ago)
- Location:
- trunk/Ohana/src/relastro
- Files:
-
- 18 edited
- 2 copied
-
. (modified) (1 prop)
-
Makefile (modified) (1 diff)
-
include/relastro.h (modified) (10 diffs)
-
src/CoordOps.c (copied) (copied from branches/eam_branches/relastro.20100326/src/CoordOps.c )
-
src/FitChip.c (modified) (4 diffs)
-
src/FixProblemImages.c (copied) (copied from branches/eam_branches/relastro.20100326/src/FixProblemImages.c )
-
src/GetAstromError.c (modified) (1 diff)
-
src/ImageOps.c (modified) (19 diffs)
-
src/MosaicOps.c (modified) (3 diffs)
-
src/ParFactor.c (modified) (2 diffs)
-
src/UpdateChips.c (modified) (2 diffs)
-
src/UpdateObjectOffsets.c (modified) (2 diffs)
-
src/UpdateObjects.c (modified) (11 diffs)
-
src/UpdateSimple.c (modified) (1 diff)
-
src/args.c (modified) (6 diffs)
-
src/fitpoly.c (modified) (6 diffs)
-
src/load_images.c (modified) (1 diff)
-
src/mkpolyterm.c (modified) (1 diff)
-
src/relastro.c (modified) (5 diffs)
-
src/relastro_objects.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro
-
Property svn:mergeinfo
set to
/branches/eam_branches/20091201/Ohana/src/relastro merged eligible /branches/eam_branches/largefiles.20100314/Ohana/src/relastro merged eligible /branches/eam_branches/relastro.20100326 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/src/relastro/Makefile
r24308 r27581 56 56 $(SRC)/save_catalogs.$(ARCH).o \ 57 57 $(SRC)/write_coords.$(ARCH).o \ 58 $(SRC)/CoordOps.$(ARCH).o \ 59 $(SRC)/FixProblemImages.$(ARCH).o \ 58 60 $(SRC)/relastroVisual.$(ARCH).o 59 61 -
trunk/Ohana/src/relastro/include/relastro.h
r27435 r27581 91 91 92 92 int VERBOSE; 93 int VERBOSE2; 93 94 94 95 int RESET; 96 int NLOOP; 95 97 int UPDATE; 96 98 int PLOTSTUFF; … … 103 105 int PLOTDELAY; 104 106 int CHIPORDER; 107 108 int UserCatalog; 109 double UserCatalogRA, UserCatalogDEC; 105 110 106 111 char *PHOTCODE_KEEP_LIST, *PHOTCODE_SKIP_LIST; … … 151 156 void dump_grid PROTO((void)); 152 157 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 153 void findImages PROTO((Catalog *catalog, int Ncatalog ));158 void findImages PROTO((Catalog *catalog, int Ncatalog, int MATCHCAT)); 154 159 int findMosaics PROTO((Catalog *catalog, int Ncatalog)); 155 160 Image *find_images PROTO((FITS_DB *db, GSCRegion *region, off_t Nregion, off_t *Nimage, off_t **LineNum)); … … 166 171 void free_catalogs PROTO((Catalog *catalog, int Ncatalog)); 167 172 int gcatalog PROTO((Catalog *catalog, int FINAL)); 168 Coords *getCoords PROTO((off_t meas, int cat));173 // Coords *getCoords PROTO((off_t meas, int cat)); 169 174 float getMcal PROTO((off_t meas, int cat)); 170 175 float getMgrid PROTO((off_t meas, int cat)); … … 178 183 void initGrid PROTO((int dX, int dY)); 179 184 void initGridBins PROTO((Catalog *catalog, int Ncatalog)); 180 void initImageBins PROTO((Catalog *catalog, int Ncatalog ));185 void initImageBins PROTO((Catalog *catalog, int Ncatalog, int FULLINIT)); 181 186 void initImages PROTO((Image *input, off_t N)); 182 187 void initMosaicBins PROTO((Catalog *catalog, int Ncatalog)); … … 199 204 int main PROTO((int argc, char **argv)); 200 205 void mark_images PROTO((Image *image, off_t Nimage, Image *timage, off_t Ntimage)); 201 void matchImage PROTO((Catalog *catalog, off_t meas, int cat ));206 void matchImage PROTO((Catalog *catalog, off_t meas, int cat, int MATCHCAT)); 202 207 void matchMosaics PROTO((Catalog *catalog, off_t meas, int cat)); 203 208 GSCRegion *name_region PROTO((char *name, off_t *Nregions)); … … 250 255 void fit_free (CoordFit *fit); 251 256 void fit_add (CoordFit *fit, double x1, double y1, double x2, double y2, double wt); 252 voidfit_eval (CoordFit *fit);257 int fit_eval (CoordFit *fit); 253 258 void fit_apply (CoordFit *fit, double *x2, double *y2, double x1, double y1); 254 259 double **poly2d_dx (double **poly, int Nx, int Ny); … … 256 261 double **poly2d_copy (double **poly, int Nx, int Ny); 257 262 double poly2d_eval (double **poly, int Nx, int Ny, double x, double y); 258 CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords);263 int fit_apply_coords (CoordFit *fit, Coords *coords); 259 264 int CoordsGetCenter (CoordFit *fit, double tol, double *xo, double *yo); 260 265 CoordFit *CoordsSetCenter (CoordFit *input, double Xo, double Yo); 261 voidFitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords);266 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 262 267 void FitMosaic (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 263 268 void FitSimple (StarData *raw, StarData *ref, int Nmatch, Coords *coords); … … 273 278 274 279 int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon); 275 int ParFactor (double *pR, double *pD, double R, double D, time_t T);280 int ParFactor (double *pR, double *pD, double R, double D, double T, double Tmean); 276 281 int FitPM (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, int Npts); 277 282 int FitPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *pR, double *pD, int Npts); … … 303 308 StatType statsR, StatType statsD, double thresh); 304 309 310 311 312 int FixProblemImages (SkyList *skylist); 313 int *getCatlist (int *N, off_t im); 314 315 void initCoords (void); 316 void getOffsets (double *dPos, off_t *nPos, off_t N); 317 void saveOffsets (double dPos, off_t nPos, off_t N); 318 void setBadCoords (off_t N); 319 int badCoords (off_t N); 320 Coords *getCoords (off_t N); 321 int saveCoords (Coords *coords, off_t N); 322 void resetImageRaw (Catalog *catalog, int Ncatalog, off_t im); -
trunk/Ohana/src/relastro/src/FitChip.c
r24308 r27581 17 17 // XXX save measurements of the fit quality (scatter, chisq) in the image table 18 18 19 voidFitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords) {19 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords) { 20 20 21 21 int i, Nscatter, Niter, skip; … … 84 84 default: 85 85 fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms); 86 abort ();86 skip = TRUE; 87 87 } 88 88 if (skip) { … … 90 90 fit_free (fit); 91 91 free (values); 92 return ;92 return FALSE; 93 93 } 94 94 95 fprintf (stderr, "scatter limit: %f based on %d detections; using %d of %d for fit\n", dRmax, Nscatter, fit[0].Npts, Nmatch);95 // fprintf (stderr, "scatter limit: %f based on %d detections; using %d of %d for fit\n", dRmax, Nscatter, fit[0].Npts, Nmatch); 96 96 97 97 // measure the fit, update the coords & object coordinates 98 fit_eval (fit); 99 fit_apply_coords (fit, coords); 98 if (!fit_eval (fit)) { 99 fprintf (stderr, "failed to fit new model\n"); 100 return FALSE; 101 } 102 103 if (!fit_apply_coords (fit, coords)) { 104 fprintf (stderr, "failed to fit new model\n"); 105 return FALSE; 106 } 107 100 108 fit_free (fit); 101 109 … … 107 115 108 116 free (values); 109 return ;117 return TRUE; 110 118 } 111 119 -
trunk/Ohana/src/relastro/src/GetAstromError.c
r24308 r27581 8 8 switch (mode) { 9 9 case ERROR_MODE_RA: 10 dPobs = measure[0].dXccd ; // need to redefine this as RAerr10 dPobs = measure[0].dXccd / 100.0; // need to redefine this as RAerr 11 11 break; 12 12 case ERROR_MODE_DEC: 13 dPobs = measure[0].dYccd ; // need to redefine this as RAerr13 dPobs = measure[0].dYccd / 100.0; // need to redefine this as RAerr 14 14 break; 15 15 case ERROR_MODE_POS: 16 dPobs = hypot (measure[0].dXccd, measure[0].dYccd) ; // need to redefine this as RAerr16 dPobs = hypot (measure[0].dXccd, measure[0].dYccd) / 100.0; // need to redefine this as RAerr 17 17 break; 18 18 default: -
trunk/Ohana/src/relastro/src/ImageOps.c
r27478 r27581 11 11 static Image *image; // list of available images 12 12 static off_t Nimage; // number of available images 13 14 static int *Ncatlist; // catalogs associated with each image 15 static int *NCATLIST; // catalogs associated with each image 16 static int **catlist; // catalogs associated with each image 13 17 14 18 // if we search by image ID, we sort (imageIDs, imageIdx) by imageIDs to get a sorted … … 32 36 } 33 37 38 int *getCatlist (int *N, off_t im) { 39 40 *N = Ncatlist[im]; 41 return (catlist[im]); 42 } 43 34 44 void initImages (Image *input, off_t N) { 35 45 … … 86 96 } 87 97 88 void initImageBins (Catalog *catalog, int Ncatalog) { 98 // these are really image & catalog indexes 99 void initImageBins (Catalog *catalog, int Ncatalog, int FULLINIT) { 89 100 90 101 off_t i, j; … … 102 113 103 114 for (i = 0; i < Nimage; i++) { 104 Nlist[i] = 0;115 Nlist[i] = 0; 105 116 NLIST[i] = 100; 106 117 ALLOCATE (clist[i], int, NLIST[i]); 107 118 ALLOCATE (mlist[i], off_t, NLIST[i]); 119 } 120 121 if (FULLINIT) { 122 ALLOCATE (Ncatlist, int, Nimage); 123 ALLOCATE (NCATLIST, int, Nimage); 124 ALLOCATE (catlist, int *, Nimage); 125 126 for (i = 0; i < Nimage; i++) { 127 Ncatlist[i] = 0; 128 NCATLIST[i] = 32; 129 ALLOCATE (catlist[i], int, NCATLIST[i]); 130 } 108 131 } 109 132 } … … 126 149 127 150 /* match measurements to images */ 128 void findImages (Catalog *catalog, int Ncatalog ) {151 void findImages (Catalog *catalog, int Ncatalog, int MATCHCAT) { 129 152 130 153 off_t i, j; … … 136 159 // ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode); 137 160 // if (photcode[0].code != ecode) continue; 138 matchImage (catalog, j, i );139 } 140 } 141 142 for (i = 0; VERBOSE && (i < Nimage); i++) {161 matchImage (catalog, j, i, MATCHCAT); 162 } 163 } 164 165 for (i = 0; VERBOSE2 && (i < Nimage); i++) { 143 166 name = GetPhotcodeNamebyCode (image[i].photcode); 144 167 fprintf (stderr, "image %lld has %lld measures (%s, %s)\n", (long long) i, (long long) Nlist[i], … … 149 172 # if USE_IMAGE_ID 150 173 // this is the imageID-based match 151 void matchImage (Catalog *catalog, off_t meas, int cat ) {174 void matchImage (Catalog *catalog, off_t meas, int cat, int MATCHCAT) { 152 175 153 176 off_t idx, ID; 154 177 Measure *measure; 178 int i, found; 155 179 156 180 measure = &catalog[cat].measure[meas]; … … 159 183 idx = getImageByID (ID); 160 184 if (idx == -1) { 161 fprintf (stderr, "can't match detection to image?\n");162 abort();185 if (VERBOSE2) fprintf (stderr, "can't match detection to image?\n"); 186 return; 163 187 } 164 188 … … 178 202 REALLOCATE (mlist[idx], off_t, NLIST[idx]); 179 203 } 204 205 if (MATCHCAT) { 206 // index for image -> catalog list 207 found = FALSE; 208 for (i = 0; !found && (i < Ncatlist[idx]); i++) { 209 if (catlist[idx][i] == cat) found = TRUE; 210 } 211 if (!found) { 212 catlist[idx][Ncatlist[idx]] = cat; 213 Ncatlist[idx] ++; 214 if (Ncatlist[idx] == NCATLIST[idx]) { 215 NCATLIST[idx] += 32; 216 REALLOCATE (catlist[idx], int, NCATLIST[idx]); 217 } 218 } 219 } 220 180 221 return; 181 222 } … … 183 224 # else 184 225 // this is the time-based match 185 void matchImage (Catalog *catalog, off_t meas, int cat ) {226 void matchImage (Catalog *catalog, off_t meas, int cat, int MATCHCAT) { 186 227 187 228 off_t i; … … 216 257 return; 217 258 } 218 fprintf (stderr, "can't match detection to image?\n");219 abort();259 if (VERBOSE2) fprintf (stderr, "can't match detection to image?\n"); 260 return; 220 261 } 221 262 # endif 222 263 264 /* 223 265 Coords *getCoords (off_t meas, int cat) { 224 266 … … 229 271 return (&image[i].coords); 230 272 } 273 */ 231 274 232 275 void plot_images () { … … 280 323 void fixImageRaw (Catalog *catalog, int Ncatalog, off_t im) { 281 324 282 off_t i, m, c, n ;325 off_t i, m, c, n, nPos; 283 326 double X, Y, L, M, P, Q, R, D, dR, dD; 327 double dPos; 284 328 285 329 Mosaic *mosaic; 286 330 Coords *moscoords, *imcoords; 287 331 332 // check if this image is bad and should be skipped 333 if (badCoords(im)) return; 334 335 // WRP images need to have an associated mosaic 288 336 moscoords = NULL; 289 mosaic = getMosaicForImage (im); 290 if (mosaic != NULL) { 337 if (!strcmp(&image[im].coords.ctype[4], "-WRP")) { 338 mosaic = getMosaicForImage (im); 339 if (mosaic == NULL) return; // if we cannot find the associated image, skip it 291 340 moscoords = &mosaic[0].coords; 292 341 } 293 342 imcoords = &image[im].coords; 343 344 // accumulate the rms position offsets. if this value, or any specific entry, is too 345 // large, we will reset the image to the original coords at the end of the analysis 346 347 dPos = 0.0; 348 nPos = 0; 294 349 295 350 for (i = 0; i < Nlist[im]; i++) { … … 316 371 dD = 3600.0*(catalog[c].average[n].D - D); 317 372 318 if (fabs(catalog[c].measure[m].dR - dR) > 10.0) { 319 // XXXXX running into this still for last megacam exposure: wrong mosaic? 320 // ???? inconsistently hitting this???? 373 // complain if the new location is far from the average location 374 if (fabs(dR) > 2.0) { 321 375 fprintf (stderr, "!"); 322 // abort (); 323 } 324 if (fabs(catalog[c].measure[m].dD - dD) > 10.0) { 376 setBadCoords (im); // report a failure for this image 377 return; 378 } 379 if (fabs(dD) > 2.0) { 325 380 fprintf (stderr, "*"); 326 // abort (); 327 } 381 setBadCoords (im); // report a failure for this image 382 return; 383 } 384 385 // complain if the new location is far from the old location 386 if (fabs(catalog[c].measure[m].dR - dR) > 2.0) { 387 fprintf (stderr, "@"); 388 setBadCoords (im); // report a failure for this image 389 return; 390 } 391 if (fabs(catalog[c].measure[m].dD - dD) > 2.0) { 392 fprintf (stderr, "#"); 393 setBadCoords (im); // report a failure for this image 394 return; 395 } 396 397 dPos += SQ(catalog[c].measure[m].dR - dR) + SQ(catalog[c].measure[m].dD - dD); 398 nPos ++; 328 399 329 400 catalog[c].measure[m].dR = dR; … … 341 412 } 342 413 } 414 415 saveOffsets (dPos, nPos, im); 416 417 return; 418 } 419 420 // return StarData values for detections in the specified image, converting coordinates from the 421 // chip positions: X,Y -> L,M -> P,Q -> R,D 422 void resetImageRaw (Catalog *catalog, int Ncatalog, off_t im) { 423 424 off_t i, m, c, n; 425 double X, Y, L, M, P, Q, R, D, dR, dD; 426 427 Mosaic *mosaic; 428 Coords *moscoords, *imcoords, *oldcoords; 429 430 // check if this image is bad and should be skipped 431 if (!badCoords(im)) { 432 fprintf (stderr, "ERROR: inconsistent result?"); 433 abort(); 434 } 435 436 // replace the current coords with the old coords: 437 oldcoords = getCoords (im); 438 memcpy (&image[im].coords, oldcoords, sizeof(Coords)); 439 440 // WRP images need to have an associated mosaic 441 moscoords = NULL; 442 if (!strcmp(&image[im].coords.ctype[4], "-WRP")) { 443 mosaic = getMosaicForImage (im); 444 if (mosaic == NULL) return; // if we cannot find the associated image, skip it 445 moscoords = &mosaic[0].coords; 446 } 447 imcoords = &image[im].coords; 448 449 for (i = 0; i < Nlist[im]; i++) { 450 m = mlist[im][i]; 451 c = clist[im][i]; 452 453 X = catalog[c].measure[m].Xccd; 454 Y = catalog[c].measure[m].Yccd; 455 n = catalog[c].measure[m].averef; 456 457 dR = dD = 0.0; 458 if (moscoords == NULL) { 459 // this is a Simple image (not a mosaic) 460 // note that for a Simple image, L,M = P,Q 461 XY_to_LM (&L, &M, X, Y, imcoords); 462 LM_to_RD (&R, &D, L, M, imcoords); 463 } else { 464 XY_to_LM (&L, &M, X, Y, imcoords); 465 XY_to_LM (&P, &Q, L, M, moscoords); 466 LM_to_RD (&R, &D, P, Q, moscoords); 467 } 468 469 catalog[c].measure[m].dR = dR; 470 catalog[c].measure[m].dD = dD; 471 472 if (catalog[c].measure[m].dR > +180.0*3600.0) { 473 // average on high end of boundary, move star up 474 R += 360.0; 475 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R); 476 } 477 if (catalog[c].measure[m].dR < -180.0*3600.0) { 478 // average on low end of boundary, move star down 479 R -= 360.0; 480 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R); 481 } 482 } 483 343 484 return; 344 485 } … … 354 495 Coords *moscoords; 355 496 StarData *raw; 356 357 ALLOCATE (raw, StarData, Nlist[im]);358 497 359 498 mosaic = NULL; … … 363 502 if (mosaic == NULL) { 364 503 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 365 exit (1);504 return NULL; 366 505 } 367 506 moscoords = &mosaic[0].coords; 368 507 } 508 509 ALLOCATE (raw, StarData, Nlist[im]); 369 510 370 511 for (i = 0; i < Nlist[im]; i++) { … … 430 571 StarData *ref; 431 572 432 ALLOCATE (ref, StarData, Nlist[im]);433 434 573 mosaic = NULL; 435 574 moscoords = NULL; … … 438 577 if (mosaic == NULL) { 439 578 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 440 exit (1);579 return NULL; 441 580 } 442 581 moscoords = &mosaic[0].coords; 443 582 } 583 584 ALLOCATE (ref, StarData, Nlist[im]); 444 585 445 586 for (i = 0; i < Nlist[im]; i++) { -
trunk/Ohana/src/relastro/src/MosaicOps.c
r27478 r27581 146 146 147 147 Nmos = getMosaicByTimes (start, stop, startMos, stopMos, indexMos); 148 if (Nmos == -1) continue; 148 if (Nmos == -1) { 149 fprintf (stderr, "cannot match mosaic for %s\n", image[i].name); 150 continue; 151 } 149 152 150 153 // mosaic corresponding to this image … … 185 188 // this function does the reverse-lookup for the mosaic corresponding to this image 186 189 new = getImageRaw (catalog, Ncatalog, im, &Nnew, MODE_MOSAIC); 190 if (!new) { 191 fprintf (stderr, "inconsistent: missing mosaic for image already associated with a mosaic? (1)\n"); 192 abort(); 193 } 187 194 188 195 // merge new and raw … … 217 224 // this function does the reverse-lookup for the mosaic corresponding to this image 218 225 new = getImageRef (catalog, Ncatalog, im, &Nnew, MODE_MOSAIC); 226 if (!new) { 227 fprintf (stderr, "inconsistent: missing mosaic for image already associated with a mosaic? (2)\n"); 228 abort(); 229 } 219 230 220 231 // merge new and ref -
trunk/Ohana/src/relastro/src/ParFactor.c
r14590 r27581 42 42 43 43 /* given RA, DEC, Time, calculate the parallax factor */ 44 int ParFactor (double *pR, double *pD, double R, double D, time_t T) {44 int ParFactor (double *pR, double *pD, double R, double D, double T, double Tmean) { 45 45 46 46 double jd; … … 49 49 /* given a time T in UNIX seconds, determine the solar longitude S */ 50 50 51 jd = ohana_sec_to_jd ( T);51 jd = ohana_sec_to_jd (365.25*86400.0*(T + Tmean)); 52 52 sun_ecliptic (jd, &L, &B, &E); 53 53 -
trunk/Ohana/src/relastro/src/UpdateChips.c
r27435 r27581 7 7 Image *image; 8 8 StarData *raw, *ref; 9 Coords *oldCoords; 9 10 10 11 image = getimages (&Nimage); … … 17 18 /* convert measure coordinates to raw entries */ 18 19 raw = getImageRaw (catalog, Ncatalog, i, &Nraw, MODE_MOSAIC); 20 if (!raw) continue; 19 21 20 22 /* convert average coordinates to ref entries */ 21 23 ref = getImageRef (catalog, Ncatalog, i, &Nref, MODE_MOSAIC); 24 if (!ref) continue; 22 25 23 26 // note that Nraw & Nref must be equal: if not, we made a programming error in one of these two functions. 24 27 assert (Nraw == Nref); 25 28 29 saveCoords (&image[i].coords, i); 30 26 31 // FitChip does iterative, clipped fitting 27 fprintf (stderr, "image %lld : Nstars: %lld\n", (long long) i, (long long) Nraw); 28 FitChip (raw, ref, Nraw, &image[i].coords); 32 // fprintf (stderr, "image %lld : Nstars: %lld\n", (long long) i, (long long) Nraw); 33 if (!FitChip (raw, ref, Nraw, &image[i].coords)) { 34 fprintf (stderr, "reject fit for image %s (%lld) : Nstars: %lld\n", image[i].name, (long long) i, (long long) Nraw); 35 oldCoords = getCoords (i); 36 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 37 } 29 38 30 39 free (raw); -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r17243 r27581 1 1 # include "relastro.h" 2 3 // We run through each DVO catalog, updating the measures that come from the modified images 4 // We need to watch for failures: 5 // * in UpdateMeasures, in fixImageRaw, we track the cumulative offset for each image 6 // * after all updates are done, we can check for any bad images and reset them to the 7 // original coordinates 2 8 3 9 int UpdateObjectOffsets (SkyList *skylist) { … … 28 34 29 35 // match measurements with images 30 initImageBins (&catalog, 1 );31 findImages (&catalog, 1 );36 initImageBins (&catalog, 1, FALSE); 37 findImages (&catalog, 1, FALSE); 32 38 33 39 // update the detection coordinates using the new image parameters -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r27435 r27581 40 40 int UpdateObjects (Catalog *catalog, int Ncatalog) { 41 41 42 int i, j, k, m, N, Nsecfilt; 42 off_t j, k, m; 43 int i, N, Nsecfilt, mode, result, status, XVERB; 43 44 StatType statsR, statsD; 44 45 Coords coords; 45 PMFit fit; 46 time_t To; 47 int mode, Nave, Npm, Npar, Nskip; 48 double Tmin, Tmax; 46 PMFit fitAve, fitPM, fitPAR, fit; 47 time_t T2000; 48 off_t Nave, Npm, Npar, Nskip; 49 off_t NaveSum, NpmSum, NparSum, NskipSum; 50 double Tmin, Tmax, Tmean, Trange; 49 51 50 52 initObjectData (catalog, Ncatalog); … … 61 63 strcpy (coords.ctype, "RA---SIN"); 62 64 65 XVERB = FALSE; 66 63 67 // use J2000 as a reference time 64 To = ohana_date_to_sec ("2000/01/01"); 65 Nave = Npar = Npm = 0; 68 T2000 = ohana_date_to_sec ("2000/01/01"); 66 69 67 70 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? … … 69 72 assert (catalog[0].Nsecfilt == Nsecfilt); 70 73 74 NaveSum = NparSum = NpmSum = NskipSum = 0; 71 75 for (i = 0; i < Ncatalog; i++) { 72 76 73 77 if (VERBOSE) fprintf (stderr, "astrometrize catalog %d : %lld ave, %lld meas\n", i, (long long) catalog[i].Naverage, (long long) catalog[i].Nmeasure); 74 78 75 N skip = 0;79 Nave = Npar = Npm = Nskip = 0; 76 80 for (j = 0; j < catalog[i].Naverage; j++) { 77 81 /* calculate the average value of R,D for a single star */ … … 79 83 // skip objects which are known to be problematic 80 84 // XXX include this code or not? 81 # if (0)85 # if (0) 82 86 if (catalog[i].average[j].code & STAR_BAD) { 83 87 Nskip ++; 84 88 continue; 85 89 } 86 # endif90 # endif 87 91 88 92 N = 0; 89 93 m = catalog[i].average[j].measureOffset; 90 94 91 Tmin = Tmax = (catalog[i].measure[m].t - T o) / (86400*365.25);95 Tmin = Tmax = (catalog[i].measure[m].t - T2000) / (86400*365.25); 92 96 mode = FIT_MODE; 93 97 98 // find the basic properties of the detections for this object (Tmin, Tmax, Tmean) 99 Tmean = 0; 94 100 for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) { 95 101 … … 108 114 // exclude measurements by previous outlier detection 109 115 // XXX include this code or not? 110 # if (0)116 # if (0) 111 117 if (catalog[i].measure[m].dbFlags & MEAS_BAD) { 112 118 catalog[i].measure[m].dbFlags |= ID_MEAS_SKIP_ASTROM; 113 119 continue; 114 120 } 115 # endif121 # endif 116 122 117 123 catalog[i].measure[m].dbFlags |= ID_MEAS_USED_OBJ; … … 119 125 R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 120 126 D[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 121 T[N] = (catalog[i].measure[m].t - T o) / (86400*365.25) ; // time relative to J2000 in years127 T[N] = (catalog[i].measure[m].t - T2000) / (86400*365.25) ; // time relative to J2000 in years 122 128 123 129 Tmin = MIN(Tmin, T[N]); 124 130 Tmax = MAX(Tmax, T[N]); 125 126 dR[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_RA); 127 dD[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_DEC); 131 Tmean += T[N]; 132 133 // dX, dY : error in arcsec -- 134 dX[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_RA); 135 dY[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_DEC); 128 136 dT[N] = catalog[i].measure[m].dt; 137 138 // XXX this is (slightly) inconsistent: dX,dY are the X and Y direction errors in 139 // arcseconds. dR, dD are the errors in those directions in degrees. IF we have 140 // non-circular errors (different values for X and Y), then dR and dD will be 141 // incorrect: they would need to be rotated to take out the position angle 142 dR[k] = dX[k] / 3600.0; 143 dD[k] = dY[k] / 3600.0; 129 144 130 145 N++; … … 138 153 139 154 // XXX add the parallax factor range as a criterion as well 140 if ((Tmax - Tmin) < PM_DT_MIN) mode = FIT_AVERAGE; 155 Trange = Tmax - Tmin; 156 if (Trange < PM_DT_MIN) mode = FIT_AVERAGE; 141 157 if ((mode == FIT_PM_ONLY) && (N < PM_TOOFEW)) mode = FIT_AVERAGE; 142 158 … … 144 160 if (N < SRC_MEAS_TOOFEW) { 145 161 // XXX need to define PHOTOM and ASTROM object flags 162 // XXX reset the average value fields? 146 163 catalog[i].average[j].flags |= ID_STAR_FEW; 164 catalog[i].average[j].ChiSqAve = NAN; 165 catalog[i].average[j].ChiSqPM = NAN; 166 catalog[i].average[j].ChiSqPar = NAN; 147 167 if (N < 2) continue; 148 168 } … … 151 171 coords.crval1 = R[0]; 152 172 coords.crval2 = D[0]; 173 Tmean /= (float) N; 153 174 154 /* project all of the R,D coordinates to a plane centered on this coordinate */ 155 for (k = 0; k < N; k++) { 156 RD_to_XY (&X[k], &Y[k], R[k], D[k], &coords); 157 dX[k] = dR[k]; 158 dY[k] = dD[k]; 159 // fprintf (stderr, "%d %f %f %f %f %f\n", k, T[k], R[k], D[k], X[k], Y[k]); 175 XVERB = FALSE && (catalog[i].measure[m].dM < 0.01) && (N == 6) && (mode == FIT_PM_ONLY); 176 177 // to judge the quality of the PM and PAR fits, we need to fit all three models and compare Chisq 178 179 if ((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) { 180 // project all of the R,D coordinates to a plane centered on this coordinate set 181 // the times to be relative to Tmean (this is required for parallax as well) 182 for (k = 0; k < N; k++) { 183 RD_to_XY (&X[k], &Y[k], R[k], D[k], &coords); 184 T[k] -= Tmean; 185 if (XVERB) { 186 fprintf (stderr, "%lld %f %f %f %f %f +/- %f %f\n", (long long) k, T[k], R[k], D[k], X[k], Y[k], dX[k], dY[k]); 187 } 188 } 189 190 FitPM (&fitPM, X, dX, Y, dY, T, N); 191 if (XVERB) fprintf (stderr, "fitted: %f - %f : %f %f : %f %f : %f vs %f\n", Tmin, Tmax, fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.chisq, fitAve.chisq); 192 193 // project Ro, Do back to RA,DEC 194 XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &coords); 195 if (XVERB) fprintf (stderr, "project: %f %f : %f %f : %f\n", fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.p); 196 197 fitPM.p = fitPM.dp = 0.0; 198 catalog[i].average[j].flags |= ID_STAR_FIT_PM; 199 Npm ++; 200 } 201 202 if (mode == FIT_PM_AND_PAR) { 203 fprintf (stderr, "parallax fitting is still untested (%s, %d)", __FILE__, __LINE__); 204 exit (2); 205 206 for (k = 0; k < N; k++) { 207 ParFactor (&pX[k], &pY[k], R[k], D[k], T[k], Tmean); 208 } 209 FitPMandPar (&fitPAR, X, dX, Y, dY, T, pX, pY, N); 210 XY_to_RD (&fitPAR.Ro, &fitPAR.Do, fitPAR.Ro, fitPAR.Do, &coords); 211 catalog[i].average[j].flags |= ID_STAR_FIT_PAR; 212 Npar ++; 160 213 } 161 214 162 /* fit the model components as needed */ 163 switch (mode) { 215 // fit the average model 216 if ((mode == FIT_AVERAGE) || (mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) { 217 liststats (R, dR, N, &statsR); // WARNING: this function modifies R (do not use after here) 218 liststats (D, dD, N, &statsD); // WARNING: this function modifies D (do not use after here) 219 220 fitAve.Ro = statsR.mean; 221 fitAve.dRo = 3600.0*statsR.sigma; 222 223 fitAve.Do = statsD.mean; 224 fitAve.dDo = 3600.0*statsD.sigma; 225 226 fitAve.chisq = 0.5*(statsR.chisq + statsD.chisq); 227 fitAve.Nfit = N; 228 229 fitAve.uR = fitAve.duR = 0.0; 230 fitAve.uD = fitAve.duD = 0.0; 231 fitAve.p = fitAve.dp = 0.0; 232 catalog[i].average[j].flags |= ID_STAR_FIT_AVE; 233 Nave ++; 234 } 235 236 /* choose the result based on the chisq values */ 237 // XXXX for now, just use the mode as the result: 238 result = mode; 239 240 switch (result) { 164 241 case FIT_AVERAGE: 165 liststats (R, dR, N, &statsR); 166 liststats (D, dD, N, &statsD); 167 168 fit.Ro = statsR.mean; 169 fit.dRo = 3600.0*statsR.sigma; 170 171 fit.Do = statsD.mean; 172 fit.dDo = 3600.0*statsD.sigma; 173 174 fit.chisq = 0.5*(statsR.chisq + statsD.chisq); 175 fit.Nfit = N; 176 177 fit.uR = fit.duR = 0.0; 178 fit.uD = fit.duD = 0.0; 179 fit.p = fit.dp = 0.0; 180 181 Nave ++; 242 catalog[i].average[j].flags |= ID_STAR_USE_AVE; 243 fit = fitAve; 182 244 break; 183 184 245 case FIT_PM_ONLY: 185 FitPM (&fit, X, dX, Y, dY, T, N); 186 // fprintf (stderr, "fitted: %f - %f : %f %f : %f %f : %f\n", Tmin, Tmax, fit.Ro, fit.Do, fit.uR, fit.uD, fit.p); 187 // project Ro, Do back to RA,DEC 188 XY_to_RD (&fit.Ro, &fit.Do, fit.Ro, fit.Do, &coords); 189 // fprintf (stderr, "project: %f %f : %f %f : %f\n", fit.Ro, fit.Do, fit.uR, fit.uD, fit.p); 190 // continue; 191 192 fit.p = fit.dp = 0.0; 193 194 Npm ++; 246 catalog[i].average[j].flags |= ID_STAR_USE_PM; 247 fit = fitPM; 195 248 break; 196 197 case FIT_PAR_ONLY: 198 fprintf (stderr, "programming error at %s, %d", __FILE__, __LINE__); 199 exit (2); 200 201 for (k = 0; k < N; k++) { 202 ParFactor (&pX[k], &pY[k], R[k], D[k], T[k]); 203 } 204 FitPar (&fit, X, dX, Y, dY, pX, pY, N); 205 206 // project Ro, Do back to RA,DEC 207 XY_to_RD (&fit.Ro, &fit.Do, fit.Ro, fit.Do, &coords); 208 209 fit.uR = fit.duR = 0.0; 210 fit.uD = fit.duD = 0.0; 211 212 Npar ++; 249 case FIT_PM_AND_PAR: 250 catalog[i].average[j].flags |= ID_STAR_USE_PAR; 251 fit = fitPAR; 213 252 break; 214 215 case FIT_PM_AND_PAR: 216 fprintf (stderr, "programming error at %s, %d", __FILE__, __LINE__); 217 exit (2); 218 219 for (k = 0; k < N; k++) { 220 ParFactor (&pX[k], &pY[k], R[k], D[k], T[k]); 221 } 222 FitPMandPar (&fit, X, dX, Y, dY, T, pX, pY, N); 223 XY_to_RD (&fit.Ro, &fit.Do, fit.Ro, fit.Do, &coords); 224 Npar ++; 225 break; 226 227 default: 228 fprintf (stderr, "programming error at %s, %d", __FILE__, __LINE__); 229 exit (2); 230 } 231 232 if (0 && (j < 100)) { 233 fprintf (stderr, "%f %f -> %f %f (%f,%f)\n", 234 catalog[i].average[j].R, 235 catalog[i].average[j].D, 236 fit.Ro, fit.Do, 237 3600*(catalog[i].average[j].R - fit.Ro), 238 3600*(catalog[i].average[j].D - fit.Do)); 239 } 253 } 254 255 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f)\n", 256 catalog[i].average[j].R, 257 catalog[i].average[j].D, 258 fit.Ro, fit.Do, 259 3600*(catalog[i].average[j].R - fit.Ro), 260 3600*(catalog[i].average[j].D - fit.Do)); 240 261 241 262 //make sure that the fit succeeded 242 assert(finite(fit.Ro) && finite(fit.Do) && 243 finite(fit.dRo) && finite(fit.dDo) && 244 finite(fit.uR) && finite(fit.uD) && 245 finite(fit.duR) && finite(fit.duD) && 246 finite(fit.p) && finite(fit.dp)); 263 status = finite(fit.Ro); 264 status &= finite(fit.Do); 265 status &= finite(fit.dRo); 266 status &= finite(fit.dDo); 267 status &= finite(fit.uR); 268 status &= finite(fit.uD); 269 status &= finite(fit.duR); 270 status &= finite(fit.duD); 271 status &= finite(fit.p); 272 status &= finite(fit.dp); 273 if (!status) { 274 Nskip ++; 275 continue; 276 } 247 277 248 278 // the measure fields must be updated before the average fields 249 279 m = catalog[i].average[j].measureOffset; 250 280 for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) { 251 // XXX why was this here?? if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;252 281 setMeanR (fit.Ro, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 253 282 setMeanD (fit.Do, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); … … 267 296 catalog[i].average[j].dP = fit.dp; // parallax error in arcsec 268 297 269 catalog[i].average[j].Xp = (fit.Nfit > 1) ? 100.0*log10(fit.chisq) : NAN_S_SHORT; 298 // Xp is supposed to be the position scatter, not the chisq : fix this: 299 // catalog[i].average[j].Xp = (fit.Nfit > 1) ? 100.0*log10(fit.chisq) : NAN_S_SHORT; 300 catalog[i].average[j].ChiSqAve = fitAve.chisq; 301 catalog[i].average[j].ChiSqPM = fitPM.chisq; 302 catalog[i].average[j].ChiSqPar = fitPAR.chisq; 303 catalog[i].average[j].Xp = 0.0; 304 catalog[i].average[j].Tmean = (Tmean * 86400 * 365.26) + T2000; 305 catalog[i].average[j].Trange = (Trange * 86400 * 365.26); 306 catalog[i].average[j].Npos = fit.Nfit; 270 307 } 271 308 272 if (VERBOSE) fprintf (stderr, "catalog %d : %d ave, %d pm, %d par : Nskip % d\n", i, Nave, Npm, Npar, Nskip); 309 NaveSum += Nave; 310 NpmSum += Npm; 311 NparSum += Npar; 312 NskipSum += Nskip; 313 if (VERBOSE) fprintf (stderr, "catalog %lld : %lld ave, %lld pm, %lld par : Nskip %lld\n", (long long) i, (long long) Nave, (long long) Npm, (long long) Npar, (long long) Nskip); 273 314 } 274 315 275 if (VERBOSE) fprintf (stderr, "fitted %d objects (%d ave, %d pm, %d par)\n", Nave + Npm + Npar, Nave, Npm, Npar);316 fprintf (stderr, "fitted %lld objects (%lld ave, %lld pm, %lld par), skipped %lld\n", (long long) (NaveSum + NpmSum + NparSum), (long long) NaveSum, (long long) NpmSum, (long long) NparSum, (long long) NskipSum); 276 317 return (TRUE); 277 318 } … … 279 320 /* fitting proper-motion and parallax: 280 321 281 given a source at position r,d, at a time t, we need to calculate a vector (pr,pd)282 283 let x,y be the coordinate in the linearized frame with y parallel to DEC lines284 285 L,B are the ecliptic longitude and latitude of the object,286 dL and dB are the offsets in the L and B directions287 288 dL = sin(t - topp)289 dB = cos(t - topp)*sin(B)290 291 these need to be rotated to the R,D frame to yield pR,pD. Then, the equation of motion292 for the source in the x,y frame is:293 294 x = Ro + uR * (t - to) + p * pR295 y = Do + uD * (t - to) + p * pD296 297 the unknowns in these equations are Ro, uR, Do, uD, and p298 299 XXX think through the concepts for the pole a bit better. all objects near the pole300 move the same way with the same phase. choose a projection center and define dL,dB relative301 to that center point coordinate system?322 given a source at position r,d, at a time t, we need to calculate a vector (pr,pd) 323 324 let x,y be the coordinate in the linearized frame with y parallel to DEC lines 325 326 L,B are the ecliptic longitude and latitude of the object, 327 dL and dB are the offsets in the L and B directions 328 329 dL = sin(t - topp) 330 dB = cos(t - topp)*sin(B) 331 332 these need to be rotated to the R,D frame to yield pR,pD. Then, the equation of motion 333 for the source in the x,y frame is: 334 335 x = Ro + uR * (t - to) + p * pR 336 y = Do + uD * (t - to) + p * pD 337 338 the unknowns in these equations are Ro, uR, Do, uD, and p 339 340 XXX think through the concepts for the pole a bit better. all objects near the pole 341 move the same way with the same phase. choose a projection center and define dL,dB relative 342 to that center point coordinate system? 302 343 303 344 */ -
trunk/Ohana/src/relastro/src/UpdateSimple.c
r27435 r27581 18 18 /* convert measure coordinates to raw entries */ 19 19 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE); 20 if (!raw) continue; 20 21 21 22 /* convert average coordinates to ref entries */ 22 23 ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE); 24 if (!ref) continue; 23 25 24 26 FitSimple (raw, ref, Nstars, &image[i].coords); -
trunk/Ohana/src/relastro/src/args.c
r24308 r27581 50 50 51 51 if (FIT_TARGET == TARGET_NONE) usage(); 52 53 UserCatalog = FALSE; 54 if ((N = get_argument (argc, argv, "-catalog"))) { 55 remove_argument (N, &argc, argv); 56 UserCatalogRA = atof(argv[N]); 57 remove_argument (N, &argc, argv); 58 UserCatalogDEC = atof(argv[N]); 59 remove_argument (N, &argc, argv); 60 UserCatalog = TRUE; 61 } 52 62 53 63 /* specify portion of the sky : allow default of all sky? */ … … 67 77 remove_argument (N, &argc, argv); 68 78 } else { 69 usage (); 79 if (!UserCatalog) { 80 usage (); 81 } 70 82 } 71 83 … … 111 123 } 112 124 113 VERBOSE = FALSE;125 VERBOSE = VERBOSE2 = FALSE; 114 126 if ((N = get_argument (argc, argv, "-v"))) { 115 127 VERBOSE = TRUE; 128 remove_argument (N, &argc, argv); 129 } 130 if ((N = get_argument (argc, argv, "-vv"))) { 131 VERBOSE = VERBOSE2 = TRUE; 116 132 remove_argument (N, &argc, argv); 117 133 } … … 242 258 } 243 259 260 NLOOP = 4; 261 if ((N = get_argument (argc, argv, "-nloop"))) { 262 remove_argument (N, &argc, argv); 263 NLOOP = atof (argv[N]); 264 remove_argument (N, &argc, argv); 265 } 266 244 267 if (argc != 1) usage (); 245 268 return TRUE; … … 248 271 void usage () { 249 272 fprintf (stderr, "ERROR: USAGE: relastro -region RA RA DEC DEC\n"); 273 fprintf (stderr, " OR: relastro -catalog (ra) (dec)\n"); 250 274 fprintf (stderr, " working options: \n"); 251 275 fprintf (stderr, " -update-objects\n"); … … 263 287 fprintf (stderr, " -statmode (mode)\n"); 264 288 fprintf (stderr, " -reset"); 289 fprintf (stderr, " -nloop (N) : number of image-fit iterations"); 265 290 fprintf (stderr, " -update : apply new fit to database\n"); 266 291 fprintf (stderr, " -params\n"); -
trunk/Ohana/src/relastro/src/fitpoly.c
r17419 r27581 103 103 104 104 /* convert the xsum,ysum,sum terms into vector,matrix and solve */ 105 voidfit_eval (CoordFit *fit) {105 int fit_eval (CoordFit *fit) { 106 106 107 107 int i, j, ix, iy, jx, jy; … … 146 146 // ix, iy, vector[i][0], ix, iy, vector[i][1]); 147 147 } 148 149 dgaussjordan (matrix, vector, fit[0].Nelems, 2); 148 149 if (!dgaussjordan (matrix, vector, fit[0].Nelems, 2)) { 150 return (FALSE); 151 } 150 152 151 153 for (i = 0; i < fit[0].Nelems; i++) { … … 166 168 array_free (matrix, fit[0].Nelems); 167 169 array_free (vector, fit[0].Nelems); 170 return (TRUE); 168 171 } 169 172 … … 271 274 /* this should only apply to the polynomial, not the projection terms */ 272 275 /* compare with psastro supporting code */ 273 CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords) {276 int fit_apply_coords (CoordFit *fit, Coords *coords) { 274 277 275 278 double Xo, Yo, R1, R2; … … 281 284 // L = pc1_1*cd1*(x - cp1) + pc1_2*cd2*(y - cp2) + ... 282 285 283 CoordsGetCenter (fit, 0.001, &Xo, &Yo); 286 if (!CoordsGetCenter (fit, 0.001, &Xo, &Yo)) { 287 fprintf (stderr, "failed to modify model\n"); 288 return (FALSE); 289 } 284 290 coords[0].crpix1 = Xo; 285 291 coords[0].crpix2 = Yo; … … 329 335 /* keep the order and type from initial values */ 330 336 331 // XXX if desired in the future, return modfit (and free above) 332 return (NULL); 333 } 334 337 return (TRUE); 338 } 339 -
trunk/Ohana/src/relastro/src/load_images.c
r27435 r27581 24 24 25 25 // determine the populated SkyRegions overlapping the requested area 26 skylist = SkyListByPatch (sky, -1, region); 26 if (UserCatalog) { 27 skylist = SkyRegionByPoint (sky, -1, UserCatalogRA, UserCatalogDEC); 28 } else { 29 skylist = SkyListByPatch (sky, -1, region); 30 } 27 31 MARKTIME(" setup sky: %f sec\n", dtime); 28 32 -
trunk/Ohana/src/relastro/src/mkpolyterm.c
r16810 r27581 73 73 if (dPos > dPosRef) { 74 74 fprintf (stderr, "*** warning : non-convergence in model conversion (mkpolyterm.c;73) *** \n"); 75 return FALSE; 75 76 } 76 77 array_free (alpha, 2); -
trunk/Ohana/src/relastro/src/relastro.c
r27478 r27581 9 9 int main (int argc, char **argv) { 10 10 11 int status, Ncatalog;11 int i, status, Ncatalog; 12 12 Catalog *catalog; 13 13 FITS_DB db; … … 40 40 MARKTIME("load images: %f sec\n", dtime); 41 41 42 initCoords(); 43 42 44 /* load catalog data from region files : subselect high-quality measurements */ 43 45 catalog = load_catalogs (skylist, &Ncatalog, TRUE); … … 45 47 46 48 /* match measurements with images */ 47 initImageBins (catalog, Ncatalog );49 initImageBins (catalog, Ncatalog, TRUE); 48 50 MARKTIME("make image bins: %f sec\n", dtime); 49 51 50 findImages (catalog, Ncatalog );52 findImages (catalog, Ncatalog, TRUE); 51 53 MARKTIME("set up image indexes: %f sec\n", dtime); 52 54 … … 59 61 switch (FIT_TARGET) { 60 62 case TARGET_SIMPLE: 61 UpdateSimple (catalog, Ncatalog); 63 for (i = 0; i < NLOOP; i++) { 64 UpdateObjects (catalog, Ncatalog); 65 UpdateSimple (catalog, Ncatalog); 66 } 62 67 break; 63 68 64 69 case TARGET_CHIPS: 65 UpdateChips (catalog, Ncatalog); 70 for (i = 0; i < NLOOP; i++) { 71 UpdateObjects (catalog, Ncatalog); 72 UpdateChips (catalog, Ncatalog); 73 MARKTIME("update chips: %f sec\n", dtime); 74 } 66 75 break; 67 76 68 77 case TARGET_MOSAICS: 69 UpdateMosaic (catalog, Ncatalog); 78 for (i = 0; i < NLOOP; i++) { 79 UpdateObjects (catalog, Ncatalog); 80 UpdateMosaic (catalog, Ncatalog); 81 } 70 82 break; 71 83 … … 83 95 UpdateObjectOffsets (skylist); 84 96 97 // iterate over catalogs to make detection coordinates consistant 98 FixProblemImages (skylist); 99 85 100 // save the updated image parameters 86 101 dvo_image_update (&db, VERBOSE); -
trunk/Ohana/src/relastro/src/relastro_objects.c
r25757 r27581 15 15 16 16 // determine the populated SkyRegions overlapping the requested area (default depth) 17 skylist = SkyListByPatch (sky, -1, &UserPatch); 17 if (UserCatalog) { 18 skylist = SkyRegionByPoint (sky, -1, UserCatalogRA, UserCatalogDEC); 19 } else { 20 skylist = SkyListByPatch (sky, -1, &UserPatch); 21 } 18 22 19 23 // load data from each region file, only use bright stars
Note:
See TracChangeset
for help on using the changeset viewer.
