IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23961


Ignore:
Timestamp:
Apr 23, 2009, 6:12:44 PM (17 years ago)
Author:
Paul Price
Message:

We do need the source radii, otherwise the moments all fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmPSFEnvelope.c

    r23960 r23961  
    114114    psImageInit(envelope, SKY_VALUE);
    115115    pmReadout *fakeRO = pmReadoutAlloc(NULL); // Fake readout
     116    float maxRadius = 0.0;              // Maximum radius for sources
    116117    psVector *numbers = psVectorAlloc(numFakes, PS_TYPE_S32); // Number of detections for each source
    117118    psVectorInit(numbers, 0);
     
    156157            psFree(subEnv);
    157158
     159            // Get the radius
     160            pmModel *model = pmModelFromPSFforXY(psf, x, y, PEAK_FLUX); // Model for source
     161            if (!model || (model->flags & MODEL_MASK)) {
     162                continue;
     163            }
     164            float srcRadius = model->modelRadius(model->params, PS_SQR(VARIANCE_VAL)); // Radius for source
     165            if (srcRadius == 0) {
     166                continue;
     167            }
     168            if (srcRadius > maxRadius) {
     169                maxRadius = srcRadius;
     170            }
     171
    158172            // If we got this far, the source is decent
    159173            numbers->data.S32[j]++;
     
    229243    numFakes = fakes->n;
    230244
     245    if (numFakes == 0.0) {
     246        psError(PS_ERR_UNKNOWN, false, "No fake sources are suitable for PSF fitting.");
     247        psFree(fakes);
     248        psFree(readout);
     249        return false;
     250    }
     251
    231252    // XXX Setting the variance seems to be an art
    232253    // Can't set it too high so that pixels are rejected as insignificant
     
    239260    readout->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK);
    240261    psImageInit(readout->mask, 0);
     262
     263    if (maxRadius > radius) {
     264        maxRadius = radius;
     265    }
    241266
    242267#ifdef TESTING
Note: See TracChangeset for help on using the changeset viewer.