IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4116


Ignore:
Timestamp:
Jun 5, 2005, 8:41:28 PM (21 years ago)
Author:
eugene
Message:

using source masks to select PSF stars

Location:
trunk/psphot/src
Files:
5 edited

Legend:

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

    r4115 r4116  
    11# include "psphot.h"
    22
    3 // fit psf model to all objects not already fitted (modelPSF == NULL)
     3// fit psf model to all objects
     4// PSFSTAR objects will be refitted
    45// run this function to a specific flux limit?
     6
    57
    68bool apply_psf_model (psImage *image, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky)
     
    3537        psSource *source = sources->data[i];
    3638
    37         // skip the existing PSF stars
    38         // XXX drop this -- refit?
    39         if (source->modelPSF != NULL) continue;
    40 
    4139        // skip non-astronomical objects (very likely defects)
    4240        if (source->type == PS_SOURCE_DEFECT) continue;
     
    5452        if (isnan(model->radius)) {
    5553          fprintf (stderr, "error in radius\n");
     54          continue;
    5655        }
    5756           
  • trunk/psphot/src/mark_psf_source.c

    r4115 r4116  
    2222    if (source->modelPSF == NULL) return (false);
    2323
    24     if (source->type == PS_SOURCE_PSFSTAR) return (true);
     24    // SATSTAR objects are fitted with PSF regardless
    2525    if (source->type == PS_SOURCE_SATSTAR) return (true);
    2626
     
    3636    // assign PS_SOURCE_BRIGHTSTAR to bright objects within PSF region of dparams[]
    3737    if ((fabs(nSx) < shapeNsigma) && (fabs(nSy) < shapeNsigma)) {
     38      if (source->type == PS_SOURCE_PSFSTAR) return (true);
    3839      source->type = PS_SOURCE_BRIGHTSTAR;
    3940      return (true);
    4041    }
    4142   
     43    if (source->type == PS_SOURCE_PSFSTAR) {
     44      psLogMsg ("psphot", 3, "PSFSTAR demoted based on dSx, dSy\n");
     45    }
     46
    4247    if ((nSx >= shapeNsigma) || (nSy >= shapeNsigma)) {
    4348      source->type = PS_SOURCE_GALAXY;
  • trunk/psphot/src/psPolynomials.c

    r4115 r4116  
    453453                            const psVector* dz)
    454454{
     455    PS_VECTOR_CHECK_NULL(mask, NULL);
     456    PS_VECTOR_CHECK_NULL(x, NULL);
     457    PS_VECTOR_CHECK_NULL(y, NULL);
     458    PS_VECTOR_CHECK_NULL(z, NULL);
     459    PS_VECTOR_CHECK_NULL(dz, NULL);
     460
    455461    psVector *zFit   = NULL;
    456     psVector *zResid = NULL;
    457     psStats  *stats  = NULL;
     462    psVector *zResid = psVectorAlloc (x->n, PS_TYPE_F64);
     463    psStats  *stats  = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
    458464
    459465    for (int N = 0; N < 3; N++) {
    460466        poly   = VectorFitPolynomial2DOrd_EAM (poly, mask, x, y, z, dz);
    461467        zFit   = Polynomial2DEvalVectorD (poly, x, y);
    462         zResid = (psVector *) psBinaryOp (NULL, (void *) z, "-", (void *) zFit);
    463 
    464         stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
     468        zResid = (psVector *) psBinaryOp (zResid, (void *) z, "-", (void *) zFit);
     469
    465470        stats  = psVectorStats (stats, zResid, NULL, mask, 1);
    466         psTrace (".psphot.RobustFit", 4, "residual stats for robust fit:  %g +/- %g (%d pts)\n",
    467                  stats->clippedMean, stats->clippedStdev, stats->clippedNvalues);
     471        psTrace (".psphot.RobustFit", 4, "residual stats for robust fit:  %g +/- %g\n",
     472                 stats->sampleMean, stats->sampleStdev);
    468473
    469474        // set mask if pts are not valid
    470         int n = 0;
     475        // we are masking out any point which is out of range
     476        // recovery is not allowed with this scheme
    471477        for (int i = 0; i < zResid->n; i++) {
    472             if (fabs(zResid->data.F64[i] - stats->clippedMean) > 3*stats->clippedStdev) {
    473               mask->data.U8[i] = 1;
    474               continue;
    475             } else {
    476               mask->data.U8[i] = 0;
    477             }         
    478             n++;
    479         }
    480     }
     478          if (mask->data.U8[i]) continue;
     479          if (fabs(zResid->data.F64[i] - stats->sampleMean) > 3*stats->sampleStdev) {
     480            mask->data.U8[i] = 1;
     481            continue;
     482          }       
     483        }
     484        psFree (zFit);
     485    }
     486    psFree (zResid);
     487    psFree (stats);
    481488    return (poly);
    482489}
  • trunk/psphot/src/pspsf.c

    r4115 r4116  
    172172    // we are doing a robust fit.  after each pass, we drop points which are
    173173    // more deviant than three sigma.
    174     // mask is currently updated for each pass. this is inconsistent
     174    // mask is currently updated for each pass. this is inconsistent?
    175175
    176176    for (int i = 0; i < psf->params->n; i++) {
  • trunk/psphot/src/subtract_psf_source.c

    r4115 r4116  
    99  psSource *source = sources->data[i];
    1010
     11  // non-stellar sources are ignored
    1112  if (source->type == PS_SOURCE_GALAXY) return (false);
    1213  if (source->type == PS_SOURCE_DEFECT) return (false);
Note: See TracChangeset for help on using the changeset viewer.