IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25467


Ignore:
Timestamp:
Sep 21, 2009, 3:19:36 PM (17 years ago)
Author:
Paul Price
Message:

Fix compilation errors when TESTING.
Make the image to be convolved the *second* image (instead of the first) so that the scaling of chi2 is relative to the fake image, which should have the same scaling for all inputs.
Set the fake source radius using the background noise.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackMatch.c

    r25447 r25467  
    1515#define SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \
    1616                     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 flux
     17#define NOISE_FRACTION 0.01             // Set minimum flux to this fraction of noise
    1818#define COVAR_FRAC 0.01                 // Truncation fraction for covariance matrix
    1919
     
    319319            pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
    320320
     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
    321336            // For the sake of stamps, remove nearby sources
    322337            psArray *stampSources = stackSourcesFilter(options->sourceLists->data[index],
     
    325340            if (!pmReadoutFakeFromSources(fake, readout->image->numCols, readout->image->numRows,
    326341                                          stampSources, SOURCE_MASK, NULL, NULL, options->psf,
    327                                           NAN, footprint + size, false, true)) {
     342                                          minFlux, footprint + size, false, true)) {
    328343                psError(PS_ERR_UNKNOWN, false, "Unable to generate fake image with target PSF.");
    329344                psFree(fake);
     
    371386                                                               PM_SUBTRACTION_ANALYSIS_KERNEL); // Conv kernel
    372387            if (kernel) {
    373                 if (!pmSubtractionMatchPrecalc(conv, NULL, readout, fake, readout->analysis,
     388                if (!pmSubtractionMatchPrecalc(NULL, conv, fake, readout, readout->analysis,
    374389                                               stride, sysError, maskVal, maskBad, maskPoor,
    375390                                               poorFrac, badFrac)) {
     
    385400                }
    386401            } else {
    387                 if (!pmSubtractionMatch(conv, NULL, readout, fake, footprint, stride, regionSize, spacing,
     402                if (!pmSubtractionMatch(NULL, conv, fake, readout, footprint, stride, regionSize, spacing,
    388403                                        threshold, stampSources, stampsName, type, size, order, widths,
    389404                                        orders, inner, ringsOrder, binning, penalty,
    390405                                        optimum, optWidths, optOrder, optThresh, iter, rej, sysError,
    391406                                        maskVal, maskBad, maskPoor, poorFrac, badFrac,
    392                                         PM_SUBTRACTION_MODE_1)) {
     407                                        PM_SUBTRACTION_MODE_2)) {
    393408                    psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
    394409                    psFree(fake);
Note: See TracChangeset for help on using the changeset viewer.