Changeset 14972
- Timestamp:
- Sep 21, 2007, 11:45:00 AM (19 years ago)
- Location:
- branches/eam_branch_20070921/psModules/src/objects
- Files:
-
- 3 edited
-
pmPSF.c (modified) (5 diffs)
-
pmPSFtry.c (modified) (10 diffs)
-
pmTrend2D.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070921/psModules/src/objects/pmPSF.c
r14969 r14972 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.28.2. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-09-21 18:55:11$8 * @version $Revision: 1.28.2.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-09-21 21:45:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 42 42 /*****************************************************************************/ 43 /* DEFINE STATEMENTS */44 /*****************************************************************************/45 46 /*****************************************************************************/47 /* TYPE DEFINITIONS */48 /*****************************************************************************/49 50 /*****************************************************************************/51 /* GLOBAL VARIABLES */52 /*****************************************************************************/53 54 /*****************************************************************************/55 /* FILE STATIC VARIABLES */56 /*****************************************************************************/57 58 /*****************************************************************************/59 /* FUNCTION IMPLEMENTATION - LOCAL */60 /*****************************************************************************/61 62 /*****************************************************************************/63 43 /* FUNCTION IMPLEMENTATION - PUBLIC */ 64 44 /*****************************************************************************/ 65 45 66 46 static void pmPSFOptionsFree (pmPSFOptions *options) { 67 68 47 return; 69 48 } … … 72 51 73 52 pmPSFOptions *options = (pmPSFOptions *) psAlloc(sizeof(pmPSFOptions)); 53 psMemSetDeallocator(options, (psFreeFunc) pmPSFOptionsFree); 74 54 75 55 options->type = 0; 76 56 options->poissonErrors = false; 77 options->psfTrendMode = PM_TREND_ MAP;57 options->psfTrendMode = PM_TREND_NONE; 78 58 options->psfTrendNx = 0; 79 59 options->psfTrendNy = 0; … … 115 95 116 96 pmPSF *psf = (pmPSF *) psAlloc(sizeof(pmPSF)); 97 psMemSetDeallocator(psf, (psFreeFunc) pmPSFFree); 117 98 118 99 psf->type = options->type; … … 163 144 // PM_PAR_XPOS, etc) 164 145 146 // XXX make this a user option 147 psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 148 165 149 // XXX define new structure to carry in the psf options 166 if ( psfTrendMask) {150 if (options->psfTrendMode != PM_TREND_NONE) { 167 151 for (int i = 0; i < psf->params->n; i++) { 168 if (i == PM_PAR_SKY) 169 continue; 170 if (i == PM_PAR_I0) 171 continue; 172 if (i == PM_PAR_XPOS) 173 continue; 174 if (i == PM_PAR_YPOS) 175 continue; 176 177 // XXX need to set stats, image 152 if (i == PM_PAR_SKY) continue; 153 if (i == PM_PAR_I0) continue; 154 if (i == PM_PAR_XPOS) continue; 155 if (i == PM_PAR_YPOS) continue; 156 157 // XXX need to set stats & image or else nXfine,nYfine 178 158 pmTrend2D *param = pmTrend2DAlloc (options->psfTrendMode, image, options->psfTrendNx, options->psfTrendNx, stats); 179 159 psf->params->data[i] = param; 180 160 } 181 161 } 182 183 ps MemSetDeallocator(psf, (psFreeFunc) pmPSFFree);184 return (psf);162 163 psFree (stats); 164 return psf; 185 165 } 186 166 -
branches/eam_branch_20070921/psModules/src/objects/pmPSFtry.c
r14937 r14972 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $8 * @date $Date: 2007-09-21 00:06:57$7 * @version $Revision: 1.45.2.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-09-21 21:45:00 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 58 58 59 59 // allocate a pmPSFtry based on the desired sources and the model (identified by name) 60 pmPSFtry *pmPSFtryAlloc (psArray *sources, char *modelName, bool poissonErrors, psPolynomial2D *psfTrendMask)60 pmPSFtry *pmPSFtryAlloc (psArray *sources, char *modelName, pmPSFOptions *options) 61 61 { 62 62 63 63 // validate the requested model name 64 pmModelTypetype = pmModelClassGetType (modelName);65 if ( type == -1) {64 options->type = pmModelClassGetType (modelName); 65 if (options->type == -1) { 66 66 psError (PS_ERR_UNKNOWN, true, "invalid model name %s", modelName); 67 67 return NULL; … … 70 70 pmPSFtry *test = (pmPSFtry *) psAlloc(sizeof(pmPSFtry)); 71 71 72 test->psf = pmPSFAlloc ( type, poissonErrors, psfTrendMask);72 test->psf = pmPSFAlloc (options); 73 73 test->metric = psVectorAlloc (sources->n, PS_TYPE_F32); 74 74 test->metricErr = psVectorAlloc (sources->n, PS_TYPE_F32); … … 99 99 100 100 // generate a pmPSFtry with a copy of the test PSF sources 101 pmPSFtry *pmPSFtryModel (psArray *sources, char *modelName, float RADIUS, bool poissonErrors, psPolynomial2D *psfTrendMask, bool applyWeights, psMaskType maskVal, psMaskType mark)101 pmPSFtry *pmPSFtryModel (psArray *sources, char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType mark) 102 102 { 103 103 bool status; … … 105 105 int Npsf = 0; 106 106 107 pmPSFtry *psfTry = pmPSFtryAlloc (sources, modelName, poissonErrors, psfTrendMask); 107 // XXX use the options structure here instead? 108 109 pmPSFtry *psfTry = pmPSFtryAlloc (sources, modelName, options); 108 110 if (psfTry == NULL) { 109 111 psError (PS_ERR_UNKNOWN, false, "failed to allocate psf model"); … … 124 126 125 127 // set object mask to define valid pixels 126 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, RADIUS, "OR", mark);128 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark); 127 129 128 130 // fit model as EXT, not PSF … … 140 142 141 143 // stage 2: construct a psf (pmPSF) from this collection of model fits 142 if (!pmPSFFromPSFtry (psfTry, applyWeights)) {144 if (!pmPSFFromPSFtry (psfTry, options->applyWeights)) { 143 145 psError(PS_ERR_UNKNOWN, false, "failed to construct a psf model from collection of sources"); 144 146 psFree(psfTry); … … 162 164 continue; 163 165 } 164 source->modelPSF->radiusFit = RADIUS;166 source->modelPSF->radiusFit = options->radius; 165 167 166 168 // set object mask to define valid pixels 167 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, RADIUS, "OR", mark);169 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark); 168 170 169 171 // fit the PSF model to the source … … 241 243 242 244 // XXX this function wants aperture radius for pmSourcePhotometry 243 pmPSFtryMetric (psfTry, RADIUS);245 pmPSFtryMetric (psfTry, options->radius); 244 246 psLogMsg ("psphot.pspsf", 3, "try model %s, ap-fit: %f +/- %f : sky bias: %f\n", 245 247 modelName, psfTry->psf->ApResid, psfTry->psf->dApResid, psfTry->psf->skyBias); … … 501 503 psFree (z); 502 504 psFree (dz); 503 return (true);505 return true; 504 506 } 505 507 -
branches/eam_branch_20070921/psModules/src/objects/pmTrend2D.h
r14938 r14972 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $8 * @date $Date: 2007-09-21 00:09:18$7 * @version $Revision: 1.2.2.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-09-21 21:45:00 $ 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 10 10 */ … … 17 17 18 18 typedef enum { 19 PM_TREND_NONE, 19 20 PM_TREND_POLY_ORD, 20 21 PM_TREND_POLY_CHEB,
Note:
See TracChangeset
for help on using the changeset viewer.
