IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 4, 2008, 3:10:25 PM (18 years ago)
Author:
eugene
Message:

merge changes from eam_branch_20080229: better flag definitions, cleanup footprint code (move into psphotFindDetections), push mask selection into called functions

File:
1 edited

Legend:

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

    r16048 r16820  
    12411241   return peaks;
    12421242}
     1243
     1244void pmDetectionsFree (pmDetections *detections) {
     1245
     1246  if (!detections) return;
     1247
     1248  psFree (detections->footprints);
     1249  psFree (detections->peaks);
     1250  psFree (detections->oldPeaks);
     1251  return;
     1252}
     1253
     1254// generate a pmDetections container with empty (allocated) footprints and peaks containers
     1255pmDetections *pmDetectionsAlloc() {
     1256
     1257    pmDetections *detections = (pmDetections *)psAlloc(sizeof(pmDetections));
     1258    psMemSetDeallocator(detections, (psFreeFunc) pmDetectionsFree);
     1259
     1260    detections->footprints = NULL;
     1261    detections->peaks      = NULL;
     1262    detections->oldPeaks   = NULL;
     1263    detections->last       = 0;
     1264
     1265    return (detections);
     1266}
     1267
     1268/************************************************************************************************************/
     1269/*
     1270 * Cull a set of peaks contained in a psArray of pmFootprints
     1271 */
     1272psErrorCode
     1273psphotCullPeaks(const psImage *image,   // the image wherein lives the footprint
     1274                const psImage *weight,  // corresponding variance image
     1275                const psMetadata *recipe,
     1276                psArray *footprints) {  // array of pmFootprints
     1277    bool status = false;
     1278    float nsigma_delta = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_DELTA");
     1279    if (!status) {
     1280        nsigma_delta = 0; // min.
     1281    }
     1282    float nsigma_min = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_MIN");
     1283    if (!status) {
     1284        nsigma_min = 0;
     1285    }
     1286    const float skyStdev = psMetadataLookupF32(NULL, recipe, "SKY_STDEV");
     1287
     1288    return pmFootprintArrayCullPeaks(image, weight, footprints,
     1289                                     nsigma_delta, nsigma_min*skyStdev);
     1290}
     1291
Note: See TracChangeset for help on using the changeset viewer.