Changeset 27532 for trunk/psphot/src/psphotFitSourcesLinearStack.c
- Timestamp:
- Mar 30, 2010, 1:33:47 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotFitSourcesLinearStack.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotFitSourcesLinearStack.c
r25755 r27532 9 9 // these are used to determine the simultaneous linear fit of fluxes. 10 10 // the analysis is performed wrt the simulated pixel values 11 12 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, psImageMaskType markVal);13 11 14 12 bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, bool final) { … … 194 192 return true; 195 193 } 196 197 // Calculate the weight terms for the sky fit component of the matrix. This function operates198 // on the pixels which correspond to all of the sources of interest. These elements fill in199 // the border matrix components in the sparse matrix equation.200 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, psImageMaskType markVal) {201 202 // generate the image-wide weight terms203 // turn on MARK for all image pixels204 psRegion fullArray = psRegionSet (0, 0, 0, 0);205 fullArray = psRegionForImage (readout->mask, fullArray);206 psImageMaskRegion (readout->mask, fullArray, "OR", markVal);207 208 // turn off MARK for all object pixels209 for (int i = 0; i < sources->n; i++) {210 pmSource *source = sources->data[i];211 pmModel *model = pmSourceGetModel (NULL, source);212 if (model == NULL) continue;213 float x = model->params->data.F32[PM_PAR_XPOS];214 float y = model->params->data.F32[PM_PAR_YPOS];215 psImageMaskCircle (source->maskView, x, y, model->radiusFit, "AND", PS_NOT_IMAGE_MASK(markVal));216 }217 218 // accumulate the image statistics from the masked regions219 psF32 **image = readout->image->data.F32;220 psF32 **variance = readout->variance->data.F32;221 psImageMaskType **mask = readout->mask->data.PS_TYPE_IMAGE_MASK_DATA;222 223 double w, x, y, x2, xy, y2, xc, yc, wt, f, fo, fx, fy;224 w = x = y = x2 = xy = y2 = fo = fx = fy = 0;225 226 int col0 = readout->image->col0;227 int row0 = readout->image->row0;228 229 for (int j = 0; j < readout->image->numRows; j++) {230 for (int i = 0; i < readout->image->numCols; i++) {231 if (mask[j][i]) continue;232 if (constant_weights) {233 wt = 1.0;234 } else {235 wt = variance[j][i];236 }237 f = image[j][i];238 w += 1/wt;239 fo += f/wt;240 }241 }242 243 // turn off MARK for all image pixels244 psImageMaskRegion (readout->mask, fullArray, "AND", PS_NOT_IMAGE_MASK(markVal));245 246 // set the Border T elements247 psSparseBorderElementG (border, 0, fo);248 psSparseBorderElementT (border, 0, 0, w);249 250 return true;251 }
Note:
See TracChangeset
for help on using the changeset viewer.
