IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16069


Ignore:
Timestamp:
Jan 14, 2008, 4:49:45 PM (18 years ago)
Author:
eugene
Message:

adding some error handing, minor cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmAstrometryObjects.c

    r15960 r16069  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2007-12-31 03:03:02 $
     10*  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2008-01-15 02:49:45 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    246246    // need to use the stats lookups functions to get the width and center
    247247    for (int i = 0; i < nIter; i++) {
    248         psVectorClipFitPolynomial2D (map->x, results->xStats, mask, 0xff, x, wt, X, Y);
    249         // psTrace ("psModules.astrom", 3, "x resid: %f +/- %f (%ld of %ld)\n", results->xStats->robustMedian, results->xStats->robustStdev, results->xStats->clippedNvalues, x->n);
     248        if (!psVectorClipFitPolynomial2D (map->x, results->xStats, mask, 0xff, x, wt, X, Y)) {
     249            psError(PS_ERR_UNKNOWN, false, "failure in clip-fitting for x\n");
     250            psFree (x);
     251            psFree (y);
     252            psFree (X);
     253            psFree (Y);
     254            psFree (wt);
     255            psFree (mask);
     256
     257            return results;
     258        }
    250259        psTrace ("psModules.astrom", 3, "x resid: %f +/- %f (%ld of %ld)\n", results->xStats->clippedMean, results->xStats->clippedStdev, results->xStats->clippedNvalues, x->n);
    251260
    252         psVectorClipFitPolynomial2D (map->y, results->yStats, mask, 0xff, y, wt, X, Y);
    253         // psTrace ("psModules.astrom", 3, "y resid: %f +/- %f (%ld of %ld)\n", results->yStats->robustMedian, results->yStats->robustStdev, results->yStats->clippedNvalues, y->n);
     261        if (!psVectorClipFitPolynomial2D (map->y, results->yStats, mask, 0xff, y, wt, X, Y)) {
     262            psError(PS_ERR_UNKNOWN, false, "failure in clip-fitting for y\n");
     263            psFree (x);
     264            psFree (y);
     265            psFree (X);
     266            psFree (Y);
     267            psFree (wt);
     268            psFree (mask);
     269
     270            return results;
     271        }
    254272        psTrace ("psModules.astrom", 3, "y resid: %f +/- %f (%ld of %ld)\n", results->yStats->clippedMean, results->yStats->clippedStdev, results->yStats->clippedNvalues, y->n);
    255273    }
     
    598616        // only check bins with at least 1/2 of max bin
    599617        // XXX requiring at least 3 matches in bin
    600         int minNpts = PS_MAX (0.5*imStats->max, 3);
    601         psTrace("psModule.astrom.grid.angle", 5, "minNpts: %d, max: %d", minNpts, (int)(imStats->max));
     618        int minNpts = PS_MAX (0.5*imStats->max, 5);
     619        psTrace("psModule.astrom", 5, "minNpts: %d, min: %d, max: %d, median: %f, stdev: %f", minNpts, (int)(imStats->min), (int)(imStats->max), imStats->sampleMedian, imStats->sampleStdev);
    602620
    603621        // find the 'best' bin
    604         for (int j = 0; j < gridNP->numRows; j++)
    605         {
     622        for (int j = 0; j < gridNP->numRows; j++) {
    606623            for (int i = 0; i < gridNP->numCols; i++) {
    607 
    608                 if (NP[j][i] < minNpts)
    609                     continue;
     624                if (NP[j][i] < minNpts) continue;
    610625
    611626                // this metric emphasizes a narrow peak with lots of sources over one with few.
     
    658673    stats->nTest = sort->data.U32[sort->n - 5];
    659674    stats->nSigma = (stats->nMatch - stats->nTest) / sqrt(stats->nTest);
     675    // XXX this needs a better analysis of the image histogram..
     676    // fprintf (stderr, "sigma: nMatch: %d, nTest: %d, nTen: %d\n", stats->nMatch, stats->nTest, sort->data.U32[sort->n - 10]);
    660677
    661678    psFree (sort);
     
    742759            newStat->center = center;
    743760
    744             if (newStat->minMetric < minStat->minMetric) {
     761            if (isfinite(newStat->minMetric) && (newStat->minMetric < minStat->minMetric)) {
    745762                *minStat = *newStat;
    746763                psLogMsg ("psModule.astrom", 4, "grid test - offset: %7.2f,%7.2f @ %6.1f deg x %7.3f (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric) *",
Note: See TracChangeset for help on using the changeset viewer.