Changeset 4642
- Timestamp:
- Jul 28, 2005, 7:04:10 AM (21 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 9 edited
-
LocalSky.c (modified) (3 diffs)
-
apply_psf_model.c (modified) (1 diff)
-
basic_classes.c (modified) (1 diff)
-
choose_psf_model.c (modified) (4 diffs)
-
find_peaks.c (modified) (4 diffs)
-
fit_galaxies.c (modified) (1 diff)
-
image_stats.c (modified) (1 diff)
-
pspsf.c (modified) (10 diffs)
-
setup.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/LocalSky.c
r4630 r4642 25 25 mySource->mask = subImageMask; 26 26 mySource->noise = subImageNoise; 27 psFree (srcRegion); 27 28 28 29 return(mySource); … … 47 48 myStats = psImageStats(myStats, image, mask, 0xff); 48 49 psImageMaskRegion (mask, srcRegion, AND, 0x7f); 50 psFree (srcRegion); 49 51 50 52 psF64 tmpF64; … … 54 56 source->moments = pmMomentsAlloc(); 55 57 source->moments->Sky = (psF32) tmpF64; 56 57 58 return (true); 58 59 } -
trunk/psphot/src/apply_psf_model.c
r4630 r4642 39 39 if (source->type == PS_SOURCE_SATURATED) continue; 40 40 41 source->modelPSF = NULL; 41 // do I even need to test? 42 if (source->modelPSF != NULL) { 43 psFree (source->modelPSF); 44 } 42 45 43 46 // use the source moments, etc to guess basic model parameters -
trunk/psphot/src/basic_classes.c
r4582 r4642 8 8 psfClump = pmSourcePSFClump (sources, config); 9 9 pmSourceRoughClass (sources, config, psfClump); 10 11 // make this optional12 // DumpMoments (sources, "moments.dat");13 10 return (true); 14 11 } -
trunk/psphot/src/choose_psf_model.c
r4630 r4642 34 34 modelName = psMetadataLookupPtr (&status, config, key); 35 35 tests->data[i] = pmPSF_TestModel (stars, modelName, RADIUS); 36 psFree (modelName); 36 37 37 sprintf (filename, "metric.%d.dat", i); 38 DumpPSFTestData (tests->data[i], filename); 38 // make this an option: 39 // sprintf (filename, "metric.%d.dat", i); 40 // DumpPSFTestData (tests->data[i], filename); 39 41 } 42 psFree (stars); 40 43 41 44 // select the best of the test models … … 46 49 for (int i = 1; i < Ntest; i++) { 47 50 test = tests->data[i]; 48 int M = test->dApResid;51 float M = test->dApResid; 49 52 if (M < bestM) { 50 53 bestM = M; … … 55 58 modelName = psModelGetType (test->modelType); 56 59 psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, test->ApResid, test->dApResid); 60 psFree (modelName); 57 61 62 // we are keeping the modelPSF fits from the PSF test, 63 // but we replace these later on (apply_psf_model) 58 64 // set source->model based on best psf model fit 59 65 for (int i = 0; i < test->sources->n; i++) { … … 67 73 } 68 74 } 69 return (test->psf); 75 pmPSF *psf = test->psf; 76 77 // free unused test models: 78 psFree (test); 79 psFree (stars); 80 81 return (psf); 70 82 } -
trunk/psphot/src/find_peaks.c
r4216 r4642 9 9 10 10 // smooth the image 11 // should we also subtract a super-binned image? (as an option?)12 11 13 12 psTimerStart ("psphot"); … … 18 17 psImage *smooth = psImageCopy (NULL, imdata->image, PS_TYPE_F32); 19 18 psImageSmooth (smooth, SIGMA, NSIGMA); 20 21 19 psLogMsg ("psphot", 4, "smooth: %f sec\n", psTimerMark ("psphot")); 22 23 // find the peaks in the smoothed image24 20 25 21 psTimerStart ("psphot"); 26 22 23 // find the peaks in the smoothed image 27 24 NSIGMA = psMetadataLookupF32 (&status, config, "PEAK_NSIGMA"); 28 25 threshold = NSIGMA*sky->sampleStdev + sky->sampleMean; … … 32 29 if (peaks == NULL) psAbort ("find peaks", "no peaks found"); 33 30 psFree (smooth); 34 // XXX Need to gracefully handle no source detections35 31 36 32 // make this optional … … 41 37 return (peaks); 42 38 } 39 40 // In this function, we smooth the image, then search for the peaks 41 // Should we also subtract a super-binned image? (as an option?) 42 // We need to gracefully handle no source detections -
trunk/psphot/src/fit_galaxies.c
r4630 r4642 32 32 if (source->type == PS_SOURCE_SATSTAR) continue; 33 33 if (source->type == PS_SOURCE_GOODSTAR) continue; 34 34 35 // skip all likely defects 35 36 if (source->type == PS_SOURCE_DEFECT) continue; 36 37 if (source->type == PS_SOURCE_SATURATED) continue; 37 // 38 39 // skip poorly fitted stars 38 40 if (source->type == PS_SOURCE_FAINTSTAR) continue; 39 41 if (source->type == PS_SOURCE_POOR_FIT_PSF) continue; -
trunk/psphot/src/image_stats.c
r4216 r4642 35 35 stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN); 36 36 stats = psVectorStats (stats, subset, NULL, NULL, 0); // use a mask? 37 psFree (subset); 38 psFree (rnd) 37 39 } 38 40 -
trunk/psphot/src/pspsf.c
r4375 r4642 21 21 psf->params->data[i] = Polynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD); 22 22 } 23 // set the destructors 23 24 return(psf); 24 25 } … … 48 49 test->fitMag->data.F64[i] = 0; 49 50 } 51 // set the destructors 52 50 53 return (test); 51 54 } … … 92 95 psLogMsg ("psphot.psftest", 4, "fit flt: %f sec for %d sources\n", psTimerMark ("fit"), sources->n); 93 96 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"); 95 100 96 101 // stage 2: construct a psf (pmPSF) from this collection of model fits … … 141 146 psLogMsg ("psphot.psftest", 4, "fit psf: %f sec for %d sources\n", psTimerMark ("fit"), sources->n); 142 147 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"); 144 151 145 152 // XXX this function wants aperture radius from pmSourcePhotometry … … 188 195 // psPolynomial2DDump (psf->params->data[i]); 189 196 } 197 198 psFree (x); 199 psFree (y); 200 psFree (z); 201 psFree (dz); 190 202 return (true); 191 203 } … … 228 240 rflux->data.F64[i] = pow(10.0, 0.4*test->fitMag->data.F64[i]); 229 241 } 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);235 242 236 243 // find min and max of (1/flux): … … 247 254 psTrace ("psphot.metricmodel", 3, "rflux max: %g, min: %g, delta: %g\n", stats->max, stats->min, dBin); 248 255 256 // group data in daBin bins, measure lower 50% mean 249 257 for (int i = 0; i < daBin->n; i++) { 250 258 … … 277 285 // dA values are contaminated with low outliers 278 286 // 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 279 295 psVectorSort (tmp, tmp); 280 296 nKeep = 0.5*tmp->n; … … 291 307 292 308 daBin->data.F64[i] = stats->sampleMedian; 309 310 psFree (stats); 311 psFree (tmp); 312 psFree (tmp2); 293 313 } 294 314 … … 307 327 test->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS)); 308 328 329 psFree (maskB); 330 psFree (rfBin); 331 psFree (daBin); 332 psFree (daBinFit); 333 psFree (daResid); 334 psFree (poly); 335 psFree (stats); 336 309 337 return true; 310 338 } -
trunk/psphot/src/setup.c
r4641 r4642 83 83 float YMAX = psMetadataLookupF32 (&status, config, "YMAX"); 84 84 psRegion *keep = psRegionAlloc (XMIN, XMAX, YMIN, YMAX); 85 keep = psRegionForImage (keep, image, keep);85 keep = psRegionForImage (keep, image, keep); 86 86 psImageKeepRegion (mask, keep, OR, 0x01); 87 psFree (keep); 87 88 88 89 // mask the saturated pixels
Note:
See TracChangeset
for help on using the changeset viewer.
