IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.