IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2006, 8:40:19 AM (20 years ago)
Author:
magnier
Message:

using a single mask for X and Y, iterate between X and Y for clip fitting in pmAstromMatchFit

File:
1 edited

Legend:

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

    r9386 r9626  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-10-07 03:54:08 $
     10*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-10-18 18:40:19 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    227227    }
    228228
    229     psStats *stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
    230     stats->clipSigma = psMetadataLookupF32 (&status, config, "PSASTRO.CHIP.NSIGMA");
    231     stats->clipIter  = psMetadataLookupS32 (&status, config, "PSASTRO.CHIP.NITER");
    232 
    233229    // XXX EAM : clip fit seems to only work for F32!
    234230    // XXX EAM : clip fit fails to handle NULL error
     
    260256
    261257    // constant errors
    262     psVector *xMask = psVectorAlloc (match->n, PS_TYPE_U8);
    263     psVector *yMask = psVectorAlloc (match->n, PS_TYPE_U8);
    264     xMask->n = yMask->n = match->n;
    265     psVectorInit (xMask, 0);
    266     psVectorInit (yMask, 0);
     258    psVector *mask = psVectorAlloc (match->n, PS_TYPE_U8);
     259    mask->n = match->n;
     260    psVectorInit (mask, 0);
    267261
    268262    double dX, dY;
     263
     264    psStats *stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
     265    stats->clipSigma = psMetadataLookupF32 (&status, config, "PSASTRO.CHIP.NSIGMA");
     266    stats->clipIter = 1;
     267    int clipIter  = psMetadataLookupS32 (&status, config, "PSASTRO.CHIP.NITER");
     268    // we run 'clipIter' cycles clipping in each of x and y
    269269
    270270    // fit chip-to-FPA transformation
    271271    // XXX should force x->n and y->n to be the same
    272     psVectorClipFitPolynomial2D (map->x, stats, xMask, 0, x, wt, X, Y);
    273     psLogMsg ("psModules.astrom", 3, "x resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, x->n);
    274     dX = stats->clippedStdev;
    275 
    276     psVectorClipFitPolynomial2D (map->y, stats, yMask, 0, y, wt, X, Y);
    277     psLogMsg ("psModules.astrom", 3, "y resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, y->n);
    278     dY = stats->clippedStdev;
     272    for (int i = 0; i < clipIter; i++) {
     273        psVectorClipFitPolynomial2D (map->x, stats, mask, 0xff, x, wt, X, Y);
     274        psLogMsg ("psModules.astrom", 3, "x resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, x->n);
     275        dX = stats->clippedStdev;
     276
     277        psVectorClipFitPolynomial2D (map->y, stats, mask, 0xff, y, wt, X, Y);
     278        psLogMsg ("psModules.astrom", 3, "y resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, y->n);
     279        dY = stats->clippedStdev;
     280    }
     281
     282    // XXXX test dump output code
     283    # if (0)
     284        psVector *xfit = psPolynomial2DEvalVector(map->x, X, Y);
     285    psVector *yfit = psPolynomial2DEvalVector(map->y, X, Y);
     286    FILE *f = fopen ("match.dat", "w");
     287    for (int i = 0; i < x->n; i++) {
     288        fprintf (f, "%3d %1d %1d %f %f  %f %f   %f %f\n",
     289                 i, mask->data.U8[i], mask->data.U8[i],
     290                 X->data.F32[i], Y->data.F32[i],
     291                 xfit->data.F32[i], yfit->data.F32[i],
     292                 x->data.F32[i], y->data.F32[i]);
     293    }
     294    fclose (f);
     295    # endif
    279296
    280297    // XXX this is somewhat ad-hoc: we need to be sure these values are in arcsec
     
    294311    psFree (wt);
    295312    psFree (stats);
    296     psFree (xMask);
    297     psFree (yMask);
     313    psFree (mask);
    298314
    299315    return (map);
     
    402418    *obj->TP   = *old->TP;
    403419    *obj->sky  = *old->sky;
     420    obj->Mag   =  old->Mag;
     421    obj->dMag  =  old->dMag;
    404422
    405423    return(obj);
Note: See TracChangeset for help on using the changeset viewer.