Changeset 20488 for trunk/psModules/src/camera/pmFPAMaskWeight.c
- Timestamp:
- Oct 31, 2008, 2:15:50 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAMaskWeight.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMaskWeight.c
r20486 r20488 414 414 for (int i = 0; i < num; i++) { 415 415 // Coordinates of interest 416 int xPix = psRandomUniform(rng) * xSize + xOffset ;417 int yPix = psRandomUniform(rng) * ySize + yOffset ;416 int xPix = psRandomUniform(rng) * xSize + xOffset + 0.5; 417 int yPix = psRandomUniform(rng) * ySize + yOffset + 0.5; 418 418 psAssert(xPix - size >= 0 && xPix + size < numCols && 419 yPix - size >= 0 && yPix + size >numRows,420 "Bad pixel position ");419 yPix - size >= 0 && yPix + size < numRows, 420 "Bad pixel position: %d,%d", xPix, yPix); 421 421 422 422 // Weighted aperture photometry … … 431 431 float xSumWeight = 0.0; // Sum for weight measurement in x 432 432 float xSumGauss = 0.0, xSumGauss2 = 0.0; // Sums of Gaussian kernels in x 433 float yGauss = peakFlux *gauss->data.F32[v]; // Value of Gaussian in y433 float yGauss = gauss->data.F32[v]; // Value of Gaussian in y 434 434 for (int u = 0, x = xPix - size; u < fullSize; u++, x++) { 435 435 if (mask && mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal) { … … 440 440 float xGauss2 = gauss2->data.F32[u]; // Value of Gaussian^2 in x 441 441 xSumNoise += value * xGauss; 442 xSumSource += (value + xGauss * yGauss) * xGauss;442 xSumSource += (value + peakFlux * xGauss * yGauss) * xGauss; 443 443 xSumWeight += weight->data.F32[y][x] * xGauss2; 444 444 xSumGauss += xGauss; … … 453 453 } 454 454 455 float weightValue = sumWeight / sumGauss2; // Value of convolved weight456 455 photMask->data.PS_TYPE_MASK_DATA[i] = ((isfinite(sumNoise) && isfinite(sumSource) && 457 isfinite( weightValue) && sumGauss > 0 && sumGauss2 > 0) ?456 isfinite(sumWeight) && sumGauss > 0 && sumGauss2 > 0) ? 458 457 0 : 0xFF); 459 458 460 noise->data.F32[i] = sumNoise / sumGauss; 461 source->data.F32[i] = sumSource / sumGauss; 462 guess->data.F32[i] = (sumSource > 0) ? sigFactor * PS_SQR(sumSource) / sumWeight * sumGauss2 : 0.0; 459 float smoothImageNoise = sumNoise / sumGauss; // Value of smoothed image pixel for noise 460 float smoothImageSource = sumSource / sumGauss; // Value of smoothed image pixel for source 461 float smoothWeight = sumWeight / sumGauss2; // Value of smoothed weight pixel 462 463 noise->data.F32[i] = smoothImageNoise; 464 source->data.F32[i] = smoothImageSource; 465 guess->data.F32[i] = (sumSource > 0) ? sigFactor * PS_SQR(smoothImageSource) / smoothWeight : 0.0; 463 466 psTrace("psModules.camera", 10, "Flux %d (%d,%d): %f, %f, %f\n", 464 i, xPix, yPix, s ource->data.F32[i], noise->data.F32[i], guess->data.F32[i]);467 i, xPix, yPix, smoothImageNoise, smoothImageSource, smoothWeight); 465 468 } 466 469 psFree(gauss); … … 491 494 photMask->data.PS_TYPE_MASK_DATA[i] = 0xFF; 492 495 } 493 ratio->data.F32[i] = measuredSig / guess->data.F32[i]; 496 ratio->data.F32[i] = guess->data.F32[i] / measuredSig; 497 psTrace("psModules.camera", 9, "Ratio %d: %f, %f, %f\n", 498 i, guess->data.F32[i], measuredSig, ratio->data.F32[i]); 494 499 } 495 500 psFree(source);
Note:
See TracChangeset
for help on using the changeset viewer.
