IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2005, 3:49:21 PM (21 years ago)
Author:
eugene
Message:

rework with masks and noise array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/apply_psf_model.c

    r4129 r4216  
    44// PSFSTAR objects will be refitted
    55// run this function to a specific flux limit?
    6 
    76
    87bool apply_psf_model (psImage *image, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky)
     
    1817    float FIT_NSIGMA  = psMetadataLookupF32 (&status, config, "FIT_NSIGMA");
    1918    float FIT_PADDING = psMetadataLookupF32 (&status, config, "FIT_PADDING");
    20 
    21     float XBORDER  = psMetadataLookupF32 (&status, config, "XBORDER");
    22     float YBORDER  = psMetadataLookupF32 (&status, config, "YBORDER");
    23     psRegion *keep = psRegionAlloc (XBORDER, -XBORDER, YBORDER, -YBORDER);
    24     keep           = psRegionForImage (keep, image, keep);
    25 
    2619    float shapeNsigma = psMetadataLookupF32 (&status, config, "PSF_SHAPE_NSIGMA");
    27     // float snFaint     = psMetadataLookupF32 (&status, config, "FAINT_SN_LIM");
     20    float snFaint     = psMetadataLookupF32 (&status, config, "FAINT_SN_LIM");
     21    float OUTER       = psMetadataLookupF32 (&status, config, "OUTER_RADIUS");
    2822
    2923    // set the object surface-brightness limit for fitted pixels
     
    4640        // set PSF parameters for this model
    4741        model  = psModelFromPSF (model, psf);
     42        x = model->params->data.F32[2];
     43        y = model->params->data.F32[3];
    4844
    4945        // set the fit radius based on the object flux limit and the model
     
    5450          continue;
    5551        }
    56            
    57         // set the valid/invalid pixel mask
    58         pmSourceSetPixelCircle (source, image, model->radius);
    59         pmSourceMaskRegion (source, keep);
     52       
     53        // mask off saturated pixels (move this to setup?)
    6054        pmSourceMaskSaturated (source, SATURATE);
    6155
    62         // fit as PSF, not FLT (skip poor fits)
    63         if (!pmSourceFitModel (source, model, true)) continue;
     56        // check if we need to redefine the pixels
     57        if (model->radius > OUTER) {
     58          // allocate image, noise, mask arrays for each peak (square of radius OUTER)
     59          pmSourceDefinePixels (source, imdata, x, y, OUTER);
     60        }
     61
     62        // set the valid/invalid pixel mask
     63        psImageKeepCircle (source->mask, x, y, model->radius, OR, 0x80);
     64        status = pmSourceFitModel (source, model, true);
     65        psImageKeepCircle (source->mask, x, y, model->radius, AND, 0x7f);
     66        if (!status) continue;
     67
    6468        source->modelPSF = model;
    6569        Niter += model[0].nIter;
Note: See TracChangeset for help on using the changeset viewer.