Changeset 13514
- Timestamp:
- May 24, 2007, 2:16:03 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSFtry.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSFtry.c
r13431 r13514 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-05- 18 17:15:35$7 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-05-25 00:16:03 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 168 168 if (!status) { 169 169 psfTry->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL; 170 psTrace ("psModules.pmPSFtry", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y); 170 171 continue; 171 172 } … … 174 175 if (!pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP)) { 175 176 psfTry->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT; 177 psTrace ("psModules.pmPSFtry", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y); 176 178 continue; 177 179 } … … 261 263 } 262 264 265 // XXX this analysis of the apResid statistics is only approximate. The fitted magnitudes 266 // measure at this point (in the PSF fit) use Poisson errors, and are thus biased as a 267 // function of magnitude. We re-measure the apResid statistics later in psphot using the 268 // linear, constant-error fitting. Do not reject outliers with excessive vigor here. 269 263 270 // use 3hi/1lo sigma clipping on the r2rflux vs metric fit 264 271 psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 265 stats->min = 1.0; 266 stats->max = 3.0; 272 stats->clipSigma = 3.0; 267 273 stats->clipIter = 3; 274 275 // XXX we used to include an asymmetric clipping in order to toss out contaminated stars. 276 // test this on the very crowded field data. 277 // stats->min = 1.0; 278 // stats->max = 3.0; 268 279 269 280 // fit ApTrend only to r2rflux, ignore x,y,flux variations for now 270 281 // linear clipped fit of ApResid to r2rflux 271 282 psPolynomial1D *poly = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 1); 272 273 // XXX test to only fit a constant offset (no SKYBIAS) 274 poly->mask[1] = 1; 283 poly->mask[1] = 1; // fit only a constant offset (no SKYBIAS) 275 284 276 285 bool result = psVectorClipFitPolynomial1D (poly, stats, psfTry->mask, PSFTRY_MASK_ALL, psfTry->metric, psfTry->metricErr, r2rflux); … … 284 293 return false; 285 294 } 286 psLogMsg ("pmPSFtryMetric", 4, "fit stats: %f +/- %f\n", stats->robustMedian, stats->robustStdev); 287 psLogMsg ("pmPSFtryMetric", 4, "apresid: %f +/- %f\n", poly->coeff[0], poly->coeffErr[0]); 295 psLogMsg ("pmPSFtryMetric", 4, "apresid: %f +/- %f; keeping %ld of %ld psf stars\n", poly->coeff[0], stats->robustStdev, stats->clippedNvalues, psfTry->sources->n); 288 296 289 297 // XXX test dump of fitted model (dump when tracing?) … … 403 411 for (int i = 0; i < stats->clipIter; i++) { 404 412 psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E0], stats, psfTry->mask, 0xff, e0, dz, x, y); 413 psTrace ("psModules.pmPSFtry", 4, "clipped E0 : keeping %ld of %ld\n", stats->clippedNvalues, e0->n); 405 414 psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E1], stats, psfTry->mask, 0xff, e1, dz, x, y); 415 psTrace ("psModules.pmPSFtry", 4, "clipped E1 : keeping %ld of %ld\n", stats->clippedNvalues, e1->n); 406 416 psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E2], stats, psfTry->mask, 0xff, e2, dz, x, y); 407 } 417 psTrace ("psModules.pmPSFtry", 4, "clipped E2 : keeping %ld of %ld\n", stats->clippedNvalues, e2->n); 418 } 419 420 // XXX temporary dump of the psf parameters 421 if (psTraceGetLevel("psModules.objects") >= 4) { 422 FILE *f = fopen ("pol.dat", "w"); 423 for (int i = 0; i < e0->n; i++) { 424 fprintf (f, "%f %f : %f %f %f : %d\n", 425 x->data.F64[i], y->data.F64[i], 426 e0->data.F64[i], e1->data.F64[i], e2->data.F64[i], psfTry->mask->data.U8[i]); 427 } 428 fclose (f); 429 } 430 408 431 psFree (e0); 409 432 psFree (e1);
Note:
See TracChangeset
for help on using the changeset viewer.
