IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15427


Ignore:
Timestamp:
Oct 31, 2007, 3:11:03 PM (19 years ago)
Author:
Paul Price
Message:

Adding additional diagnostics on bad stamps.

File:
1 edited

Legend:

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

    r15422 r15427  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-10-31 21:09:33 $
     6 *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-11-01 01:11:03 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    688688        psImage *polyValues = spatialPolyValues(spatialOrder, stamp->xNorm, stamp->yNorm); // Polynomial terms
    689689
     690#ifdef TESTING
     691        for (int j = 0; j < numKernels; j++) {
     692            psKernel *conv = convolutions->data[j]; // Convolution of interest
     693            psString filename = NULL; // Filename for output
     694            psStringAppend(&filename, "conv_%03d_%03d.fits", i, j);
     695            psFits *fits = psFitsOpen(filename, "w"); // FITS file pointer
     696            psFree(filename);
     697            psFitsWriteImage(fits, NULL, conv->image, 0, NULL);
     698            psFitsClose(fits);
     699        }
     700#endif
     701
    690702        // Generate least-squares vector and matrix
    691         bool bad = false;           // Are there bad values?
    692         for (int j = 0; j < numKernels; j++) {
     703        bool bad = false;               // Are there bad values?
     704        psString badString = NULL;      // Details on bad values
     705        for (int j = 0; j < numKernels && !bad; j++) {
    693706            psKernel *jConv = convolutions->data[j]; // Convolution for j-th element
    694707
    695708            // Generate matrix
    696             for (int k = j; k < numKernels; k++) {
     709            for (int k = j; k < numKernels && !bad; k++) {
    697710                psKernel *kConv = convolutions->data[k]; // Convolution for k-th element
    698711                double sumCC = 0.0; // Sum of the convolution products
     
    703716                }
    704717                if (!isfinite(sumCC)) {
     718                    psStringAppend(&badString, "\nBad sumCC at %d, %d", j, k);
    705719                    bad = true;
     720                    continue;
    706721                }
    707722                // Generate the pseudo-convolutions from the spatial polynomial terms
     
    732747                }
    733748            }
    734             if (!isfinite(sumC) || !isfinite(sumIC)) {
     749            if (!isfinite(sumC)) {
     750                psStringAppend(&badString, "\nBad sumC at %d", j);
    735751                bad = true;
    736             }
     752                continue;
     753            }
     754            if (!isfinite(sumIC)) {
     755                psStringAppend(&badString, "\nBad sumIC detected at %d", j);
     756                bad = true;
     757                continue;
     758            }
     759
    737760            for (int jyOrder = 0, jIndex = j; jyOrder <= spatialOrder; jyOrder++) {
    738761                for (int jxOrder = 0; jxOrder <= spatialOrder - jyOrder;
     
    759782            }
    760783        }
    761         if (!isfinite(sum1) || !isfinite(sumI)) {
     784        if (!isfinite(sum1)) {
     785            psStringAppend(&badString, "\nBad sum1 detected");
    762786            bad = true;
    763         }
     787        } else if (!isfinite(sumI)) {
     788            psStringAppend(&badString, "\nBad sumI detected");
     789            bad = true;
     790        }
     791
    764792        stampMatrix->data.F64[bgIndex][bgIndex] = sum1;
    765793        stampVector->data.F64[bgIndex] = sumI;
     
    767795        if (bad) {
    768796            stamp->status = PM_SUBTRACTION_STAMP_REJECTED;
    769             psTrace("psModules.imcombine", 3, "Rejecting stamp %d (%d,%d) because of bad equation\n",
    770                     i, (int)(stamp->x + 0.5), (int)(stamp->y + 0.5));
     797            psWarning("Rejecting stamp %d (%d,%d) because of bad equation:%s",
     798                      i, (int)(stamp->x + 0.5), (int)(stamp->y + 0.5), badString);
     799            psFree(badString);
    771800        } else {
    772801            stamp->status = PM_SUBTRACTION_STAMP_USED;
     
    854883    if (psTraceGetLevel("psModules.imcombine") >= 7) {
    855884        for (int i = 0; i < solution->n; i++) {
    856             printf("       Solution %d: %f\n", i, solution->data.F64[i]);
     885            psTrace("psModules.imcombine", 7, "Solution %d: %f\n", i, solution->data.F64[i]);
    857886        }
    858887    }
Note: See TracChangeset for help on using the changeset viewer.