IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

setting the stats for clipping

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.