Changeset 5725 for branches/eam_rel9_b0/psModules/src/objects/pmPSFtry.c
- Timestamp:
- Dec 7, 2005, 9:16:37 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_rel9_b0/psModules/src/objects/pmPSFtry.c
r5255 r5725 183 183 184 184 // XXX this function wants aperture radius for pmSourcePhotometry 185 pmPSFtryMetric (try186 , RADIUS);185 pmPSFtryMetric_Alt (try 186 , RADIUS); 187 187 psLogMsg ("psphot.pspsf", 3, "try model %s, ap-fit: %f +/- %f, sky bias: %f\n", 188 188 modelName, try … … 305 305 306 306 // linear fit to rfBin, daBin 307 psPolynomial1D *poly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 1); 307 psPolynomial1D *poly = psPolynomial1DAlloc(1, PS_POLYNOMIAL_ORD); 308 psStats *fitstat = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 309 poly = psVectorClipFitPolynomial1D (poly, fitstat, maskB, 1, daBin, NULL, rfBin); 308 310 309 311 // XXX EAM : this is the intended API (cycle 7? cycle 8?) 310 poly = psVectorFitPolynomial1D(poly, maskB, 1, daBin, NULL, rfBin);312 // poly = psVectorFitPolynomial1D(poly, maskB, 1, daBin, NULL, rfBin); 311 313 312 314 // XXX EAM : replace this when the above version is implemented … … 334 336 psFree (poly); 335 337 psFree (stats); 338 psFree (fitstat); 336 339 337 340 return true; 338 341 } 342 343 bool pmPSFtryMetric_Alt (pmPSFtry *try 344 , float RADIUS) 345 { 346 347 // the measured (aperture - fit) magnitudes (dA == try->metric) 348 // depend on both the true ap-fit (dAo) and the bias in the sky measurement: 349 // dA = dAo + dsky/flux 350 // where flux is the flux of the star 351 // we fit this trend to find the infinite flux aperture correction (dAo), 352 // the nominal sky bias (dsky), and the error on dAo 353 // the values of dA are contaminated by stars with close neighbors in the aperture 354 // we use an outlier rejection to avoid this bias 355 356 // rflux = ten(0.4*fitMag); 357 psVector *rflux = psVectorAlloc (try 358 ->sources->n, PS_TYPE_F64); 359 for (int i = 0; i < try 360 ->sources->n; i++) { 361 if (try 362 ->mask->data.U8[i] & PSFTRY_MASK_ALL) continue; 363 rflux->data.F64[i] = pow(10.0, 0.4*try 364 ->fitMag->data.F64[i]); 365 } 366 367 // XXX EAM : try 3hi/1lo sigma clipping on the rflux vs metric fit 368 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 369 370 // XXX EAM 371 stats->min = 1.0; 372 stats->max = 3.0; 373 stats->clipIter = 3; 374 375 // linear clipped fit to rfBin, daBin 376 psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD); 377 poly = psVectorClipFitPolynomial1D (poly, stats, try 378 ->mask, PSFTRY_MASK_ALL, try 379 ->metric, NULL, rflux); 380 381 try 382 ->psf->ApResid = poly->coeff[0]; 383 try 384 ->psf->dApResid = stats->sampleStdev; 385 try 386 ->psf->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS)); 387 388 psFree (rflux); 389 psFree (poly); 390 psFree (stats); 391 392 // psFree (daFit); 393 // psFree (daResid); 394 395 return true; 396 }
Note:
See TracChangeset
for help on using the changeset viewer.
