IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27488


Ignore:
Timestamp:
Mar 26, 2010, 4:43:50 PM (16 years ago)
Author:
eugene
Message:

updates to handle image coordinate failures

Location:
branches/eam_branches/relastro.20100326/src
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relastro.20100326/src/FitChip.c

    r24308 r27488  
    2222  CoordFit *fit;
    2323  double dL, dM, dR, dRmax, *values;
     24  Coords oldCoords;
    2425
    2526  ALLOCATE (values, double, Nmatch);
     
    8485      default:
    8586        fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);
    86         abort ();
     87        skip = TRUE;
    8788    }
    8889    if (skip) {
     
    9697
    9798    // measure the fit, update the coords & object coordinates
    98     fit_eval (fit);
    99     fit_apply_coords (fit, coords);
     99    if (!fit_eval (fit)) {
     100      fprintf (stderr, "failed to fit new model\n");
     101      return FALSE;
     102    }
     103
     104    if (!fit_apply_coords (fit, coords)) {
     105      fprintf (stderr, "failed to fit new model\n");
     106      return FALSE;
     107    }
     108
    100109    fit_free (fit);
    101110
     
    107116
    108117  free (values);
    109   return;
     118  return TRUE;
    110119}
    111120
  • branches/eam_branches/relastro.20100326/src/ImageOps.c

    r27478 r27488  
    286286  Coords *moscoords, *imcoords;
    287287
     288  // check if this image is bad and should be skipped
     289  if (badCoords(im)) return;
     290
    288291  moscoords = NULL;
    289292  mosaic = getMosaicForImage (im);
     
    292295  }
    293296  imcoords = &image[im].coords;
     297
     298  // accumulate the rms position offsets.  if this value, or any specific entry, is too
     299  // large, we will reset the image to the original coords at the end of the analysis
     300
     301  dPos = 0.0;
     302  nPos = 0;
    294303
    295304  for (i = 0; i < Nlist[im]; i++) {
     
    317326
    318327    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????
    321328      fprintf (stderr, "!");
    322       // abort ();
     329      setBadCoords (im); // report a failure for this image
     330      return;
    323331    }
    324332    if (fabs(catalog[c].measure[m].dD - dD) > 10.0) {
    325333      fprintf (stderr, "*");
    326       // abort ();
    327     }
     334      setBadCoords (im); // report a failure for this image
     335      return;
     336    }
     337
     338    dPos += SQ(catalog[c].measure[m].dR - dR) + SQ(catalog[c].measure[m].dD - dD);
     339    nPos ++;
    328340
    329341    catalog[c].measure[m].dR = dR;
     
    341353    }
    342354  }
     355
     356  saveOffsets (dPos, nPos, im);
     357
    343358  return;
    344359}
  • branches/eam_branches/relastro.20100326/src/UpdateChips.c

    r27435 r27488  
    77  Image *image;
    88  StarData *raw, *ref;
     9  Coords *oldCoords;
    910
    1011  image = getimages (&Nimage);
     
    2425    assert (Nraw == Nref);
    2526
     27    saveCoords (&image[i].coords, i);
     28
    2629    // FitChip does iterative, clipped fitting
    2730    fprintf (stderr, "image %lld : Nstars: %lld\n", (long long) i, (long long) Nraw);
    28     FitChip (raw, ref, Nraw, &image[i].coords);
     31    if (!FitChip (raw, ref, Nraw, &image[i].coords)) {
     32      oldCoords = getCoords (i);
     33      memcpy (&image[i].coords, oldCoords, sizeof(Coords));
     34    }
    2935
    3036    free (raw);
  • branches/eam_branches/relastro.20100326/src/UpdateObjectOffsets.c

    r17243 r27488  
    11# 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
    28
    39int UpdateObjectOffsets (SkyList *skylist) {
  • branches/eam_branches/relastro.20100326/src/fitpoly.c

    r17419 r27488  
    103103
    104104/* convert the xsum,ysum,sum terms into vector,matrix and solve */
    105 void fit_eval (CoordFit *fit) {
     105int fit_eval (CoordFit *fit) {
    106106
    107107  int i, j, ix, iy, jx, jy;
     
    147147  }     
    148148
    149   dgaussjordan (matrix, vector, fit[0].Nelems, 2);
     149  status = dgaussjordan (matrix, vector, fit[0].Nelems, 2);
     150  if (!status) {
     151    return (FALSE);
     152  }
    150153
    151154  for (i = 0; i < fit[0].Nelems; i++) {
     
    166169  array_free (matrix, fit[0].Nelems);
    167170  array_free (vector, fit[0].Nelems);
     171  return (TRUE);
    168172}
    169173
     
    271275/* this should only apply to the polynomial, not the projection terms */
    272276/* compare with psastro supporting code */
    273 CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords) {
     277int fit_apply_coords (CoordFit *fit, Coords *coords) {
    274278
    275279  double Xo, Yo, R1, R2;
     
    281285  // L = pc1_1*cd1*(x - cp1) + pc1_2*cd2*(y - cp2) + ...
    282286
    283   CoordsGetCenter (fit, 0.001, &Xo, &Yo);
     287  if (!CoordsGetCenter (fit, 0.001, &Xo, &Yo)) {
     288    fprintf (stderr, "failed to modify model\n");
     289    return (FALSE);
     290  }
    284291  coords[0].crpix1 = Xo;
    285292  coords[0].crpix2 = Yo;
     
    329336  /* keep the order and type from initial values */
    330337 
    331   // XXX if desired in the future, return modfit (and free above)
    332   return (NULL);
    333 }
    334 
     338  return (TRUE);
     339}
     340
  • branches/eam_branches/relastro.20100326/src/mkpolyterm.c

    r16810 r27488  
    7373    if (dPos > dPosRef) {
    7474      fprintf (stderr, "*** warning : non-convergence in model conversion (mkpolyterm.c;73) *** \n");
     75      return FALSE;
    7576    }
    7677    array_free (alpha, 2);
  • branches/eam_branches/relastro.20100326/src/relastro.c

    r27478 r27488  
    3939  skylist = load_images (&db, &UserPatch);
    4040  MARKTIME("load images: %f sec\n", dtime);
     41
     42  initCoords();
    4143
    4244  /* load catalog data from region files : subselect high-quality measurements */
     
    8385  UpdateObjectOffsets (skylist);
    8486
     87  // iterate over catalogs to make detection coordinates consistant
     88  FixProblemImages ();
     89
    8590  // save the updated image parameters
    8691  dvo_image_update (&db, VERBOSE);
Note: See TracChangeset for help on using the changeset viewer.