IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14759


Ignore:
Timestamp:
Sep 5, 2007, 12:09:40 PM (19 years ago)
Author:
eugene
Message:

if we have a PSF already, use the resulting value for FWHM_X,Y

File:
1 edited

Legend:

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

    r14756 r14759  
    22
    33// 2006.02.02 : no leaks
    4 bool psphotRoughClass (psArray *sources, psMetadata *recipe, const bool findPsfClump, psMaskType maskSat) {
    5 
    6     // XXX rather than using a static psfClump, should we push X,Y, dX,dY  into the metadata?
     4bool psphotRoughClass (psArray *sources, psMetadata *recipe, const bool havePSF, psMaskType maskSat) {
    75
    86    static pmPSFClump   psfClump;
    9     static bool havePsfClump = false;
    107
    118    psTimerStart ("psphot");
    129
    13     if (findPsfClump) {
     10    if (!havePSF) {
     11        // determine the PSF parameters from the source moment values
    1412        psfClump = pmSourcePSFClump (sources, recipe);
    15     } else if (!havePsfClump) {
    16         psError(PSPHOT_ERR_PROG, false, "You must find the PSF clump before reusing it");
    17     } else {
    18         ;
     13    } else
     14        // pull FWHM_X,Y from the recipe, use to define psfClump.X,Y
     15        bool status_x, status_y;
     16        float FWHM_X = psMetadataLookupF32 (&status_x, recipe, "FWHM_X");
     17        float FWHM_Y = psMetadataLookupF32 (&status_y, recipe, "FWHM_Y");
     18        float ANGLE  = psMetadataLookupF32 (&status_a, recipe, "ANGLE");
     19        if (!status_x | !status_y | !status_a) {
     20            psError(PSPHOT_ERR_CONFIG, false, "FWHM_X, FWHM_Y, or ANGLE not defined");
     21            return false;
     22        }
     23
     24        psEllipseAxes axes;
     25        axes.major = FWHM_X / (2.0*sqrt(2.0*log(2.0)));
     26        axes.minor = FWHM_Y / (2.0*sqrt(2.0*log(2.0)));
     27        axes.theta = ANGLE;
     28        psEllipseShape shape = psEllipseAxesToShape (axes);
     29       
     30        psfClump.X   = shape.sx;
     31        psfClump.Y   = shape.sy;
     32        psfClump.dX  = 0.1*shape.sx;
     33        psfClump.dY  = 0.1*shape.sy;
     34        // dX,dY are somewhat crudely defined, but only used to select PSF candidates.
     35        // if we already have a PSF, this is not actually used...
    1936    }
    2037
    21     havePsfClump = false;               // we don't know if it's valid
    2238    if (psfClump.X < 0) {
    2339        psError(PSPHOT_ERR_PROG, false, "programming error calling pmSourcePSFClump");
     
    4258    psLogMsg ("psphot.roughclass", PS_LOG_INFO, "rough classification: %f sec\n", psTimerMark ("psphot"));
    4359
    44     havePsfClump = true;                        // we have set psfClump
    45 
    4660    return true;
    4761}
Note: See TracChangeset for help on using the changeset viewer.