- Timestamp:
- Jul 22, 2010, 6:21:31 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.c
r28692 r28702 141 141 } 142 142 143 pmPCMdata *pmPCMinit(pmSource *source, pmSourceFitOptions *fitOptions, pmModel Type modelType, psImageMaskType maskVal, float psfSize) {144 145 // make sure we save pa cached copy of the psf flux143 pmPCMdata *pmPCMinit(pmSource *source, pmSourceFitOptions *fitOptions, pmModel *model, psImageMaskType maskVal, float psfSize) { 144 145 // make sure we save a cached copy of the psf flux 146 146 pmSourceCachePSF (source, maskVal); 147 147 148 148 // convert the cached cached psf model for this source to a psKernel 149 149 psKernel *psf = pmPCMkernelFromPSF (source, psfSize); 150 if (!psf) return NULL; 150 if (!psf) { 151 // NOTE: this only happens if the source is too close to an edge 152 model->flags |= PM_MODEL_STATUS_BADARGS; 153 return NULL; 154 } 151 155 152 156 # if (USE_DELTA_PSF) … … 154 158 psf->image->data.F32[(int)(0.5*psf->image->numRows)][(int)(0.5*psf->image->numCols)] = 1.0; 155 159 # endif 156 157 // allocate the model158 pmModel *modelConv = pmModelAlloc(modelType);159 if (!modelConv) {160 psFree (psf);161 return NULL;162 }163 160 164 161 // count the number of unmasked pixels: … … 183 180 } 184 181 185 psVector *params = model Conv->params;182 psVector *params = model->params; 186 183 187 184 // create the minimization constraints 188 185 psMinConstraint *constraint = psMinConstraintAlloc(); 189 186 constraint->paramMask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK); 190 constraint->checkLimits = model Conv->modelLimits;187 constraint->checkLimits = model->modelLimits; 191 188 192 189 // set parameter mask based on fitting mode … … 239 236 } 240 237 238 if (nPix < nParams + 1) { 239 psTrace ("psModules.objects", 4, "insufficient valid pixels\n"); 240 psFree (psf); 241 psFree (constraint); 242 model->flags |= PM_MODEL_STATUS_BADARGS; 243 return NULL; 244 } 245 241 246 // generate PCM data storage structure 242 247 pmPCMdata *pcm = pmPCMdataAlloc (params, constraint->paramMask, source); 243 248 244 pcm->modelConv = modelConv;245 249 pcm->psf = psf; 250 pcm->modelConv = psMemIncrRefCounter(model); 246 251 pcm->constraint = constraint; 247 252 248 if (nPix < nParams + 1) {249 psTrace ("psModules.objects", 4, "insufficient valid pixels\n");250 pcm->modelConv->flags |= PM_MODEL_STATUS_BADARGS;251 abort ();252 // XXX This should not be an abort!!253 }254 253 pcm->nPix = nPix; 255 254 pcm->nDOF = nPix - nParams - 1;
Note:
See TracChangeset
for help on using the changeset viewer.
