Changeset 10096 for trunk/psphot/src/psphotEnsemblePSF.c
- Timestamp:
- Nov 19, 2006, 7:26:08 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotEnsemblePSF.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotEnsemblePSF.c
r10076 r10096 10 10 // the analysis is performed wrt the simulated pixel values 11 11 12 static bool SetBorderT (psSparseBorder *border, pmReadout *readout, psArray *refSources, psArray *fitSources, psVector *index, bool fitSlope );12 static bool SetBorderT (psSparseBorder *border, pmReadout *readout, psArray *refSources, psArray *fitSources, psVector *index, bool fitSlope, bool constant_weights); 13 13 14 14 bool psphotEnsemblePSF (pmReadout *readout, psArray *refSources, psMetadata *recipe, pmPSF *psf, bool final) { … … 162 162 // set the sky, sky_x, sky_y components of border matrix 163 163 // XXX ignore sky slope terms for now 164 SetBorderT (border, readout, refSources, fitSources, index, false );164 SetBorderT (border, readout, refSources, fitSources, index, false, CONSTANT_PHOTOMETRIC_WEIGHTS); 165 165 166 166 psSparseConstraint constraint; … … 170 170 171 171 // solve for normalization terms (need include local sky?) 172 # if ( 0)172 # if (1) 173 173 psVector *norm = NULL; 174 174 psVector *skyfit = NULL; 175 175 psSparseBorderSolve (&norm, &skyfit, constraint, border, 3); 176 fprintf (stderr, "skyfit: %f\n", skyfit->data.F32[0]); 176 177 # else 177 178 psVector *norm = psSparseSolve (NULL, constraint, sparse, 3); … … 226 227 227 228 // calculate the weight terms for the sky fit component of the matrix 228 static bool SetBorderT (psSparseBorder *border, pmReadout *readout, psArray *refSources, psArray *fitSources, psVector *index, bool fitSlope ) {229 static bool SetBorderT (psSparseBorder *border, pmReadout *readout, psArray *refSources, psArray *fitSources, psVector *index, bool fitSlope, bool constant_weights) { 229 230 230 231 // generate the image-wide weight terms … … 251 252 psU8 **mask = readout->mask->data.U8; 252 253 253 double w, x, y, x2, xy, y2, xc, yc ;254 w = x = y = x2 = xy = y2 = 0;254 double w, x, y, x2, xy, y2, xc, yc, wt, f, fo, fx, fy; 255 w = x = y = x2 = xy = y2 = fo = fx = fy = 0; 255 256 256 257 int col0 = readout->image->col0; … … 260 261 for (int i = 0; i < readout->image->numCols; i++) { 261 262 if (mask[j][i]) continue; 262 w += image[j][i]/weight[j][i]; 263 if (constant_weights) { 264 wt = 1.0; 265 } else { 266 wt = weight[j][i]; 267 } 268 f = image[j][i]; 269 w += 1/wt; 270 fo += f/wt; 271 263 272 if (!fitSlope) continue; 264 273 xc = i + col0; 265 274 yc = j + row0; 266 x += xc*image[j][i]/weight[j][i]; 267 y += yc*image[j][i]/weight[j][i]; 268 x2 += xc*xc*image[j][i]/weight[j][i]; 269 xy += xc*yc*image[j][i]/weight[j][i]; 270 y2 += yc*yc*image[j][i]/weight[j][i]; 275 x += xc/wt; 276 y += yc/wt; 277 x2 += xc*xc/wt; 278 xy += xc*yc/wt; 279 y2 += yc*yc/wt; 280 fx += f*xc/wt; 281 fy += f*yc/wt; 271 282 } 272 283 } … … 276 287 277 288 // set the Border T elements 289 psSparseBorderElementG (border, 0, fo); 278 290 psSparseBorderElementT (border, 0, 0, w); 279 291 if (fitSlope) { 292 psSparseBorderElementG (border, 0, fx); 293 psSparseBorderElementG (border, 0, fy); 280 294 psSparseBorderElementT (border, 1, 0, x); 281 295 psSparseBorderElementT (border, 2, 0, y);
Note:
See TracChangeset
for help on using the changeset viewer.
