IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33761 for trunk/psphot/src


Ignore:
Timestamp:
Apr 11, 2012, 11:56:11 AM (14 years ago)
Author:
bills
Message:

Add psphot recipe value PEAKS_NMAX_TOTAL. If non zero and the number of peaks found
in is larger than the value return with failure status from psphotFindDetections
Set value to 50000 for recipe STACKPHOT and default to 0. This allows us to
abort psphotStack in cases where the memory usage is going to become to large.
This allows us to continue processing efficiently while we solve the underlying
problems.

Location:
trunk/psphot/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphot.h

    r33690 r33761  
    189189// used by psphotFindDetections
    190190pmReadout      *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal);
    191 psArray        *psphotFindPeaks (pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax);
     191psArray        *psphotFindPeaks (pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax, int *totalPeaks);
    192192bool            psphotFindFootprints (pmDetections *detections, pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal);
    193193psErrorCode     psphotCullPeaks(const pmReadout *readout, const pmReadout *signifRO, const psMetadata *recipe, psArray *footprints);
  • trunk/psphot/src/psphotFindDetections.c

    r32348 r33761  
    9696
    9797    // detect the peaks in the significance image
    98     detections->peaks = psphotFindPeaks (significance, readout, recipe, threshold, NMAX);
     98    int totalPeaks = 0;
     99    detections->peaks = psphotFindPeaks (significance, readout, recipe, threshold, NMAX, &totalPeaks);
    99100    psMetadataAddF32  (readout->analysis, PS_LIST_TAIL, "PEAK_THRESHOLD", PS_META_REPLACE, "Peak Detection Threshold", threshold);
    100101    if (!detections->peaks) {
     
    103104        psFree (detections);
    104105        psError (PSPHOT_ERR_CONFIG, false, "failed on peak search");
     106        return false;
     107    }
     108    // hard limit on number of peaks we will accept. (To avoid memory overload in psphotStack)
     109    int maxPeaks = psMetadataLookupS32 (&status, recipe, "PEAKS_NMAX_TOTAL"); PS_ASSERT (status, NULL);
     110    if (maxPeaks && (totalPeaks > maxPeaks)) {
     111        psFree (detections);
     112        psError (PSPHOT_ERR_DATA, true, "Too many peaks %d found PEAKS_NMAX_TOTAL: %d", totalPeaks, maxPeaks);
    105113        return false;
    106114    }
  • trunk/psphot/src/psphotFindPeaks.c

    r32348 r33761  
    44// image must be constructed to represent (S/N)^2.  If nMax is non-zero, only return a maximum
    55// of nMax peaks
    6 psArray *psphotFindPeaks (pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax) {
     6psArray *psphotFindPeaks (pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax, int *totalPeaks) {
    77
    88    bool status = false;
     
    1818        psError(PSPHOT_ERR_DATA, false, "no peaks found in this image");
    1919        return NULL;
     20    }
     21    // return the total number of peaks found before the nMax limit is applied
     22    if (totalPeaks) {
     23        *totalPeaks = peaks->n;
    2024    }
    2125
Note: See TracChangeset for help on using the changeset viewer.