Changeset 14347
- Timestamp:
- Jul 20, 2007, 2:04:54 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotModelWithPSF.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotModelWithPSF.c
r14338 r14347 185 185 psVector *coord = psVectorAlloc(2, PS_TYPE_F32); 186 186 187 psImageInit (pcm->model, 0.0); 188 for (int n = 0; n < params->n; n++) { 189 if (!pcm->dmodels->data[n]) continue; 190 psImageInit (pcm->dmodels->data[n], 0.0); 191 } 192 187 193 // fill in the coordinate and value entries 188 194 for (psS32 i = 0; i < source->pixels->numRows; i++) { 189 195 for (psS32 j = 0; j < source->pixels->numCols; j++) { 196 197 // XXX can we skip some of the data points where the model 198 // is not going to be fitted?? 199 190 200 // skip masked points 191 201 // XXX probably should not skipped masked points: 192 202 // XXX skip if convolution of unmasked pixels will not see this pixel 193 if (source->maskObj->data.U8[i][j]) { 194 continue; 195 } 203 // if (source->maskObj->data.U8[i][j]) { 204 // continue; 205 // } 206 196 207 // skip zero-weight points 197 208 // XXX why is this not masked? 198 if (source->weight->data.F32[i][j] == 0) {199 continue;200 }209 // if (source->weight->data.F32[i][j] == 0) { 210 // continue; 211 // } 201 212 // skip nan value points 202 213 // XXX why is this not masked? 203 if (!isfinite(source->pixels->data.F32[i][j])) {204 continue;205 }214 // if (!isfinite(source->pixels->data.F32[i][j])) { 215 // continue; 216 // } 206 217 207 218 // Convert i/j to image space: … … 221 232 psFree(deriv); 222 233 223 psphotSaveImage (NULL, pcm->model, "model1.fits");224 234 225 235 // convolve model and dmodel arrays with PSF … … 233 243 234 244 // XXX TEST : SAVE IMAGES 245 # if (1) 246 psphotSaveImage (NULL, psf->image, "psf.fits"); 235 247 psphotSaveImage (NULL, pcm->model, "model.fits"); 236 248 psphotSaveImage (NULL, pcm->modelConv, "modelConv.fits"); … … 238 250 psphotSaveImage (NULL, source->maskObj, "mask.fits"); 239 251 psphotSaveImage (NULL, source->weight, "weight.fits"); 240 exit (0); 252 # endif 241 253 242 254 // zero alpha and beta for summing below … … 330 342 331 343 // Allocate storage images for raw model and derivative images 332 pcm->model = psImage Alloc (source->pixels->numCols, source->pixels->numRows, PS_TYPE_F32);344 pcm->model = psImageCopy (NULL, source->pixels, PS_TYPE_F32); 333 345 pcm->dmodels = psArrayAlloc (params->n); 334 346 for (psS32 n = 0; n < params->n; n++) { 335 347 if ((paramMask != NULL) && (paramMask->data.U8[n])) { continue; } 336 pcm->dmodels->data[n] = psImage Alloc (source->pixels->numCols, source->pixels->numRows, PS_TYPE_F32);348 pcm->dmodels->data[n] = psImageCopy (NULL, source->pixels, PS_TYPE_F32); 337 349 } 338 350 339 351 // Allocate storage images for convolved model and derivative images 340 pcm->modelConv = psImage Alloc (source->pixels->numCols, source->pixels->numRows, PS_TYPE_F32);352 pcm->modelConv = psImageCopy (NULL, source->pixels, PS_TYPE_F32); 341 353 pcm->dmodelsConv = psArrayAlloc (params->n); 342 354 for (psS32 n = 0; n < params->n; n++) { 343 355 if ((paramMask != NULL) && (paramMask->data.U8[n])) { continue; } 344 pcm->dmodelsConv->data[n] = psImage Alloc (source->pixels->numCols, source->pixels->numRows, PS_TYPE_F32);356 pcm->dmodelsConv->data[n] = psImageCopy (NULL, source->pixels, PS_TYPE_F32); 345 357 } 346 358 … … 350 362 psImage *pmPCMDataSaveImage (pmPCMData *pcm) { 351 363 352 psImage *model = psImageCopy (NULL, pcm->model, PS_TYPE_F32); 364 psImage *model = psImageCopy (NULL, pcm->modelConv, PS_TYPE_F32); 365 353 366 return model; 354 367 }
Note:
See TracChangeset
for help on using the changeset viewer.
