- Timestamp:
- Sep 21, 2007, 11:45:00 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.
