IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10877


Ignore:
Timestamp:
Jan 2, 2007, 2:57:10 PM (19 years ago)
Author:
magnier
Message:

plugged leaks

File:
1 edited

Legend:

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

    r10872 r10877  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2007-01-01 21:05:09 $
     9*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2007-01-03 00:57:10 $
    1111*
    1212*  Copyright 2006 Institute for Astronomy, University of Hawaii
     
    7777            int Ymax = Ymin + DY;
    7878
     79            psStats *stats = NULL;
     80            psVector *mask = NULL;
     81            pmAstromGradient *grad = NULL;
     82
    7983            psVector *L  = psVectorAllocEmpty (100, PS_TYPE_F32);
    8084            psVector *M  = psVectorAllocEmpty (100, PS_TYPE_F32);
    8185            psVector *dP = psVectorAllocEmpty (100, PS_TYPE_F32);
    8286            psVector *dQ = psVectorAllocEmpty (100, PS_TYPE_F32);
    83             int Npts = 0;
    8487
    8588            // XXX this is a bit inefficient: first sorting by X or Y could speed this up.
    8689            // XXX or assigning to a segment in a single pass first
    8790            // select the stars within this chip region
     91            int Npts = 0;
    8892            for (int i = 0; i < matches->n; i++) {
    8993
     
    106110                M->data.F32[Npts] = ref->FP->y;
    107111
    108                 dP->data.F32[Npts] = ref->TP->x - raw->TP->x;
    109                 dQ->data.F32[Npts] = ref->TP->y - raw->TP->y;
     112                // P,Q = L,M + terms of order epsilon.
     113                // measuring the gradient constrains thos terms
     114                dP->data.F32[Npts] = ref->TP->x - raw->FP->x;
     115                dQ->data.F32[Npts] = ref->TP->y - raw->FP->y;
    110116
    111117                psVectorExtend (L, 100, 1);
     
    115121                Npts++;
    116122            }
     123
    117124            if (Npts < 5)
    118                 continue;
     125                goto skip;
    119126
    120127            // stats structure and mask for use in measuring the clipping statistic
    121128            // this analysis has too few data points to use the robust median method
    122             psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    123             psVector *mask = psVectorAlloc (Npts, PS_TYPE_MASK);
     129            stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
     130            mask = psVectorAlloc (Npts, PS_TYPE_MASK);
    124131            psVectorInit (mask, 0);
    125132
    126             pmAstromGradient *grad = pmAstromGradientAlloc ();
     133            grad = pmAstromGradientAlloc ();
    127134
    128135            // fit the collection of positions and offsets with a local 1st order gradient
     
    130137            // the mask is used to mark the points which pass / fail the fit
    131138            if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dP, NULL, L, M)) {
    132                 psFree (grad);
    133                 continue;
     139                goto skip;
    134140            }
    135141
     
    141147            // the mask is used to mark the points which pass / fail the fit
    142148            if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dQ, NULL, L, M)) {
    143                 psFree (grad);
    144                 continue;
     149                goto skip;
    145150            }
    146151
     
    156161
    157162            psArrayAdd (gradients, 100, grad);
     163
     164skip:
    158165            psFree (grad);
    159166            psFree (stats);
    160167            psFree (mask);
    161         }
    162     }
     168            psFree (L);
     169            psFree (M);
     170            psFree (dP);
     171            psFree (dQ);
     172        }
     173    }
     174    psFree (local);
    163175    return gradients;
    164176}
     
    191203        M->data.F32[i] = grad->FP.y;
    192204    }
    193 
    194     char key;
    195     pmKapaPlotVectorPair (L, M);
    196     fscanf (stdin, "%c", &key);
    197 
    198     pmKapaPlotVectorPair (L, dPdL);
    199     fscanf (stdin, "%c", &key);
    200 
    201     pmKapaPlotVectorPair (L, dPdM);
    202     fscanf (stdin, "%c", &key);
    203 
    204     pmKapaPlotVectorPair (L, dQdL);
    205     fscanf (stdin, "%c", &key);
    206 
    207     pmKapaPlotVectorPair (L, dQdM);
    208     fscanf (stdin, "%c", &key);
    209205
    210206    // mask and stats structure for measuring the clipping statistic
Note: See TracChangeset for help on using the changeset viewer.