Changeset 14936 for trunk/psModules/src/objects/pmPSF.c
- Timestamp:
- Sep 20, 2007, 2:05:57 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSF.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSF.c
r14652 r14936 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 8-24 00:11:02$8 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-09-21 00:05:35 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 #include "pmResiduals.h" 30 30 #include "pmGrowthCurve.h" 31 #include "pmTrend2D.h" 31 32 #include "pmPSF.h" 32 33 #include "pmModel.h" … … 108 109 psf->poissonErrors = poissonErrors; 109 110 110 // the ApTrend components are (x, y, r2rflux, flux) 111 // the ApTrend order is defined by the masking 112 // initially we set it to SKYBIAS (no X,Y variation) 113 // this is adjusted in psphotApResid based on the user's choices 114 psf->ApTrend = psPolynomial4DAlloc (PS_POLYNOMIAL_ORD, 2, 2, 1, 1); 115 pmPSFMaskApTrend (psf->ApTrend, PM_PSF_APTREND_SKYBIAS); 111 // the ApTrend components are (x, y). It may be represented with a polynomial or with a 112 // psImageMap. We set it initially to NULL. the user must allocate it before using. 113 // psf->ApTrend = pmTrend2DAlloc (PM_TREND_MAP, Nx, Ny, 1, 1, stats); 114 psf->ApTrend = NULL; 116 115 117 116 if (psf->poissonErrors) { … … 166 165 } 167 166 168 // zero and mask out all terms:169 static bool maskAllApTerms (psPolynomial4D *trend)170 {171 172 for (int i = 0; i < trend->nX + 1; i++) {173 for (int j = 0; j < trend->nY + 1; j++) {174 for (int k = 0; k < trend->nZ + 1; k++) {175 for (int m = 0; m < trend->nT + 1; m++) {176 trend->mask[i][j][k][m] = 1; // mask coeff177 trend->coeff[i][j][k][m] = 0; // zero coeff178 }179 }180 }181 }182 return true;183 }184 185 167 // the PSF models the \sigma_{xy} variation of the elliptical contour as a function of position in the image with a 186 168 // polynomial. an individual object has a contour of the form (x^2/2sx^2) + (y^2/2sy^2) + sxy*x*y … … 344 326 } 345 327 346 /***********************************************347 * this function masks the psf.ApTrend polynomial348 * to enable the specific subset of the coefficients349 **********************************************/350 bool pmPSFMaskApTrend (psPolynomial4D *trend,351 pmPSFApTrendOptions option)352 {353 354 switch (option) {355 case PM_PSF_APTREND_NONE:356 maskAllApTerms (trend);357 return true;358 359 case PM_PSF_APTREND_CONSTANT:360 maskAllApTerms (trend);361 trend->mask[0][0][0][0] = 0; // unmask constant362 return true;363 364 case PM_PSF_APTREND_SKYBIAS:365 maskAllApTerms (trend);366 trend->mask[0][0][0][0] = 0; // unmask constant367 trend->mask[0][0][1][0] = 0; // unmask skybias368 return true;369 370 case PM_PSF_APTREND_SKYSAT:371 maskAllApTerms (trend);372 trend->mask[0][0][0][0] = 0; // unmask constant373 trend->mask[0][0][1][0] = 0; // unmask skybias374 trend->mask[0][0][0][1] = 0; // unmask skysat375 return true;376 377 case PM_PSF_APTREND_XY_LIN:378 maskAllApTerms (trend);379 trend->mask[0][0][0][0] = 0; // unmask constant380 trend->mask[1][0][0][0] = 0; // unmask x381 trend->mask[0][1][0][0] = 0; // unmask y382 return true;383 384 case PM_PSF_APTREND_XY_QUAD:385 maskAllApTerms (trend);386 trend->mask[0][0][0][0] = 0; // unmask constant387 trend->mask[1][0][0][0] = 0; // unmask x388 trend->mask[2][0][0][0] = 0; // unmask x^2389 trend->mask[1][1][0][0] = 0; // unmask x y390 trend->mask[0][1][0][0] = 0; // unmask y391 trend->mask[0][2][0][0] = 0; // unmask y^2392 return true;393 394 case PM_PSF_APTREND_SKY_XY_LIN:395 maskAllApTerms (trend);396 trend->mask[0][0][0][0] = 0; // unmask constant397 trend->mask[1][0][0][0] = 0; // unmask x398 trend->mask[0][1][0][0] = 0; // unmask y399 trend->mask[0][0][1][0] = 0; // unmask skybias400 return true;401 402 case PM_PSF_APTREND_SKYSAT_XY_LIN:403 maskAllApTerms (trend);404 trend->mask[0][0][0][0] = 0; // unmask constant405 trend->mask[1][0][0][0] = 0; // unmask x406 trend->mask[0][1][0][0] = 0; // unmask y407 trend->mask[0][0][1][0] = 0; // unmask skybias408 trend->mask[0][0][0][1] = 0; // unmask skysat409 return true;410 411 case PM_PSF_APTREND_ALL:412 default:413 maskAllApTerms (trend);414 trend->mask[0][0][0][0] = 0; // unmask constant415 trend->mask[0][0][1][0] = 0; // unmask skybias416 trend->mask[0][0][0][1] = 0; // unmask skysat417 418 trend->mask[1][0][0][0] = 0; // unmask x419 trend->mask[2][0][0][0] = 0; // unmask x^2420 trend->mask[1][1][0][0] = 0; // unmask x y421 trend->mask[0][1][0][0] = 0; // unmask y422 trend->mask[0][2][0][0] = 0; // unmask y^2423 return true;424 }425 return false;426 }427 428 pmPSFApTrendOptions pmPSFApTrendOptionFromName (char *name)429 {430 431 // no correction432 if (!strcasecmp (name, "NONE"))433 return PM_PSF_APTREND_NONE;434 if (!strcasecmp (name, "CONSTANT"))435 return PM_PSF_APTREND_CONSTANT;436 if (!strcasecmp (name, "SKYBIAS"))437 return PM_PSF_APTREND_SKYBIAS;438 if (!strcasecmp (name, "SKYSAT"))439 return PM_PSF_APTREND_SKYSAT;440 if (!strcasecmp (name, "XY_LIN"))441 return PM_PSF_APTREND_XY_LIN;442 if (!strcasecmp (name, "XY_QUAD"))443 return PM_PSF_APTREND_XY_QUAD;444 if (!strcasecmp (name, "SKY_XY_LIN"))445 return PM_PSF_APTREND_SKY_XY_LIN;446 if (!strcasecmp (name, "SKYSAT_XY_LIN"))447 return PM_PSF_APTREND_SKYSAT_XY_LIN;448 if (!strcasecmp (name, "ALL"))449 return PM_PSF_APTREND_ALL;450 451 psError(PS_ERR_UNKNOWN, true, "Unknown APTREND value: %s", name);452 return PM_PSF_APTREND_ERROR;453 }454 455 328 // we generate the growth curve for the center of the image with the specified psf model 456 329 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark)
Note:
See TracChangeset
for help on using the changeset viewer.
