IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6427


Ignore:
Timestamp:
Feb 14, 2006, 6:33:17 AM (20 years ago)
Author:
eugene
Message:

mods to change from threshold above sky to S/N thresholds

Location:
trunk/psphot
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/doc/notes.txt

    r5980 r6427  
     1
     22006.02.12
     3
     4  Last week, I made a new tag (psphot_dev_08) after finishing the work
     5  to clean memory leaks and to modify psphot to work with Paul's
     6  ppImage infrastructure. 
     7
     8  I have added a new background model function which generates a
     9  median map based on Robert's suggestion of a) half-step windows and
     10  b) linear interpolation.
     11
     12  Now, I am working to remove the constant sky level concepts and make
     13  every relevant test use the signal/noise ratio as the trigger.  This
     14  has impacts on the peak detections, the threshold for blends, and
     15  the threshold for choosing pixels in the fitting routines.
    116
    2172005.12.23
  • trunk/psphot/src/Makefile.am

    r6399 r6427  
    2121        psphotChoosePSF.c       \
    2222        psphotEnsemblePSF.c     \
    23         psphotFullFit.c         \
    2423        psphotBlendFit.c        \
    25         psphotApplyPSF.c        \
    26         psphotFitGalaxies.c     \
    2724        psphotReplaceUnfit.c    \
    2825        psphotApResid.c         \
     
    6562tags:
    6663        etags `find . -name \*.[ch] -print`
     64
     65
     66#       psphotFullFit.c         
     67#       psphotApplyPSF.c       
     68#       psphotFitGalaxies.c
  • trunk/psphot/src/psphot.h

    r6399 r6427  
    3333psStats        *psphotImageStats (pmReadout *readout, psMetadata *config);
    3434psPolynomial2D *psphotImageBackground (pmReadout *readout, psMetadata *config, psStats *sky);
    35 psArray        *psphotFindPeaks (pmReadout *readout, psMetadata *config, psStats *sky);
     35psArray        *psphotFindPeaks (pmReadout *readout, psMetadata *config);
    3636psArray        *psphotSourceStats (pmReadout *readout, psMetadata *config, psArray *allpeaks);
    3737bool            psphotRoughClass (psArray *sources, psMetadata *config);
    38 bool            psphotBasicDeblend (psArray *sources, psMetadata *config, psStats *sky);
    39 pmPSF          *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky);
     38bool            psphotBasicDeblend (psArray *sources, psMetadata *config);
     39pmPSF          *psphotChoosePSF (psMetadata *config, psArray *sources);
    4040void            psphotOutput (pmReadout *readout, psMetadata *arguments);
    41 psImage        *psphotImageMedian (pmReadout *readout, psMetadata *config, psStats *sky);
     41psImage        *psphotImageMedian (pmReadout *readout, psMetadata *config);
    4242
    4343// optional object analysis steps
    44 bool            psphotEnsemblePSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
    45 bool            psphotFullFit (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
    46 bool            psphotBlendFit (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
     44bool            psphotEnsemblePSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf);
     45bool            psphotBlendFit (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf);
    4746bool            psphotReplaceUnfit (psArray *sources);
    48 bool            psphotApplyPSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
    49 bool            psphotFitExtended (pmReadout *readout, psMetadata *config, psArray *sources, psStats *skyStats);
    5047bool            psphotApResid (pmReadout *readout, psArray *sources, psMetadata *config, pmPSF *psf);
     48
     49// XXX deprecate these?
     50// bool            psphotFullFit (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
     51// bool            psphotApplyPSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
     52// bool            psphotFitExtended (pmReadout *readout, psMetadata *config, psArray *sources, psStats *skyStats);
    5153
    5254// basic support functions
     
    6365
    6466// functions to set the correct source pixels
    65 bool            psphotInitRadiusPSF (psMetadata *config, psStats *sky, pmModelType type);
     67bool            psphotInitRadiusPSF (psMetadata *config, pmModelType type);
    6668bool            psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model);
    67 bool            psphotInitRadiusEXT (psMetadata *config, psStats *sky, pmModelType type);
     69bool            psphotInitRadiusEXT (psMetadata *config, pmModelType type);
    6870bool            psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model);
    6971bool            psphotDefinePixels (pmSource *mySource, const pmReadout *readout, psF32 x, psF32 y, psF32 Radius);
     
    111113//  functions to support the source fitting process
    112114bool            psphotInitLimitsPSF (psMetadata *config);
    113 bool            psphotInitLimitsEXT (psMetadata *config, psStats *sky);
     115bool            psphotInitLimitsEXT (psMetadata *config);
    114116bool            psphotFitBlend (pmReadout *readout, pmSource *source);
    115117bool            psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources);
  • trunk/psphot/src/psphotBasicDeblend.c

    r6379 r6427  
    22
    33// 2006.02.07 : no leaks
    4 bool psphotBasicDeblend (psArray *sources, psMetadata *config, psStats *sky) {
     4bool psphotBasicDeblend (psArray *sources, psMetadata *config) {
    55
    66    int N;
     
    1818    float NSIGMA   = psMetadataLookupF32 (&status, config, "DEBLEND_SKY_NSIGMA");
    1919    if (!status) NSIGMA = 5.0;
    20 
    21     float minThreshold = NSIGMA*sky->sampleStdev;
    2220
    2321    // we need sources spatially-sorted to find overlaps
     
    8381        // generate source contour (1/4 peak counts)
    8482        // set the threshold based on user inputs
    85         threshold = FRACTION * (source->peak->counts - source->moments->Sky) + source->moments->Sky;
    86         threshold = PS_MAX (threshold, minThreshold);
     83       
     84        // threshold is fraction of the source peak flux
     85        // image is background subtracted; source->moments->Sky should always be 0.0
     86        threshold = FRACTION * source->moments->Peak;
     87        // threshold is no less than NSIGMA above the local median sigma?
     88        threshold = PS_MAX (threshold, NSIGMA*source->moments->dSky);
    8789
    8890        // generate a basic contour (set of x,y coordinates at-or-below flux level)
  • trunk/psphot/src/psphotBlendFit.c

    r6379 r6427  
    22
    33// XXX I don't like this name
    4 bool psphotBlendFit (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {
     4bool psphotBlendFit (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf) {
    55
    66    psTimerStart ("psphot");
     
    1010   
    1111    psphotInitLimitsPSF (config);
    12     psphotInitLimitsEXT (config, sky);
    13     psphotInitRadiusPSF (config, sky, psf->type);
     12    psphotInitLimitsEXT (config);
     13    psphotInitRadiusPSF (config, psf->type);
    1414
    1515    for (int i = 0; i < sources->n; i++) {
  • trunk/psphot/src/psphotChoosePSF.c

    r6379 r6427  
    33// 2006.02.07 : no leaks!
    44// try PSF models and select best option
    5 pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *skystats) {
     5pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources) {
    66
    77    bool            status;
     
    5252    psListIterator *iter = psListIteratorAlloc (list, PS_LIST_HEAD, FALSE);
    5353    for (int i = 0; i < models->n; i++) {
    54         // XXX psListGetAndIncrement does not increment ref counter!?
    55         // XXX if it did, i should free 'item' below
    5654        psMetadataItem *item = psListGetAndIncrement (iter);
    5755        modelName = item->data.V;
    5856        models->data[i] = pmPSFtryModel (stars, modelName, RADIUS);
    59         // psFree (item);
    6057    }
    6158    psFree (iter);
  • trunk/psphot/src/psphotEnsemblePSF.c

    r6379 r6427  
    33// 2006.02.07 : no leaks!
    44// fit all reasonable sources with the linear PSF model
    5 bool psphotEnsemblePSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {
     5bool psphotEnsemblePSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf) {
    66
    77    bool  status;
     
    1515    sources = psArraySort (sources, psphotSortByY);
    1616
     17    // radius for source moments if star is saturated
     18    // XXX we already do this in psphotSourceStats, is it still needed?
    1719    float INNER_RADIUS     = psMetadataLookupF32 (&status, config, "SKY_INNER_RADIUS");
    18     float PSF_FIT_NSIGMA   = psMetadataLookupF32 (&status, config, "PSF_FIT_NSIGMA");
    19     float PSF_FIT_PADDING  = psMetadataLookupF32 (&status, config, "PSF_FIT_PADDING");
    2020
    21     // set the object surface-brightness limit for fitted pixels
    22     float FLUX_LIMIT  = PSF_FIT_NSIGMA * sky->sampleStdev;
    23     psLogMsg ("psphot.ensemble", 4, "fitting pixels with at least %f object counts\n", FLUX_LIMIT);
     21    // setup the PSF fit details
     22    psphotInitRadiusPSF (config, psf->type);
    2423
    2524    // pre-calculate all model pixels
     
    2928    index->n = 0;
    3029
     30    // option to limit analysis to a specific region
    3131    bool UseAnalysisRegion = false;
    3232    psRegion AnalysisRegion = {0, 0, 0, 0};
     
    9898        y = model->params->data.F32[3];
    9999
    100         // get function which specifies the radius at which the model hits the given flux
    101         pmModelRadius modelRadius = pmModelRadius_GetFunction (psf->type);
    102 
    103100        // set the fit radius based on the object flux limit and the model
    104         model->radius = modelRadius (model->params, FLUX_LIMIT) + PSF_FIT_PADDING;
    105         if (isnan(model->radius)) psAbort ("psphotEnsemblePSF", "error in radius");
    106 
    107         // if needed, ask for more object pixels
    108         psphotRedefinePixels (inSource, readout, x, y, model->radius);
     101        psphotCheckRadiusPSF (readout, inSource, model);
    109102
    110103        // make temporary copies of the image pixels and mask
     
    116109        psImage *mask = otSource->mask;
    117110
    118         // set model to unit peak, zero sky (we assume sky is constant)
     111        // set model to unit peak, zero sky (we assume sky is subtracted)
    119112        model->params->data.F32[0] = 0.0;
    120113        model->params->data.F32[1] = 1.0;
     
    165158    psLogMsg ("psphot.emsemble", 4, "built matrix: %f (%d elements)\n", psTimerMark ("psphot"), sparse->Nelem);
    166159
    167     // solve for normalization terms (need include local sky)
     160    // solve for normalization terms (need include local sky?)
    168161    psSparseResort (sparse);
    169162    psVector *norm = psSparseSolve (NULL, sparse, 3);
  • trunk/psphot/src/psphotFindPeaks.c

    r6379 r6427  
    22
    33// 2006.02.02 : no leaks
    4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *config, psStats *sky) {
     4psArray *psphotFindPeaks (pmReadout *readout, psMetadata *config) {
    55
    66    bool  status = false;
     
    99    float threshold;
    1010
    11     // smooth the image
     11    // smooth the image and weight map
     12
     13    psphotSaveImage (NULL, readout->image, "image.fits");
    1214
    1315    psTimerStart ("psphot");
     
    1618    NSIGMA = psMetadataLookupF32 (&status, config, "PEAKS_SMOOTH_NSIGMA");
    1719
    18     psImage *smooth = psImageCopy (NULL, readout->image, PS_TYPE_F32);
    19     psphotSaveImage (NULL, smooth, "presmooth.fits");
     20    psImage *smooth_im = psImageCopy (NULL, readout->image, PS_TYPE_F32);
     21    psImageSmooth (smooth_im, SIGMA, NSIGMA);
     22    psLogMsg ("psphot", 4, "smooth image: %f sec\n", psTimerMark ("psphot"));
    2023
    21     psImageSmooth (smooth, SIGMA, NSIGMA);
    22     psLogMsg ("psphot", 4, "smooth: %f sec\n", psTimerMark ("psphot"));
     24    psphotSaveImage (NULL, smooth_im, "smooth_im.fits");
    2325
    24     psphotSaveImage (NULL, smooth, "smooth.fits");
     26    psImage *smooth_wt = psImageCopy (NULL, readout->weight, PS_TYPE_F32);
     27    psImageSmooth (smooth_wt, SIGMA, NSIGMA);
     28    psLogMsg ("psphot", 4, "smooth weight: %f sec\n", psTimerMark ("psphot"));
     29
     30    psphotSaveImage (NULL, smooth_wt, "smooth_wt.fits");
     31
     32    psTimerStart ("psphot");
     33    for (int j = 0; j < smooth_im->numRows; j++) {
     34        for (int i = 0; i < smooth_im->numCols; i++) {
     35            if (smooth_wt->data.F32[j][i] <= 0) continue;
     36            smooth_im->data.F32[j][i] = PS_SQR(smooth_im->data.F32[j][i]) / smooth_wt->data.F32[j][i];
     37        }
     38    }
     39    psLogMsg ("psphot", 4, "built S/N map: %f sec\n", psTimerMark ("psphot"));
    2540
    2641    psTimerStart ("psphot");
    2742
    2843    // set peak threshold
    29     NSIGMA    = psMetadataLookupF32 (&status, config, "PEAKS_NSIGMA_LIMIT");
    30    
    31     threshold = NSIGMA*sky->sampleStdev + sky->sampleMean;
    32     // threshold = NSIGMA*sky->sampleStdev;
     44    NSIGMA = psMetadataLookupF32 (&status, config, "PEAKS_NSIGMA_LIMIT");
     45    // threshold = NSIGMA*sky->sampleStdev + sky->sampleMean;
     46    threshold = PS_SQR(NSIGMA);
    3347    psLogMsg ("psphot", 4, "threshold: %f DN\n", threshold);
    3448
    3549    // find the peaks in the smoothed image
    36     psArray *peaks = pmFindImagePeaks (smooth, threshold);
     50    psArray *peaks = pmFindImagePeaks (smooth_im, threshold);
    3751    if (peaks == NULL) psAbort ("find peaks", "no peaks found");
    38     psFree (smooth);
     52    psFree (smooth_im);
     53    psFree (smooth_wt);
    3954
    4055    // optional dump of all peak data
  • trunk/psphot/src/psphotImageMedian.c

    r6399 r6427  
    1111// generate the median in NxN boxes, clipping heavily
    1212// linear interpolation to generate full-scale model
    13 psImage *psphotImageMedian (pmReadout *readout, psMetadata *config, psStats *sky)
     13psImage *psphotImageMedian (pmReadout *readout, psMetadata *config)
    1414{
    1515    bool status;
     
    2020    if (!status) MAX_SAMPLE_PIXELS = 1000;
    2121
    22     // fit background to subset of image points within 3 sigma of sky
    2322    psTimerStart ("psphot");
    2423
     
    262261    value = value / npts;
    263262   
     263    // XXX correct for selection bias??
     264
    264265    psFree (values);
    265266    return value;
  • trunk/psphot/src/psphotRadiusChecks.c

    r6056 r6427  
    11# include "psphot.h"
    22
    3 static float PSF_OUTER_RADIUS;
     3static float PSF_FIT_NSIGMA;
    44static float PSF_FIT_PADDING;
    5 static float PSF_FLUX_LIMIT;
    65static pmModelRadius modelRadiusPSF;
    76
    8 bool psphotInitRadiusPSF (psMetadata *config, psStats *sky, pmModelType type) {
     7bool psphotInitRadiusPSF (psMetadata *config, pmModelType type) {
    98
    109    bool status;
    1110
    12     float PSF_FIT_NSIGMA = psMetadataLookupF32 (&status, config, "PSF_FIT_NSIGMA");
    13     PSF_OUTER_RADIUS     = psMetadataLookupF32 (&status, config, "PSF_OUTER_RADIUS");
    14     PSF_FIT_PADDING      = psMetadataLookupF32 (&status, config, "PSF_FIT_PADDING");
    15     PSF_FLUX_LIMIT       = PSF_FIT_NSIGMA * sky->sampleStdev;
     11    PSF_FIT_NSIGMA   = psMetadataLookupF32 (&status, config, "PSF_FIT_NSIGMA");
     12    PSF_FIT_PADDING  = psMetadataLookupF32 (&status, config, "PSF_FIT_PADDING");
    1613
    1714    // this function specifies the radius at this the model hits the given flux
     
    2219bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model) {
    2320
     21    pmMoments *moments = source->moments;
     22    if (moments == NULL) return false;
     23
    2424    // set the fit radius based on the object flux limit and the model
    25     // XXX EAM : FLUX_LIMIT should be set based on local sky model (not global median)
    26     model->radius = modelRadiusPSF (model->params, PSF_FLUX_LIMIT) + PSF_FIT_PADDING;
     25    model->radius = modelRadiusPSF (model->params, PSF_FIT_NSIGMA*moments->dSky) + PSF_FIT_PADDING;
    2726    if (isnan(model->radius)) psAbort ("apply_psf_model", "error in radius");
    2827       
     
    3534}
    3635
    37 static float EXT_OUTER_RADIUS;
     36static float EXT_FIT_NSIGMA;
    3837static float EXT_FIT_PADDING;
    39 static float EXT_FLUX_LIMIT;
    4038static pmModelRadius modelRadiusEXT;
    4139
    42 bool psphotInitRadiusEXT (psMetadata *config, psStats *sky, pmModelType type) {
     40bool psphotInitRadiusEXT (psMetadata *config, pmModelType type) {
    4341
    4442    bool status;
    4543
    46     float EXT_FIT_NSIGMA = psMetadataLookupF32 (&status, config, "EXT_FIT_NSIGMA");
    47     EXT_OUTER_RADIUS     = psMetadataLookupF32 (&status, config, "EXT_OUTER_RADIUS");
    48     EXT_FIT_PADDING      = psMetadataLookupF32 (&status, config, "EXT_FIT_PADDING");
    49     EXT_FLUX_LIMIT       = EXT_FIT_NSIGMA * sky->sampleStdev;
     44    EXT_FIT_NSIGMA   = psMetadataLookupF32 (&status, config, "EXT_FIT_NSIGMA");
     45    EXT_FIT_PADDING  = psMetadataLookupF32 (&status, config, "EXT_FIT_PADDING");
    5046
    5147    // this function specifies the radius at this the model hits the given flux
     
    5652bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model) {
    5753
     54    pmMoments *moments = source->moments;
     55    if (moments == NULL) return false;
     56
    5857    // set the fit radius based on the object flux limit and the model
    59     model->radius = modelRadiusEXT (model->params, EXT_FLUX_LIMIT) + EXT_FIT_PADDING;
     58    model->radius = modelRadiusEXT (model->params, EXT_FIT_NSIGMA*moments->dSky) + EXT_FIT_PADDING;
    6059    if (isnan(model->radius)) psAbort (__func__, "error in radius");
    6160
  • trunk/psphot/src/psphotReadout.c

    r6399 r6427  
    44bool psphotReadout (pmReadout *readout, psMetadata *config) {
    55
    6     psArray     *sources = NULL;
    7     psArray     *peaks   = NULL;
    8     pmPSF       *psf    = NULL;
    9     psStats     *sky     = NULL;
     6    psArray     *sources  = NULL;
     7    psArray     *peaks    = NULL;
     8    psImage     *skymodel = NULL;
     9    pmPSF       *psf      = NULL;
    1010    bool         status;
    11     psPolynomial2D *model = NULL;
    1211
    13     psphotImageMedian (readout, config, sky);
    14 
    15     // measure image stats for initial guess
    16     sky = psphotImageStats (readout, config);
    17 
    18     // generate a background model (currently, 2D polynomial)
    19     // XXX this should be available to be re-added to the original image
    20     model = psphotImageBackground (readout, config, sky);
     12    // generate a background model (median, smoothed image)
     13    skymodel = psphotImageMedian (readout, config);
    2114
    2215    // find the peaks in the image
    23     peaks = psphotFindPeaks (readout, config, sky);
     16    peaks = psphotFindPeaks (readout, config);
    2417
    2518    // construct sources and measure basic stats
     
    3023
    3124    // mark blended peaks PS_SOURCE_BLEND
    32     psphotBasicDeblend (sources, config, sky);
     25    psphotBasicDeblend (sources, config);
    3326
    3427    // use bright stellar objects to measure PSF
    35     psf = psphotChoosePSF (config, sources, sky);
     28    psf = psphotChoosePSF (config, sources);
    3629
    37     // XXX change FITMODE to a string
     30    // select analysis method
    3831    char *FITMODE = psMetadataLookupStr (&status, config, "FITMODE");
    3932    if (!strcasecmp(FITMODE, "ENSEMBLE")) {
    40         psphotEnsemblePSF (readout, config, sources, psf, sky);
    41     }
    42 
    43     if (!strcasecmp(FITMODE, "FULL")) {
    44         psphotEnsemblePSF (readout, config, sources, psf, sky);
    45         psphotFullFit (readout, config, sources, psf, sky);
    46         psphotReplaceUnfit (sources);
    47         psphotApResid (readout, sources, config, psf);
     33        psphotEnsemblePSF (readout, config, sources, psf);
    4834    }
    4935
    5036    if (!strcasecmp(FITMODE, "BLEND")) {
    51         psphotEnsemblePSF (readout, config, sources, psf, sky);
    52         psphotBlendFit (readout, config, sources, psf, sky);
     37        psphotEnsemblePSF (readout, config, sources, psf);
     38        psphotBlendFit (readout, config, sources, psf);
    5339        psphotReplaceUnfit (sources);
    5440        psphotApResid (readout, sources, config, psf);
    55     }
    56 
    57     if (!strcasecmp(FITMODE, "BASIC")) {
    58         psphotApplyPSF (readout, config, sources, psf, sky);
    59         psphotFitExtended (readout, config, sources, sky);
    6041    }
    6142
     
    6546    psphotUpdateHeader (header, config);
    6647
     48    // psphotSkyReplace (readout, skymodel);
     49
    6750    // need to do something with the sources, psf, and sky
    6851    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES",   PS_DATA_ARRAY,   "psphot sources", sources);
    6952    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF",       PS_DATA_UNKNOWN, "psphot psf", psf);
    70     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.MEAN",  PS_DATA_F32,     "psphot sky mean", sky->sampleMean);
    71     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.SIGMA", PS_DATA_F32,     "psphot sky stdev", sky->sampleStdev);
     53    // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.MEAN",  PS_DATA_F32,     "psphot sky mean", sky->sampleMean);
     54    // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.SIGMA", PS_DATA_F32,     "psphot sky stdev", sky->sampleStdev);
    7255
    7356    // free up the local copies of the data
    7457    psFree (psf);
    75     psFree (sky);
    76     psFree (model);
    7758    psFree (peaks);
    7859    psFree (sources);
     60    psFree (skymodel);
    7961
    8062    return true;
    8163}
     64
     65
     66// XXX Deprecate or allow these versions?
     67# if (0)
     68    if (!strcasecmp(FITMODE, "FULL")) {
     69        psphotEnsemblePSF (readout, config, sources, psf);
     70        psphotFullFit (readout, config, sources, psf);
     71        psphotReplaceUnfit (sources);
     72        psphotApResid (readout, sources, config, psf);
     73    }
     74
     75    if (!strcasecmp(FITMODE, "BASIC")) {
     76        psphotApplyPSF (readout, config, sources, psf);
     77        psphotFitExtended (readout, config, sources);
     78    }
     79
     80# endif
  • trunk/psphot/src/psphotSourceFits.c

    r6379 r6427  
    4545static pmModelType modelTypeEXT;
    4646
    47 bool psphotInitLimitsEXT (psMetadata *config, psStats *sky) {
     47bool psphotInitLimitsEXT (psMetadata *config) {
    4848
    4949    bool status;
     
    5656    char *modelNameEXT = psMetadataLookupStr (&status, config, "EXT_MODEL");
    5757    modelTypeEXT = pmModelSetType (modelNameEXT);
    58     psphotInitRadiusEXT (config, sky, modelTypeEXT);
     58    psphotInitRadiusEXT (config, modelTypeEXT);
    5959
    6060    return true;
     
    250250        }
    251251
    252         model->params->data.F32[1] = blend->peak->counts;
     252        // XXX assume local sky is 0.0?
     253        model->params->data.F32[1] = blend->moments->Peak - blend->moments->Sky;
    253254        model->params->data.F32[2] = blend->peak->x;
    254255        model->params->data.F32[3] = blend->peak->y;
  • trunk/psphot/src/psphotSourceStats.c

    r6379 r6427  
    2525
    2626        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
    27         // XXX EAM : this has 12 leaks (v.5)
    2827        psphotDefinePixels (source, readout, source->peak->x, source->peak->y, OUTER);
    2928
     
    3130        // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
    3231        status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER);
     32        if (!status) {
     33          psFree (source);
     34          continue;
     35        }
     36
     37        // measure the local sky variance (needed if noise is not sqrt(signal))
     38        // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
     39        status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER);
    3340        if (!status) {
    3441          psFree (source);
Note: See TracChangeset for help on using the changeset viewer.