Changeset 32245
- Timestamp:
- Aug 31, 2011, 12:49:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceMoments.c
r32216 r32245 115 115 // Now calculate higher-order moments, using the above-calculated first moments to adjust coordinates 116 116 // Xn = SUM (x - xc)^n * (z - sky) 117 118 float RFa = 0.0;119 float RSa = 0.0;120 121 float RF = 0.0;122 float RH = 0.0;123 float RS = 0.0;124 117 float XX = 0.0; 125 118 float XY = 0.0; … … 269 262 source->moments->Myyyy = YYYY/Sum; 270 263 271 # define TEST_X1 167 272 # define TEST_Y1 299 273 # define TEST_X2 180 274 # define TEST_Y2 300 275 if ((fabs(Xo - TEST_X1) < 3) && (fabs(Yo - TEST_Y1) < 3)) { 276 fprintf (stderr, "test obj 1\n"); 277 } 278 if ((fabs(Xo - TEST_X2) < 3) && (fabs(Yo - TEST_Y2) < 3)) { 279 fprintf (stderr, "test obj 2\n"); 280 } 264 // *** now calculate the 1st radial moment (for kron flux) -- symmetrical averaging 281 265 282 266 float **vPix = source->pixels->data.F32; … … 284 268 psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA; 285 269 286 // calculate the 1st radial moment (for kron flux) -- symmetrical averaging 270 float RF = 0.0; 271 float RH = 0.0; 272 float RS = 0.0; 273 287 274 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 288 275 … … 326 313 float rs = 0.5 * (fDiff1 + fDiff2); 327 314 328 float rfa = r * fDiff1;329 float rsa = fDiff1;330 331 315 RF += rf; 332 316 RH += rh; 333 317 RS += rs; 334 335 RFa += rfa;336 RSa += rsa;337 318 } 338 319 } … … 340 321 source->moments->Mrf = RF/RS; 341 322 source->moments->Mrh = RH/RS; 342 343 float R1 = RFa / RSa;344 if ((fabs(Xo - TEST_X1) < 3) && (fabs(Yo - TEST_Y1) < 3)) {345 fprintf (stderr, "R1: %f vs %f\n", R1, source->moments->Mrf);346 }347 if ((fabs(Xo - TEST_X2) < 3) && (fabs(Yo - TEST_Y2) < 3)) {348 fprintf (stderr, "R2: %f vs %f\n", R1, source->moments->Mrf);349 }350 351 // fprintf (stderr, "Rad: %f vs %f\n", R1, source->moments->Mrf);352 323 353 324 // if Mrf (first radial moment) is very small, we are getting into low-significance … … 358 329 kronRefRadius = MIN(radius, kronRefRadius); 359 330 } 331 332 // *** now calculate the kron flux values using the 1st radial moment 360 333 361 334 float radKinner = 1.0*kronRefRadius; … … 371 344 float SumOuter = 0.0; 372 345 373 // calculate the Kron flux, and related fluxes ( symmetrical averaging)346 // calculate the Kron flux, and related fluxes (NO symmetrical averaging) 374 347 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 375 348 376 349 float yDiff = row - yCM; 377 350 if (fabs(yDiff) > radKouter) continue; 378 379 // coordinate of mirror pixel380 int yFlip = yCM - yDiff;381 if (yFlip < 0) continue;382 if (yFlip >= source->pixels->numRows) continue;383 351 384 352 for (psS32 col = 0; col < source->pixels->numCols ; col++) { … … 390 358 if (fabs(xDiff) > radKouter) continue; 391 359 392 // coordinate of mirror pixel393 int xFlip = xCM - xDiff;394 if (xFlip < 0) continue;395 if (xFlip >= source->pixels->numCols) continue;396 397 // check mask and value for mirror pixel398 if (vMsk && (vMsk[yFlip][xFlip] & maskVal)) continue;399 if (isnan(vPix[yFlip][xFlip])) continue;400 401 360 // radKron is just a function of (xDiff, yDiff) 402 361 float r2 = PS_SQR(xDiff) + PS_SQR(yDiff); 403 362 404 363 float fDiff1 = vPix[row][col] - sky; 405 float fDiff2 = vPix[yFlip][xFlip] - sky; 406 float pDiff = (fDiff1 > 0.0) ? sqrt(fabs(fDiff1*fDiff2)) : -sqrt(fabs(fDiff1*fDiff2)); 407 // float pDiff = vPix[row][col] - sky; 364 float pDiff = fDiff1; 408 365 float wDiff = vWgt[row][col]; 409 366 … … 413 370 if (PS_SQR(pDiff) < minSN2*wDiff) continue; 414 371 415 # define WEIGHTED 0416 # if (WEIGHTED)417 float z = r2 * rsigma2 / 4.0;418 assert (z >= 0.0);419 float weight = exp(-z);420 # else421 float weight = 1.0;422 # endif423 424 372 float r = sqrt(r2); 425 373 if (r < radKron) { 426 Sum += pDiff *weight;427 Var += wDiff *weight;374 Sum += pDiff; 375 Var += wDiff; 428 376 nKronPix ++; 429 377 // if (beVerbose) fprintf (stderr, "mome: %d %d %f %f %f\n", col, row, sky, *vPix, Sum);
Note:
See TracChangeset
for help on using the changeset viewer.
