IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20000


Ignore:
Timestamp:
Oct 8, 2008, 11:53:29 AM (18 years ago)
Author:
eugene
Message:

search for valid psf on image

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmPSF.c

    r18554 r20000  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-07-15 20:25:00 $
     8 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-10-08 21:53:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    271271    pol.e2 = fittedPar[PM_PAR_E2];
    272272
    273     psEllipseAxes axes;
    274     if (psEllipsePolToAxes (pol, minMinorAxis, &axes) != PS_ERR_NONE) {
    275         psError(PM_ERR_PSF, false, "Failed to convert e[012] (%g,%g,%g) to axes",
    276                 pol.e0, pol.e1, pol.e2);
     273    psEllipseAxes axes = psEllipsePolToAxes (pol, minMinorAxis);
     274    if (!isfinite(axes.major) || !isfinite(axes.minor) || !isfinite(axes.theta)) {
     275        psTrace("psModules.objects", 5, "Failed to convert e[012] (%g,%g,%g) to axes", pol.e0, pol.e1, pol.e2);
    277276        return false;
    278277    }
     
    420419    maskVal |= markVal;
    421420
    422     // use the center of the center pixel of the image
    423     xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5;
    424     yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5;
    425     dx = psf->growth->maxRadius + 1;
    426     dy = psf->growth->maxRadius + 1;
    427 
    428     // assign the x and y coords to the image center
    429     // create an object with center intensity of 1000
    430     modelRef->params->data.F32[PM_PAR_SKY] = 0;
    431     modelRef->params->data.F32[PM_PAR_I0] = 1000;
    432     modelRef->params->data.F32[PM_PAR_XPOS] = xc;
    433     modelRef->params->data.F32[PM_PAR_YPOS] = yc;
    434 
    435     // create modelPSF from this model
    436     pmModel *model = pmModelFromPSF (modelRef, psf);
    437 
     421    // XXXX A Serious hack: the psf might not be determined in the field center.
     422    // for the moment, just try a few locations until it is defined!
     423
     424    pmModel *model = NULL;
     425    for (int ix = -1; ix <= +1; ix ++) {
     426        for (int iy = -1; iy <= +1; iy ++) {
     427
     428            // use the center of the center pixel of the image
     429            xc = (0.5 + 0.3*ix)*readout->image->numCols + readout->image->col0 + 0.5;
     430            yc = (0.5 + 0.3*ix)*readout->image->numRows + readout->image->row0 + 0.5;
     431            dx = psf->growth->maxRadius + 1;
     432            dy = psf->growth->maxRadius + 1;
     433
     434            // assign the x and y coords to the image center
     435            // create an object with center intensity of 1000
     436            modelRef->params->data.F32[PM_PAR_SKY] = 0;
     437            modelRef->params->data.F32[PM_PAR_I0] = 1000;
     438            modelRef->params->data.F32[PM_PAR_XPOS] = xc;
     439            modelRef->params->data.F32[PM_PAR_YPOS] = yc;
     440
     441            // create modelPSF from this model
     442            model = pmModelFromPSF (modelRef, psf);
     443            if (model) goto got_model;
     444        }
     445    }
     446    psAssert (model, "cannot build growth curve (psf model is invalid everywhere)");
     447
     448got_model:
    438449    // measure the fitMag for this model
    439450    pmSourcePhotometryModel (&fitMag, model);
Note: See TracChangeset for help on using the changeset viewer.