IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27497


Ignore:
Timestamp:
Mar 28, 2010, 4:17:23 PM (16 years ago)
Author:
eugene
Message:

handle unmatched detections and images; add iteration over chips and objects

Location:
branches/eam_branches/relastro.20100326
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relastro.20100326/include/relastro.h

    r27496 r27497  
    9494
    9595int    RESET;
     96int    NLOOP;
    9697int    UPDATE;
    9798int    PLOTSTUFF;
  • branches/eam_branches/relastro.20100326/src/ImageOps.c

    r27496 r27497  
    333333  if (badCoords(im)) return;
    334334
     335  // WRP images need to have an associated mosaic
    335336  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
    338340    moscoords = &mosaic[0].coords;
    339341  }
     
    383385    // complain if the new location is far from the old location
    384386    if (fabs(catalog[c].measure[m].dR - dR) > 2.0) {
    385       fprintf (stderr, "!");
     387      fprintf (stderr, "@");
    386388      setBadCoords (im); // report a failure for this image
    387389      return;
    388390    }
    389391    if (fabs(catalog[c].measure[m].dD - dD) > 2.0) {
    390       fprintf (stderr, "*");
     392      fprintf (stderr, "#");
    391393      setBadCoords (im); // report a failure for this image
    392394      return;
     
    436438  memcpy (&image[im].coords, oldcoords, sizeof(Coords));
    437439
     440  // WRP images need to have an associated mosaic
    438441  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
    441445    moscoords = &mosaic[0].coords;
    442446  }
     
    492496  StarData *raw;
    493497
    494   ALLOCATE (raw, StarData, Nlist[im]);
    495 
    496498  mosaic = NULL;
    497499  moscoords = NULL;
     
    500502    if (mosaic == NULL) {
    501503      fprintf (stderr, "mosaic not found for image %s\n", image[im].name);
    502       abort();
     504      return NULL;
    503505    }
    504506    moscoords = &mosaic[0].coords;
    505507  }
     508
     509  ALLOCATE (raw, StarData, Nlist[im]);
    506510
    507511  for (i = 0; i < Nlist[im]; i++) {
     
    567571  StarData *ref;
    568572
    569   ALLOCATE (ref, StarData, Nlist[im]);
    570 
    571573  mosaic = NULL;
    572574  moscoords = NULL;
     
    575577    if (mosaic == NULL) {
    576578      fprintf (stderr, "mosaic not found for image %s\n", image[im].name);
    577       abort ();
     579      return NULL;
    578580    }
    579581    moscoords = &mosaic[0].coords;
    580582  }
     583
     584  ALLOCATE (ref, StarData, Nlist[im]);
    581585
    582586  for (i = 0; i < Nlist[im]; i++) {
  • branches/eam_branches/relastro.20100326/src/MosaicOps.c

    r27478 r27497  
    146146
    147147    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    }
    149152
    150153    // mosaic corresponding to this image
     
    185188    // this function does the reverse-lookup for the mosaic corresponding to this image
    186189    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    }
    187194   
    188195    // merge new and raw
     
    217224    // this function does the reverse-lookup for the mosaic corresponding to this image
    218225    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    }
    219230   
    220231    // merge new and ref
  • branches/eam_branches/relastro.20100326/src/UpdateChips.c

    r27490 r27497  
    1818    /* convert measure coordinates to raw entries */
    1919    raw = getImageRaw (catalog, Ncatalog, i, &Nraw, MODE_MOSAIC);
     20    if (!raw) continue;
    2021
    2122    /* convert average coordinates to ref entries */
    2223    ref = getImageRef (catalog, Ncatalog, i, &Nref, MODE_MOSAIC);
     24    if (!ref) continue;
    2325
    2426    // 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  
    4040int UpdateObjects (Catalog *catalog, int Ncatalog) {
    4141
    42   int i, j, k, m, N, Nsecfilt;
     42  off_t j, k, m;
     43  int i, N, Nsecfilt, mode;
    4344  StatType statsR, statsD;
    4445  Coords coords;
    4546  PMFit fit;
    4647  time_t To;
    47   int mode, Nave, Npm, Npar, Nskip;
     48  off_t Nave, Npm, Npar, Nskip;
     49  off_t NaveSum, NpmSum, NparSum, NskipSum;
    4850  double Tmin, Tmax;
    4951
     
    6365  // use J2000 as a reference time
    6466  To = ohana_date_to_sec ("2000/01/01");
    65   Nave = Npar = Npm = 0;
    6667
    6768  // XXX in the future, use catalog[0].Nsecfilt only?  allow catalogs to have variable Nsecfilt?
     
    6970  assert (catalog[0].Nsecfilt == Nsecfilt);
    7071
     72  NaveSum = NparSum = NpmSum = NskipSum = 0;
    7173  for (i = 0; i < Ncatalog; i++) {
    7274
    7375    if (VERBOSE) fprintf (stderr, "astrometrize catalog %d : %lld ave, %lld meas\n", i, (long long) catalog[i].Naverage, (long long) catalog[i].Nmeasure);
    7476
    75     Nskip = 0;
     77    Nave = Npar = Npm = Nskip = 0;
    7678    for (j = 0; j < catalog[i].Naverage; j++) {
    7779      /* calculate the average value of R,D for a single star */
     
    270272    }
    271273
    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);
    273279  }
    274280
    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);
    276282  return (TRUE);
    277283}
  • branches/eam_branches/relastro.20100326/src/UpdateSimple.c

    r27435 r27497  
    1818    /* convert measure coordinates to raw entries */
    1919    raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE);
     20    if (!raw) continue;
    2021
    2122    /* convert average coordinates to ref entries */
    2223    ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE);
     24    if (!ref) continue;
    2325
    2426    FitSimple (raw, ref, Nstars, &image[i].coords);
  • branches/eam_branches/relastro.20100326/src/args.c

    r27496 r27497  
    244244    remove_argument (N, &argc, argv);
    245245    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);
    246253  }
    247254
     
    267274  fprintf (stderr, "  -statmode (mode)\n");
    268275  fprintf (stderr, "  -reset");
     276  fprintf (stderr, "  -nloop (N) : number of image-fit iterations");
    269277  fprintf (stderr, "  -update : apply new fit to database\n");
    270278  fprintf (stderr, "  -params\n");
  • branches/eam_branches/relastro.20100326/src/relastro.c

    r27489 r27497  
    99int main (int argc, char **argv) {
    1010
    11   int status, Ncatalog;
     11  int i, status, Ncatalog;
    1212  Catalog *catalog;
    1313  FITS_DB db;
     
    6161  switch (FIT_TARGET) {
    6262    case TARGET_SIMPLE:
    63       UpdateSimple (catalog, Ncatalog);
     63      for (i = 0; i < NLOOP; i++) {
     64        UpdateObjects (catalog, Ncatalog);
     65        UpdateSimple (catalog, Ncatalog);
     66      }
    6467      break;
    6568
    6669    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      }
    6875      break;
    6976
    7077    case TARGET_MOSAICS:
    71       UpdateMosaic (catalog, Ncatalog);
     78      for (i = 0; i < NLOOP; i++) {
     79        UpdateObjects (catalog, Ncatalog);
     80        UpdateMosaic (catalog, Ncatalog);
     81      }
    7282      break;
    7383
Note: See TracChangeset for help on using the changeset viewer.