Changeset 27497
- Timestamp:
- Mar 28, 2010, 4:17:23 PM (16 years ago)
- Location:
- branches/eam_branches/relastro.20100326
- Files:
-
- 8 edited
-
include/relastro.h (modified) (1 diff)
-
src/ImageOps.c (modified) (7 diffs)
-
src/MosaicOps.c (modified) (3 diffs)
-
src/UpdateChips.c (modified) (1 diff)
-
src/UpdateObjects.c (modified) (4 diffs)
-
src/UpdateSimple.c (modified) (1 diff)
-
src/args.c (modified) (2 diffs)
-
src/relastro.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/relastro.20100326/include/relastro.h
r27496 r27497 94 94 95 95 int RESET; 96 int NLOOP; 96 97 int UPDATE; 97 98 int PLOTSTUFF; -
branches/eam_branches/relastro.20100326/src/ImageOps.c
r27496 r27497 333 333 if (badCoords(im)) return; 334 334 335 // WRP images need to have an associated mosaic 335 336 moscoords = NULL; 336 mosaic = getMosaicForImage (im); 337 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 338 340 moscoords = &mosaic[0].coords; 339 341 } … … 383 385 // complain if the new location is far from the old location 384 386 if (fabs(catalog[c].measure[m].dR - dR) > 2.0) { 385 fprintf (stderr, " !");387 fprintf (stderr, "@"); 386 388 setBadCoords (im); // report a failure for this image 387 389 return; 388 390 } 389 391 if (fabs(catalog[c].measure[m].dD - dD) > 2.0) { 390 fprintf (stderr, " *");392 fprintf (stderr, "#"); 391 393 setBadCoords (im); // report a failure for this image 392 394 return; … … 436 438 memcpy (&image[im].coords, oldcoords, sizeof(Coords)); 437 439 440 // WRP images need to have an associated mosaic 438 441 moscoords = NULL; 439 mosaic = getMosaicForImage (im); 440 if (mosaic != 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 441 445 moscoords = &mosaic[0].coords; 442 446 } … … 492 496 StarData *raw; 493 497 494 ALLOCATE (raw, StarData, Nlist[im]);495 496 498 mosaic = NULL; 497 499 moscoords = NULL; … … 500 502 if (mosaic == NULL) { 501 503 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 502 abort();504 return NULL; 503 505 } 504 506 moscoords = &mosaic[0].coords; 505 507 } 508 509 ALLOCATE (raw, StarData, Nlist[im]); 506 510 507 511 for (i = 0; i < Nlist[im]; i++) { … … 567 571 StarData *ref; 568 572 569 ALLOCATE (ref, StarData, Nlist[im]);570 571 573 mosaic = NULL; 572 574 moscoords = NULL; … … 575 577 if (mosaic == NULL) { 576 578 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 577 abort ();579 return NULL; 578 580 } 579 581 moscoords = &mosaic[0].coords; 580 582 } 583 584 ALLOCATE (ref, StarData, Nlist[im]); 581 585 582 586 for (i = 0; i < Nlist[im]; i++) { -
branches/eam_branches/relastro.20100326/src/MosaicOps.c
r27478 r27497 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 -
branches/eam_branches/relastro.20100326/src/UpdateChips.c
r27490 r27497 18 18 /* convert measure coordinates to raw entries */ 19 19 raw = getImageRaw (catalog, Ncatalog, i, &Nraw, MODE_MOSAIC); 20 if (!raw) continue; 20 21 21 22 /* convert average coordinates to ref entries */ 22 23 ref = getImageRef (catalog, Ncatalog, i, &Nref, MODE_MOSAIC); 24 if (!ref) continue; 23 25 24 26 // note that Nraw & Nref must be equal: if not, we made a programming error in one of these two functions. -
branches/eam_branches/relastro.20100326/src/UpdateObjects.c
r27435 r27497 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; 43 44 StatType statsR, statsD; 44 45 Coords coords; 45 46 PMFit fit; 46 47 time_t To; 47 int mode, Nave, Npm, Npar, Nskip; 48 off_t Nave, Npm, Npar, Nskip; 49 off_t NaveSum, NpmSum, NparSum, NskipSum; 48 50 double Tmin, Tmax; 49 51 … … 63 65 // use J2000 as a reference time 64 66 To = ohana_date_to_sec ("2000/01/01"); 65 Nave = Npar = Npm = 0;66 67 67 68 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? … … 69 70 assert (catalog[0].Nsecfilt == Nsecfilt); 70 71 72 NaveSum = NparSum = NpmSum = NskipSum = 0; 71 73 for (i = 0; i < Ncatalog; i++) { 72 74 73 75 if (VERBOSE) fprintf (stderr, "astrometrize catalog %d : %lld ave, %lld meas\n", i, (long long) catalog[i].Naverage, (long long) catalog[i].Nmeasure); 74 76 75 N skip = 0;77 Nave = Npar = Npm = Nskip = 0; 76 78 for (j = 0; j < catalog[i].Naverage; j++) { 77 79 /* calculate the average value of R,D for a single star */ … … 270 272 } 271 273 272 if (VERBOSE) fprintf (stderr, "catalog %d : %d ave, %d pm, %d par : Nskip % d\n", i, Nave, Npm, Npar, Nskip); 274 NaveSum += Nave; 275 NpmSum += Npm; 276 NparSum += Npar; 277 NskipSum += Nskip; 278 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 279 } 274 280 275 if (VERBOSE) fprintf (stderr, "fitted %d objects (%d ave, %d pm, %d par)\n", Nave + Npm + Npar, Nave, Npm, Npar);281 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 282 return (TRUE); 277 283 } -
branches/eam_branches/relastro.20100326/src/UpdateSimple.c
r27435 r27497 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); -
branches/eam_branches/relastro.20100326/src/args.c
r27496 r27497 244 244 remove_argument (N, &argc, argv); 245 245 DophotSelect = TRUE; 246 } 247 248 NLOOP = 4; 249 if ((N = get_argument (argc, argv, "-nloop"))) { 250 remove_argument (N, &argc, argv); 251 NLOOP = atof (argv[N]); 252 remove_argument (N, &argc, argv); 246 253 } 247 254 … … 267 274 fprintf (stderr, " -statmode (mode)\n"); 268 275 fprintf (stderr, " -reset"); 276 fprintf (stderr, " -nloop (N) : number of image-fit iterations"); 269 277 fprintf (stderr, " -update : apply new fit to database\n"); 270 278 fprintf (stderr, " -params\n"); -
branches/eam_branches/relastro.20100326/src/relastro.c
r27489 r27497 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; … … 61 61 switch (FIT_TARGET) { 62 62 case TARGET_SIMPLE: 63 UpdateSimple (catalog, Ncatalog); 63 for (i = 0; i < NLOOP; i++) { 64 UpdateObjects (catalog, Ncatalog); 65 UpdateSimple (catalog, Ncatalog); 66 } 64 67 break; 65 68 66 69 case TARGET_CHIPS: 67 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 } 68 75 break; 69 76 70 77 case TARGET_MOSAICS: 71 UpdateMosaic (catalog, Ncatalog); 78 for (i = 0; i < NLOOP; i++) { 79 UpdateObjects (catalog, Ncatalog); 80 UpdateMosaic (catalog, Ncatalog); 81 } 72 82 break; 73 83
Note:
See TracChangeset
for help on using the changeset viewer.
