IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.