- Timestamp:
- Sep 27, 2009, 11:34:07 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/ppStack/src/ppStackMatch.c
r25406 r25624 15 15 #define SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \ 16 16 PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT) // Mask to apply to input sources 17 #define FAINT_SOURCE_FRAC 1.0e-4 // Set minimum flux to this fraction of faintest source flux17 #define NOISE_FRACTION 0.01 // Set minimum flux to this fraction of noise 18 18 #define COVAR_FRAC 0.01 // Truncation fraction for covariance matrix 19 19 … … 266 266 psRegion *region = psMetadataLookupPtr(NULL, conv->analysis, 267 267 PM_SUBTRACTION_ANALYSIS_REGION); // Convolution region 268 269 pmSubtractionAnalysis(readout->analysis, kernels, region, 268 pmSubtractionKernels *kernels = psMetadataLookupPtr(NULL, conv->analysis, 269 PM_SUBTRACTION_ANALYSIS_KERNEL); 270 271 pmSubtractionAnalysis(readout->analysis, NULL, kernels, region, 270 272 readout->image->numCols, readout->image->numRows); 271 273 … … 317 319 pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF 318 320 321 psStats *bg = psStatsAlloc(PS_STAT_ROBUST_STDEV); // Statistics for background 322 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator 323 if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskVal | maskBad, rng)) { 324 psError(PS_ERR_UNKNOWN, false, "Can't measure background for image."); 325 psFree(fake); 326 psFree(optWidths); 327 psFree(conv); 328 psFree(bg); 329 psFree(rng); 330 return false; 331 } 332 float minFlux = NOISE_FRACTION * bg->robustStdev; // Minimum flux level for fake image 333 psFree(rng); 334 psFree(bg); 335 319 336 // For the sake of stamps, remove nearby sources 320 337 psArray *stampSources = stackSourcesFilter(options->sourceLists->data[index], … … 323 340 if (!pmReadoutFakeFromSources(fake, readout->image->numCols, readout->image->numRows, 324 341 stampSources, SOURCE_MASK, NULL, NULL, options->psf, 325 NAN, footprint + size, false, true)) {342 minFlux, footprint + size, false, true)) { 326 343 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake image with target PSF."); 327 344 psFree(fake); … … 369 386 PM_SUBTRACTION_ANALYSIS_KERNEL); // Conv kernel 370 387 if (kernel) { 371 if (!pmSubtractionMatchPrecalc( conv, NULL, readout, fake, readout->analysis,388 if (!pmSubtractionMatchPrecalc(NULL, conv, fake, readout, readout->analysis, 372 389 stride, sysError, maskVal, maskBad, maskPoor, 373 390 poorFrac, badFrac)) { … … 383 400 } 384 401 } else { 385 if (!pmSubtractionMatch( conv, NULL, readout, fake, footprint, stride, regionSize, spacing,402 if (!pmSubtractionMatch(NULL, conv, fake, readout, footprint, stride, regionSize, spacing, 386 403 threshold, stampSources, stampsName, type, size, order, widths, 387 404 orders, inner, ringsOrder, binning, penalty, 388 405 optimum, optWidths, optOrder, optThresh, iter, rej, sysError, 389 406 maskVal, maskBad, maskPoor, poorFrac, badFrac, 390 PM_SUBTRACTION_MODE_ 1)) {407 PM_SUBTRACTION_MODE_2)) { 391 408 psError(PS_ERR_UNKNOWN, false, "Unable to match images."); 392 409 psFree(fake);
Note:
See TracChangeset
for help on using the changeset viewer.
