Changeset 4901 for trunk/psphot/src/pspsf.c
- Timestamp:
- Aug 29, 2005, 5:44:55 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/pspsf.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/pspsf.c
r4642 r4901 1 1 # include "psphot.h" 2 3 static void pmPSFFree (pmPSF *psf) { 4 5 if (psf == NULL) return; 6 7 psFree (psf->params); 8 return; 9 } 2 10 3 11 // a PSF always has 4 parameters fewer than the equivalent model … … 16 24 return(NULL); 17 25 } 26 18 27 psf->params = psArrayAlloc (Nparams - 4); 19 28 for (int i = 0; i < psf->params->n; i++) { … … 21 30 psf->params->data[i] = Polynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD); 22 31 } 23 // set the destructors 32 33 p_psMemSetDeallocator(psf, (psFreeFcn) pmPSFFree); 24 34 return(psf); 35 } 36 37 static 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; 25 49 } 26 50 … … 32 56 test->modelType = psModelSetType (modelName); 33 57 test->psf = pmPSFAlloc (test->modelType); 34 test->sources = sources;58 test->sources = psMemCopy(sources); 35 59 test->modelFLT = psArrayAlloc (sources->n); 36 60 test->modelPSF = psArrayAlloc (sources->n); … … 49 73 test->fitMag->data.F64[i] = 0; 50 74 } 51 // set the destructors 52 75 76 p_psMemSetDeallocator(test, (psFreeFcn) pmPSF_TestFree); 53 77 return (test); 54 78 } … … 74 98 psTimerStart ("fit"); 75 99 for (int i = 0; i < test->sources->n; i++) { 100 76 101 psSource *source = test->sources->data[i]; 77 102 psModel *model = pmSourceModelGuess (source, test->modelType); … … 88 113 if (!status) { 89 114 test->mask->data.U8[i] = 2; 115 psFree (model); 90 116 continue; 91 117 } … … 122 148 if (!status) { 123 149 test->mask->data.U8[i] = 3; 150 psFree (modelPSF); 124 151 goto next_source; 125 152 } … … 154 181 psLogMsg ("psphot.pspsf", 3, "test model %s, ap-fit: %f +/- %f, sky bias: %f\n", 155 182 modelName, test->ApResid, test->dApResid, test->skyBias); 183 156 184 return (test); 157 185 } … … 223 251 float dBin; 224 252 int nKeep, nSkip; 225 226 253 227 254 // the measured (aperture - fit) magnitudes (dA == test->metric) … … 280 307 if (tmp->n < 2) { 281 308 maskB->data.U8[i] = 1; 309 psFree (tmp); 282 310 continue; 283 311 } … … 327 355 test->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS)); 328 356 329 psFree ( maskB);357 psFree (rflux); 330 358 psFree (rfBin); 331 359 psFree (daBin); 360 psFree (maskB); 332 361 psFree (daBinFit); 333 362 psFree (daResid);
Note:
See TracChangeset
for help on using the changeset viewer.
