IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 28, 2005, 7:04:10 AM (21 years ago)
Author:
eugene
Message:

cleanup memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/pspsf.c

    r4375 r4642  
    2121        psf->params->data[i] = Polynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD);
    2222    }
     23    // set the destructors
    2324    return(psf);
    2425}
     
    4849        test->fitMag->data.F64[i] = 0;
    4950    }   
     51    // set the destructors
     52
    5053    return (test);
    5154}
     
    9295    psLogMsg ("psphot.psftest", 4, "fit flt:   %f sec for %d sources\n", psTimerMark ("fit"), sources->n);
    9396    psTrace ("psphot.psftest", 3, "keeping %d of %d PSF candidates (FLT)\n", Nflt, sources->n);
    94     DumpModelFits (test->modelFLT, "modelsFLT.dat");
     97
     98    // make this optional?
     99    // DumpModelFits (test->modelFLT, "modelsFLT.dat");
    95100
    96101    // stage 2: construct a psf (pmPSF) from this collection of model fits
     
    141146    psLogMsg ("psphot.psftest", 4, "fit psf:   %f sec for %d sources\n", psTimerMark ("fit"), sources->n);
    142147    psTrace ("psphot.psftest", 3, "keeping %d of %d PSF candidates (PSF)\n", Npsf, sources->n);
    143     DumpModelFits (test->modelPSF, "modelsPSF.dat");
     148
     149    // make this optional
     150    // DumpModelFits (test->modelPSF, "modelsPSF.dat");
    144151
    145152    // XXX this function wants aperture radius from pmSourcePhotometry
     
    188195        // psPolynomial2DDump (psf->params->data[i]);
    189196    }
     197   
     198    psFree (x);
     199    psFree (y);
     200    psFree (z);
     201    psFree (dz);
    190202    return (true);
    191203}
     
    228240    rflux->data.F64[i] = pow(10.0, 0.4*test->fitMag->data.F64[i]);
    229241  }
    230   // psScalar *t1 = psScalar(0.4);
    231   // psVector *v1 = psBinaryOp (NULL, test->fitMag, "*", t1);
    232   // psVector *rflux = psUnaryOp (NULL, v1, "ten");
    233   // psFree (t1);
    234   // psFree (v1);
    235242
    236243  // find min and max of (1/flux):
     
    247254  psTrace ("psphot.metricmodel", 3, "rflux max: %g, min: %g, delta: %g\n", stats->max, stats->min, dBin);
    248255
     256  // group data in daBin bins, measure lower 50% mean
    249257  for (int i = 0; i < daBin->n; i++) {
    250258
     
    277285    // dA values are contaminated with low outliers
    278286    // measure statistics only on upper 50% of points
     287    // this would be easier if we could sort in reverse:
     288    //
     289    // psVectorSort (tmp, tmp);
     290    // tmp->n = 0.5*tmp->n;
     291    // stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN);
     292    // psVectorStats (stats, tmp, NULL, NULL, 0);
     293    // psTrace ("psphot.metricmodel", 4, "rfBin %d (%g): %d pts, %g\n", i, rfBin->data.F64[i], tmp->n, stats->sampleMedian);
     294
    279295    psVectorSort (tmp, tmp);
    280296    nKeep = 0.5*tmp->n;
     
    291307
    292308    daBin->data.F64[i] = stats->sampleMedian;
     309
     310    psFree (stats);
     311    psFree (tmp);
     312    psFree (tmp2);
    293313  }
    294314
     
    307327  test->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS));
    308328
     329  psFree (maskB);
     330  psFree (rfBin);
     331  psFree (daBin);
     332  psFree (daBinFit);
     333  psFree (daResid);
     334  psFree (poly);
     335  psFree (stats);
     336
    309337  return true;
    310338}
Note: See TracChangeset for help on using the changeset viewer.