Changeset 9897 for trunk/psModules/src/objects/pmGrowthCurve.c
- Timestamp:
- Nov 7, 2006, 12:55:40 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmGrowthCurve.c (modified) (4 diffs)
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 }
Note:
See TracChangeset
for help on using the changeset viewer.
