IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2009, 3:12:47 PM (17 years ago)
Author:
eugene
Message:

check in changes from gene@development branch : extensive changes to moments calculation, psf model generation, aperture residuals; improvements to extended source analysis

Location:
trunk/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src

    • Property svn:ignore
      •  

        old new  
        1818psphotVersionDefinitions.h
        1919psphotMomentsStudy
         20psphotPetrosianStudy
  • trunk/psphot/src/psphotChoosePSF.c

    r23989 r25755  
    11# include "psphotInternal.h"
    2 
    3 void psphotCountPSFStars (psArray *sources) {
    4 
    5     int nPSF = 0;
    6 
    7     // select the candidate PSF stars (pointers to original sources)
    8     for (int i = 0; i < sources->n; i++) {
    9         pmSource *source = sources->data[i];
    10         if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
    11             nPSF ++;
    12         }
    13     }
    14 
    15     fprintf (stderr, "N PSF: %d\n", nPSF);
    16 }
    172
    183// try PSF models and select best option
     
    7358    // get the fixed PSF fit radius
    7459    // XXX check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS
    75     options->radius = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
    76     assert (status);
     60    // options->radius = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
     61    // assert (status);
     62
     63    // We have calculated a Gaussian window function, use that for both the PSF fit radius and
     64    // the aperture radius (scaling SIGMA)
     65    float gaussSigma = psMetadataLookupF32(&status, recipe, "MOMENTS_GAUSS_SIGMA");
     66    float fitScale = psMetadataLookupF32(&status, recipe, "PSF_FIT_RADIUS_SCALE");
     67    float apScale = psMetadataLookupF32(&status, recipe, "PSF_APERTURE_SCALE");
     68    options->fitRadius = (int)(fitScale*gaussSigma);
     69    options->apRadius = (int)(apScale*gaussSigma);
     70
     71    // XXX use the same radii for standard analysis as for the PSF creation
     72    psMetadataAddF32(recipe, PS_LIST_TAIL, "PSF_FIT_RADIUS", PS_META_REPLACE, "fit radius", options->fitRadius);
     73    psMetadataAddF32(recipe, PS_LIST_TAIL, "PSF_APERTURE", PS_META_REPLACE, "psf aperture", options->apRadius);
    7774
    7875    // XXX ROBUST seems to be too agressive given the small numbers.
     
    9996
    10097    psArray *stars = psArrayAllocEmpty (sources->n);
    101 
    102     // psphotCountPSFStars (sources);
    10398
    10499    // select the candidate PSF stars (pointers to original sources)
     
    115110    }
    116111
    117     // psphotCountPSFStars (sources);
    118 
    119112    // check that the identified psf stars sufficiently cover the region; if not, extend the
    120113    // limits somewhat
    121114    psphotCheckStarDistribution (stars, sources, options);
    122 
    123     // psphotCountPSFStars (sources);
    124115
    125116    psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
     
    289280    // XXX test dump of psf star data and psf-subtracted image
    290281    if (psTraceGetLevel("psphot.psfstars") > 5) {
    291         psphotDumpPSFStars (readout, try, options->radius, maskVal, markVal);
     282        psphotDumpPSFStars (readout, try, options->fitRadius, maskVal, markVal);
    292283    }
    293284
    294285    // save only the best model;
    295     // XXX we are not saving the fitted sources
    296     // XXX do we want to keep them so we may optionally write them out?
    297286    pmPSF *psf = psMemIncrRefCounter(try->psf);
    298287    psFree (models);
     
    305294    }
    306295
    307     // psphotCountPSFStars (sources);
    308 
    309296    char *modelName = pmModelClassGetName (psf->type);
    310297    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "select psf model: %f sec\n", psTimerMark ("psphot.choose.psf"));
     
    341328            // create modelPSF from this model
    342329            pmModel *modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0);
    343             if (!modelPSF) continue;
     330            if (!modelPSF) {
     331                fprintf (stderr, "?");
     332                continue;
     333            }
    344334
    345335            // get the model full-width at half-max
     
    354344
    355345            float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
    356             if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) continue;
     346            if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) {
     347                fprintf (stderr, "!");
     348                continue;
     349            }
    357350            psVectorAppend (fwhmMajor, FWHM_MAJOR);
    358351            psVectorAppend (fwhmMinor, FWHM_MINOR);
Note: See TracChangeset for help on using the changeset viewer.