IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10859


Ignore:
Timestamp:
Dec 29, 2006, 5:27:19 PM (19 years ago)
Author:
magnier
Message:

setting the stats for clipping

Location:
trunk/psModules/src
Files:
5 edited

Legend:

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

    r10851 r10859  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-12-29 18:29:59 $
     9*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-12-30 03:27:19 $
    1111*
    1212*  Copyright 2006 Institute for Astronomy, University of Hawaii
     
    128128            fscanf (stdin, "%c", &key);
    129129
    130             // fit the collection of positions and offsets with a local 1st order gradient
    131             // 3hi/3lo sigma clipping on the rflux vs metric fit
     130            // stats structure and mask for use in measuring the clipping statistic
     131            // this analysis has too few data points to use the robust median method
    132132            psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    133133            psVector *mask = psVectorAlloc (Npts, PS_TYPE_MASK);
     
    136136            pmAstromGradient *grad = pmAstromGradientAlloc ();
    137137
    138             psVectorStats (stats, L, NULL, NULL, 0);
    139             grad->FP.x = stats->sampleMedian;
    140 
    141             psVectorStats (stats, M, NULL, NULL, 0);
    142             grad->FP.y = stats->sampleMedian;
    143 
    144             // test how many survive and include / exclude points on that basis
     138            // fit the collection of positions and offsets with a local 1st order gradient
     139            // apply 3hi/3lo sigma clipping to the fitted data values
     140            // the mask is used to mark the points which pass / fail the fit
    145141            if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dP, NULL, L, M)) {
    146142                psFree (grad);
     
    151147            grad->dTPdM.x = local->coeff[0][1];
    152148
     149            // fit the collection of positions and offsets with a local 1st order gradient
     150            // apply 3hi/3lo sigma clipping to the fitted data values
     151            // the mask is used to mark the points which pass / fail the fit
    153152            if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dQ, NULL, L, M)) {
    154153                psFree (grad);
     
    159158            grad->dTPdM.y = local->coeff[0][1];
    160159
     160            // also measure the L and M median positions as a representative coordinate
     161            psVectorStats (stats, L, NULL, NULL, 0);
     162            grad->FP.x = stats->sampleMedian;
     163
     164            psVectorStats (stats, M, NULL, NULL, 0);
     165            grad->FP.y = stats->sampleMedian;
     166
    161167            psArrayAdd (gradients, 100, grad);
    162168            psFree (grad);
     169            psFree (stats);
     170            psFree (mask);
    163171        }
    164172    }
     
    210218    fscanf (stdin, "%c", &key);
    211219
     220    // mask and stats structure for measuring the clipping statistic
     221    // this analysis has too few data points to use the robust median method
    212222    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    213223    psVector *mask = psVectorAlloc (gradients->n, PS_TYPE_MASK);
     
    217227    // determine the gradient order(s) from the fpa->toTP structure
    218228    localX = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, fpa->toTPA->x->nX-1, fpa->toTPA->x->nY);
    219 
    220229    localY = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, fpa->toTPA->x->nX,   fpa->toTPA->x->nY-1);
    221230
    222     // set masks based on fpa->toTP
     231    // set masks based on fpa->toTPA
    223232    for (int i = 0; i <= fpa->toTPA->x->nX; i++) {
    224233        for (int j = 0; j <= fpa->toTPA->x->nY; j++) {
     
    246255
    247256    // XXX test: generate fit
    248     psVector *dPdLf = psPolynomial2DEvalVector (localX, L, M);
    249     psVector *dPdMf = psPolynomial2DEvalVector (localY, L, M);
     257    psVector *dPdLfit = psPolynomial2DEvalVector (localX, L, M);
     258    psVector *dPdMfit = psPolynomial2DEvalVector (localY, L, M);
    250259
    251260    // update fpa->toTP distortion terms
     
    291300
    292301    // XXX test: generate fit
    293     psVector *dQdLf = psPolynomial2DEvalVector (localX, L, M);
    294     psVector *dQdMf = psPolynomial2DEvalVector (localY, L, M);
     302    psVector *dQdLfit = psPolynomial2DEvalVector (localX, L, M);
     303    psVector *dQdMfit = psPolynomial2DEvalVector (localY, L, M);
    295304
    296305    FILE *f = fopen ("gradients.dat", "w");
    297     for (int i = 0; i < dPdLf->n; i++) {
     306    for (int i = 0; i < dPdLfit->n; i++) {
    298307        fprintf (f, "%f %f  | %f %f  %f %f | %f %f  %f %f\n",
    299308                 L->data.F32[i], M->data.F32[i],
    300309                 dPdL->data.F32[i], dPdM->data.F32[i],
    301310                 dQdL->data.F32[i], dQdM->data.F32[i],
    302                  dPdLf->data.F32[i], dPdMf->data.F32[i],
    303                  dQdLf->data.F32[i], dQdMf->data.F32[i]);
     311                 dPdLfit->data.F32[i], dPdMfit->data.F32[i],
     312                 dQdLfit->data.F32[i], dQdMfit->data.F32[i]);
    304313    }
    305314    fclose (f);
     315    psFree (dPdLfit);
     316    psFree (dPdMfit);
     317    psFree (dQdLfit);
     318    psFree (dQdMfit);
    306319
    307320    // update fpa->toTP distortion terms
     
    337350    psFree (mask);
    338351
    339     // XXX need to reset the fromFPA terms here
    340 
     352    // XXX need to reset the fromTPA terms here
     353    // XXX choose an appropriate region based on the range of values
     354    // in L and M?
     355    psRegion region = psRegionSet (0, 4000, 0, 4000);
     356    psPlaneTransformInvert(fpa->fromTPA, fpa->toTPA, region, 50);
    341357
    342358    return true;
  • trunk/psModules/src/astrom/pmAstrometryObjects.c

    r10852 r10859  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-12-29 18:30:36 $
     10*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-12-30 03:27:19 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    227227    psVectorInit (mask, 0);
    228228
     229    // the stats options supplied are used to perform the clip fitting
    229230    pmAstromFitResults *results = pmAstromFitResultsAlloc();
    230231    results->xStats = psStatsAlloc (PS_STAT_NONE);
  • trunk/psModules/src/astrom/pmAstrometryWCS.c

    r10850 r10859  
    77 *  @author EAM, IfA
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2006-12-29 18:29:34 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2006-12-30 03:27:19 $
    1111 *
    1212 *  Copyright 2006 Institute for Astronomy, University of Hawaii
     
    453453    }
    454454
     455    // free an existing toFPA structure
    455456    chip->toFPA = toFPA;
    456457    // XXX this needs to perform the full (non-linear) inversion
  • trunk/psModules/src/detrend/pmShutterCorrection.c

    r10410 r10859  
    226226    line->coeff[1][1] = 0;
    227227
    228     psStats *stats = psStatsAlloc(0);
     228    // the stats structure determines how the clipping statistic is measured
     229    // too few points to use the robust analysis method
     230    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    229231    stats->clipSigma = rej;
    230232    stats->clipIter = nIter;
  • trunk/psModules/src/objects/pmPSFtry.c

    r10853 r10859  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-12-29 18:31:11 $
     7 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-12-30 03:27:19 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    208208
    209209    // use 3hi/3lo sigma clipping on the chisq fit
    210     psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
     210    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
    211211    stats->clipSigma = 3.0;
    212212    stats->clipIter = 3;
     
    214214    // linear clipped fit of chisq trend vs flux
    215215    bool result = psVectorClipFitPolynomial1D(psfTry->psf->ChiTrend, stats, mask, 1, chisq, NULL, flux);
    216     psLogMsg ("pmPSFtry", 4, "chisq vs flux fit: %f +/- %f\n", stats->sampleMedian, stats->sampleStdev);
     216    psLogMsg ("pmPSFtry", 4, "chisq vs flux fit: %f +/- %f\n", stats->robustMedian, stats->robustStdev);
    217217
    218218    psFree (flux);
     
    262262
    263263    // use 3hi/1lo sigma clipping on the r2rflux vs metric fit
    264     psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
     264    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
    265265    stats->min = 1.0;
    266266    stats->max = 3.0;
     
    363363    // mask is currently updated for each pass. this is inconsistent?
    364364
    365     psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
     365    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
    366366
    367367    // skip the unfitted parameters (X, Y, Io, Sky)
Note: See TracChangeset for help on using the changeset viewer.