Changeset 9897
- Timestamp:
- Nov 7, 2006, 12:55:40 PM (20 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 4 edited
-
pmGrowthCurve.c (modified) (4 diffs)
-
pmGrowthCurve.h (modified) (1 diff)
-
pmPSF.c (modified) (3 diffs)
-
pmPSF.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmGrowthCurve.c
r9879 r9897 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-11-07 09:04:08$7 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-11-07 22:55:40 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <pslib.h> 19 19 #include "pmFPA.h" 20 #include "pmFPAMaskWeight.h"21 20 #include "pmPeaks.h" 22 21 #include "pmMoments.h" … … 26 25 #include "pmPSF.h" 27 26 #include "psVectorBracket.h" 28 #include "pmSourcePhotometry.h"29 27 30 28 static void pmGrowthCurveFree (pmGrowthCurve *growth) … … 64 62 return apCor; 65 63 } 66 67 // we generate the growth curve for the center of the image with the specified psf model68 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore)69 {70 71 // bool status;72 float xc, yc, dx, dy;73 float fitMag, apMag;74 float radius;75 76 // create template model77 pmModel *modelRef = pmModelAlloc(psf->type);78 79 // use the center of the center pixel of the image80 xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5;81 yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5;82 dx = psf->growth->maxRadius + 1;83 dy = psf->growth->maxRadius + 1;84 85 // assign the x and y coords to the image center86 // create an object with center intensity of 100087 modelRef->params->data.F32[PM_PAR_SKY] = 0;88 modelRef->params->data.F32[PM_PAR_I0] = 1000;89 modelRef->params->data.F32[PM_PAR_XPOS] = xc;90 modelRef->params->data.F32[PM_PAR_YPOS] = yc;91 92 // create modelPSF from this model93 pmModel *model = pmModelFromPSF (modelRef, psf);94 95 // measure the fitMag for this model96 pmSourcePhotometryModel (&fitMag, model);97 psf->growth->fitMag = fitMag;98 99 // generate working image for this source100 psRegion region = {xc - dx, xc + dx, yc - dy, yc + dy};101 psImage *view = psImageSubset (readout->image, region);102 psImage *image = psImageCopy (NULL, view, PS_TYPE_F32);103 psImage *mask = psImageCopy (NULL, view, PS_TYPE_U8);104 105 psImageInit (image, 0.0);106 psImageInit (mask, 0);107 108 // place the reference object in the image center109 // no need to mask the source here110 pmModelAdd (image, NULL, model, false, false);111 112 // loop over a range of source fluxes113 // no need to interpolate since we have forced the object center114 // to 0.5, 0.5 above115 for (int i = 0; i < psf->growth->radius->n; i++) {116 117 radius = psf->growth->radius->data.F32[i];118 119 // mask the given aperture and measure the apMag120 psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK);121 pmSourcePhotometryAper (&apMag, model, image, mask);122 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(PM_MASK_MARK));123 124 // the 'ignore' mode is for testing125 if (ignore) {126 psf->growth->apMag->data.F32[i] = fitMag;127 } else {128 psf->growth->apMag->data.F32[i] = apMag;129 }130 }131 132 psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);133 psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;134 135 psLogMsg ("psphot.growth", 4, "GrowthCurve : apLoss : %f\n", psf->growth->apLoss);136 137 psFree (view);138 psFree (image);139 psFree (mask);140 psFree (model);141 psFree (modelRef);142 143 return true;144 } -
trunk/psModules/src/objects/pmGrowthCurve.h
r9879 r9897 17 17 pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius); 18 18 psF32 pmGrowthCurveCorrect (pmGrowthCurve *growth, psF32 radius); 19 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore);20 19 21 20 # endif /* PM_GROWTH_CURVE_H */ -
trunk/psModules/src/objects/pmPSF.c
r9882 r9897 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-11-07 09:08:59$8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-11-07 22:55:40 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 #include "pmPSF.h" 33 33 #include "pmModelGroup.h" 34 #include "pmSourcePhotometry.h" 35 #include "pmFPAMaskWeight.h" 36 #include "psVectorBracket.h" 34 37 35 38 /*****************************************************************************/ … … 364 367 } 365 368 369 // we generate the growth curve for the center of the image with the specified psf model 370 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore) 371 { 372 373 // bool status; 374 float xc, yc, dx, dy; 375 float fitMag, apMag; 376 float radius; 377 378 // create template model 379 pmModel *modelRef = pmModelAlloc(psf->type); 380 381 // use the center of the center pixel of the image 382 xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5; 383 yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5; 384 dx = psf->growth->maxRadius + 1; 385 dy = psf->growth->maxRadius + 1; 386 387 // assign the x and y coords to the image center 388 // create an object with center intensity of 1000 389 modelRef->params->data.F32[PM_PAR_SKY] = 0; 390 modelRef->params->data.F32[PM_PAR_I0] = 1000; 391 modelRef->params->data.F32[PM_PAR_XPOS] = xc; 392 modelRef->params->data.F32[PM_PAR_YPOS] = yc; 393 394 // create modelPSF from this model 395 pmModel *model = pmModelFromPSF (modelRef, psf); 396 397 // measure the fitMag for this model 398 pmSourcePhotometryModel (&fitMag, model); 399 psf->growth->fitMag = fitMag; 400 401 // generate working image for this source 402 psRegion region = {xc - dx, xc + dx, yc - dy, yc + dy}; 403 psImage *view = psImageSubset (readout->image, region); 404 psImage *image = psImageCopy (NULL, view, PS_TYPE_F32); 405 psImage *mask = psImageCopy (NULL, view, PS_TYPE_U8); 406 407 psImageInit (image, 0.0); 408 psImageInit (mask, 0); 409 410 // place the reference object in the image center 411 // no need to mask the source here 412 pmModelAdd (image, NULL, model, false, false); 413 414 // loop over a range of source fluxes 415 // no need to interpolate since we have forced the object center 416 // to 0.5, 0.5 above 417 for (int i = 0; i < psf->growth->radius->n; i++) { 418 419 radius = psf->growth->radius->data.F32[i]; 420 421 // mask the given aperture and measure the apMag 422 psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK); 423 pmSourcePhotometryAper (&apMag, model, image, mask); 424 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(PM_MASK_MARK)); 425 426 // the 'ignore' mode is for testing 427 if (ignore) { 428 psf->growth->apMag->data.F32[i] = fitMag; 429 } else { 430 psf->growth->apMag->data.F32[i] = apMag; 431 } 432 } 433 434 psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius); 435 psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef; 436 437 psLogMsg ("psphot.growth", 4, "GrowthCurve : apLoss : %f\n", psf->growth->apLoss); 438 439 psFree (view); 440 psFree (image); 441 psFree (mask); 442 psFree (model); 443 psFree (modelRef); 444 445 return true; 446 } -
trunk/psModules/src/objects/pmPSF.h
r9882 r9897 93 93 double pmPSF_SXYtoModel (psF32 *fittedPar); 94 94 95 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore); 96 95 97 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
