Changeset 13343
- Timestamp:
- May 10, 2007, 5:08:38 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotGuessModels.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotGuessModels.c
r13035 r13343 1 1 # include "psphotInternal.h" 2 2 3 // construct an initial PSF model for each object 3 // A guess for when the moments aren't available 4 static pmModel *wildGuess(pmSource *source, // Source for which to guess 5 pmPSF *psf // The point-spread function 6 ) 7 { 8 pmModel *model = pmModelAlloc(psf->type); 9 psF32 *PAR = model->params->data.F32; 10 PAR[PM_PAR_SKY] = 0; 11 // XXX get this from the image pixels 12 PAR[PM_PAR_I0] = source->peak->flux; 13 PAR[PM_PAR_XPOS] = source->peak->xf; 14 PAR[PM_PAR_YPOS] = source->peak->yf; 15 return model; 16 } 17 18 // construct an initial PSF model for each object 4 19 bool psphotGuessModels (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf) { 5 20 … … 17 32 18 33 // XXX if a source is faint, it will not have moments measured. 19 // it must be modelled as a PSF. In this case, we need to use 20 // the peak centroid to get the coordinates and get the peak flux 34 // it must be modelled as a PSF. In this case, we need to use 35 // the peak centroid to get the coordinates and get the peak flux 21 36 // from the image? 22 23 // use the source moments, etc to guess basic model parameters 24 pmModel *modelEXT = pmSourceModelGuess (source, psf->type); 25 26 // XXX put this in a function of its own.. 27 if (modelEXT == NULL) { 28 psErrorClear (); // XXX need to clear the error from failing the model 29 modelEXT = pmModelAlloc(psf->type); 30 psF32 *PAR = modelEXT->params->data.F32; 31 PAR[PM_PAR_SKY] = 0; 32 // XXX get this from the image pixels 33 PAR[PM_PAR_I0] = source->peak->flux; 34 PAR[PM_PAR_XPOS] = source->peak->xf; 35 PAR[PM_PAR_YPOS] = source->peak->yf; 37 pmModel *modelEXT; 38 if (!source->moments) { 39 modelEXT = wildGuess(source, psf); 36 40 } else { 37 // these valuse are set in pmSourceModelGuess, should this rule be in there as well? 38 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 39 modelEXT->params->data.F32[PM_PAR_XPOS] = source->moments->x; 40 modelEXT->params->data.F32[PM_PAR_YPOS] = source->moments->y; 41 } else { 42 modelEXT->params->data.F32[PM_PAR_XPOS] = source->peak->xf; 43 modelEXT->params->data.F32[PM_PAR_YPOS] = source->peak->yf; 44 } 41 // use the source moments, etc to guess basic model parameters 42 modelEXT = pmSourceModelGuess (source, psf->type); 43 if (!modelEXT) { 44 modelEXT = wildGuess(source, psf); 45 } 46 // these valuse are set in pmSourceModelGuess, should this rule be in there as well? 47 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 48 modelEXT->params->data.F32[PM_PAR_XPOS] = source->moments->x; 49 modelEXT->params->data.F32[PM_PAR_YPOS] = source->moments->y; 50 } else { 51 modelEXT->params->data.F32[PM_PAR_XPOS] = source->peak->xf; 52 modelEXT->params->data.F32[PM_PAR_YPOS] = source->peak->yf; 53 } 45 54 } 46 55 … … 63 72 } 64 73 65 // XXX do we always know which model is supposed to be used? 74 // XXX do we always know which model is supposed to be used?
Note:
See TracChangeset
for help on using the changeset viewer.
