IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 24, 2007, 3:27:44 PM (19 years ago)
Author:
rhl
Message:

Added pmFootprint support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotFindPeaks.c

    r12817 r13012  
    22
    33// In this function, we smooth the image, then search for the peaks
    4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe, int pass) {
     4psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe,
     5                          bool returnFootprints,
     6                          const int pass) {
    57
    68    float SIGMA_SMTH, NSIGMA_SMTH, NSIGMA_PEAK;
     
    110112    }
    111113
    112     psFree (smooth_im);
    113     psFree (smooth_wt);
    114 
    115114    // optional dump of all peak data
    116115    char *output = psMetadataLookupStr (&status, recipe, "PEAKS_OUTPUT_FILE");
     
    119118    }
    120119    psLogMsg ("psphot", PS_LOG_INFO, "%ld peaks: %f sec\n", peaks->n, psTimerMark ("psphot"));
     120    //
     121    // If they asked us to return a set of pmFootprints, not a raw pmPeak list,
     122    // go ahead and find the footprints, and assign them their peaks.
     123    //
     124    // N.b. We're not culling this list; call pmFootprintCullPeaks if you
     125    // want to do that
     126    //
     127    if (returnFootprints) {     // We want an array of pmFootprint, not pmPeak
     128        int npixMin = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NPIXMIN");
     129        if (!status) {
     130            npixMin = 1;
     131        }
     132        float FOOTPRINT_NSIGMA_LIMIT =
     133            psMetadataLookupS32(&status, recipe,
     134                                (pass == 1) ? "FOOTPRINT_NSIGMA_LIMIT" : "FOOTPRINT_NSIGMA_LIMIT_2");
     135        if (!status) {
     136            FOOTPRINT_NSIGMA_LIMIT = NSIGMA_PEAK;
     137        }
     138        threshold = PS_SQR(FOOTPRINT_NSIGMA_LIMIT)/effArea;
     139
     140        psArray *footprints = pmFindFootprints(smooth_im, threshold, npixMin);
     141        pmPeaksAssignToFootprints(footprints, peaks);
     142
     143        psFree(peaks);
     144        peaks = footprints;             // well, you know what I mean
     145    }
     146
     147    psFree (smooth_im);
     148    psFree (smooth_wt);
    121149
    122150    return (peaks);
    123151}
     152
     153
     154/************************************************************************************************************/
     155/*
     156 * Cull a set of peaks contained in a psArray of pmFootprints
     157 */
     158psErrorCode
     159psphotCullPeaks(const pmReadout *readout,
     160                const psMetadata *recipe,
     161                psArray *footprints) { // array of pmFootprints
     162    bool status = false;
     163    float nsigma_delta = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_DELTA");
     164    if (!status) {
     165        nsigma_delta = 0; // min.
     166    }
     167    float nsigma_min = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_MIN");
     168    if (!status) {
     169        nsigma_min = 0;
     170    }
     171    const float skyStdev = psMetadataLookupF32(NULL, recipe, "SKY_STDEV");
     172
     173    return pmFootprintArrayCullPeaks(readout->image, readout->weight, footprints,
     174                                     nsigma_delta, nsigma_min*skyStdev);
     175}
Note: See TracChangeset for help on using the changeset viewer.