IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 19, 2011, 10:29:48 AM (15 years ago)
Author:
eugene
Message:

build-time option to re-photometer the psf match sources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/ppStack/src/ppStackPrepare.c

    r30620 r30702  
    1 #include "ppStack.h"
    2 
    3 #define PHOT_SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_SATSTAR | PM_SOURCE_MODE_BLEND | \
    4                           PM_SOURCE_MODE_BADPSF | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \
    5                           PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT) // Mask to apply to sources
     1# include "ppStack.h"
     2
     3# define RE_PHOTOMETER 0
     4
     5# define PHOT_SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_SATSTAR | PM_SOURCE_MODE_BLEND | \
     6                           PM_SOURCE_MODE_BADPSF | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \
     7                           PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT) // Mask to apply to sources
    68
    79bool ppStackInputPhotometer(const pmReadout *ro, const psArray *sources, const pmConfig *config)
     
    1315    psAssert(recipe, "We've thrown an error on this before.");
    1416
     17# if (RE_PHOTOMETER)
    1518    bool mdok;                          // Status of MD lookup
    1619
     
    3841    psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask
    3942
     43    // Measure background
    4044    psImage *image = ro->image, *mask = ro->mask; // Image and mask from readout
    41 
    42     // Measure background
    4345    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
    4446    psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics
     
    5254    psFree(stats);
    5355    psFree(rng);
    54 
    55     // Photometer sources
    56     int numCols = image->numCols, numRows = image->numRows; // Size of image
     56# endif
     57
     58    // Examine the sources (photometer if RE_PHOTOMETER is set)
    5759    int numSources = sources->n; // Number of sources
    5860    int numGood = 0;            // Number of good sources
     
    6466            continue;
    6567        }
    66         float x = source->peak->xf, y = source->peak->yf; // Coordinates of source
     68
     69// This code re-measures the magnitude in the assumption that the warp analysis failed It would
     70// be better to catch and correct such cases.  In any case, we should check on the validity of
     71// this assumption (eg, compare the mean psf-ap offset) and raise an error on that?
     72
     73# if (RE_PHOTOMETER)
     74       
     75        int numCols = image->numCols, numRows = image->numRows; // Size of image
     76        float x = source->peak->xf, y = source->peak->yf; // Coordinates of source
    6777        int xCentral = x + 0.5, yCentral = y + 0.5; // Central pixel
    6878        // Range of integration
     
    96106            }
    97107        }
     108# else
     109        numGood++;
     110        maxMag = PS_MAX(maxMag, source->psfMag);
     111# endif
    98112    }
    99113    psLogMsg("ppStack", PS_LOG_INFO, "Photometered %d good sources in image; max mag %f", numGood, maxMag);
Note: See TracChangeset for help on using the changeset viewer.