IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 29, 2005, 5:44:55 PM (21 years ago)
Author:
eugene
Message:

various psphot updates

File:
1 edited

Legend:

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

    r4642 r4901  
    11# include "psphot.h"
     2
     3static void pmPSFFree (pmPSF *psf) {
     4
     5  if (psf == NULL) return;
     6
     7  psFree (psf->params);
     8  return;
     9}
    210
    311// a PSF always has 4 parameters fewer than the equivalent model
     
    1624        return(NULL);
    1725    }     
     26
    1827    psf->params = psArrayAlloc (Nparams - 4);
    1928    for (int i = 0; i < psf->params->n; i++) {
     
    2130        psf->params->data[i] = Polynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD);
    2231    }
    23     // set the destructors
     32
     33    p_psMemSetDeallocator(psf, (psFreeFcn) pmPSFFree);
    2434    return(psf);
     35}
     36
     37static void pmPSF_TestFree (pmPSF_Test *test) {
     38
     39  if (test == NULL) return;
     40
     41  psFree (test->psf);
     42  psFree (test->sources);
     43  psFree (test->modelFLT);
     44  psFree (test->modelPSF);
     45  psFree (test->metric);
     46  psFree (test->fitMag);
     47  psFree (test->mask);
     48  return;
    2549}
    2650
     
    3256    test->modelType   = psModelSetType (modelName);
    3357    test->psf         = pmPSFAlloc (test->modelType);
    34     test->sources     = sources;
     58    test->sources     = psMemCopy(sources);
    3559    test->modelFLT    = psArrayAlloc (sources->n);
    3660    test->modelPSF    = psArrayAlloc (sources->n);
     
    4973        test->fitMag->data.F64[i] = 0;
    5074    }   
    51     // set the destructors
    52 
     75
     76    p_psMemSetDeallocator(test, (psFreeFcn) pmPSF_TestFree);
    5377    return (test);
    5478}
     
    7498    psTimerStart ("fit");
    7599    for (int i = 0; i < test->sources->n; i++) {
     100
    76101        psSource *source = test->sources->data[i];
    77102        psModel  *model  = pmSourceModelGuess (source, test->modelType);
     
    88113        if (!status) {
    89114          test->mask->data.U8[i] = 2;
     115          psFree (model);
    90116          continue;
    91117        }
     
    122148        if (!status) {
    123149            test->mask->data.U8[i] = 3;
     150            psFree (modelPSF);
    124151            goto next_source;
    125152        }
     
    154181    psLogMsg ("psphot.pspsf", 3, "test model %s, ap-fit: %f +/- %f, sky bias: %f\n",
    155182              modelName, test->ApResid, test->dApResid, test->skyBias);
     183
    156184    return (test);
    157185}
     
    223251  float dBin;
    224252  int   nKeep, nSkip;
    225  
    226253
    227254  // the measured (aperture - fit) magnitudes (dA == test->metric)
     
    280307    if (tmp->n < 2) {
    281308      maskB->data.U8[i] = 1;
     309      psFree (tmp);
    282310      continue;
    283311    }
     
    327355  test->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS));
    328356
    329   psFree (maskB);
     357  psFree (rflux);
    330358  psFree (rfBin);
    331359  psFree (daBin);
     360  psFree (maskB);
    332361  psFree (daBinFit);
    333362  psFree (daResid);
Note: See TracChangeset for help on using the changeset viewer.