IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34354


Ignore:
Timestamp:
Aug 24, 2012, 4:37:05 PM (14 years ago)
Author:
bills
Message:

In psphotStack check aperture flux of matched sources and drop any for which it is
not finite. This occurs when the source is completely masked. Dropping them saves
disk and PSPS space.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/recipes/psphot.config

    r34343 r34354  
    389389END
    390390
     391# if true keep all matched sources, even if we get a non-finite aperture flux measurement
     392PSPHOT.STACK.KEEP.BAD.MATCHES  BOOL     F
     393
    391394RADIAL_APERTURES                    BOOL  F    # calculate flux in circular radial apertures?
    392395RADIAL_APERTURES_SN_LIM             F32   0.0  # S/N limit for radial aperture calculation
  • trunk/psphot/src/psphot.h

    r34317 r34354  
    368368bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    369369bool psphotMatchSourcesToObjects (psArray *objects, psArray *sources, float RADIUS);
     370bool psphotDropBadMatchedSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects);
    370371
    371372bool psphotFitSourcesLinearStack (pmConfig *config, psArray *objects, bool final);
  • trunk/psphot/src/psphotSourceMatch.c

    r34338 r34354  
    558558    return matchInfo;
    559559}
     560
     561bool psphotDropBadMatchedSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects) {
     562
     563    bool status = false;
     564
     565    psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Drop Bad Matched Sources ---");
     566
     567    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     568
     569    // select the appropriate recipe information
     570    bool keepBadMatches = psMetadataLookupBool (&status, recipe, "PSPHOT.STACK.KEEP.BAD.MATCHES");
     571    if (!status) {
     572        keepBadMatches = true;
     573    }
     574
     575    if (keepBadMatches) {
     576        psLogMsg ("psphot", PS_LOG_INFO, "keeping bad matches");
     577        return true;
     578    }
     579
     580    int numImages = psphotFileruleCount(config, filerule);
     581    psVector *dropped = psVectorAlloc(numImages, PS_TYPE_U32);
     582    psVectorInit(dropped, 0);
     583
     584    int nDropped = 0;
     585    for (int i = 0; i < objects->n; i++) {
     586        pmPhotObj *obj = objects->data[i];
     587
     588        // traverse the array from the end so that sources don't move until after we've processed them
     589        for (int j = obj->sources->n - 1; j >= 0; j--) {
     590
     591            pmSource *source = obj->sources->data[j];
     592            // This applies only to matched sources
     593            if (!(source->mode2 & PM_SOURCE_MODE2_MATCHED)) continue;
     594
     595            if (isfinite(source->apFlux)) continue;
     596
     597            psTrace ("psphot", 7, "Dropping matched source from image %d at (%d, %d) no valid flux",
     598                source->imageID, source->peak->x, source->peak->y);
     599
     600            psAssert(source->imageID >= 0 && source->imageID < numImages, "bad imageID %d", source->imageID);
     601
     602            dropped->data.U32[source->imageID]++;
     603           
     604            nDropped++;
     605
     606            psArrayRemoveIndex(obj->sources, j);
     607        }
     608    }
     609
     610    psLogMsg ("psphot", PS_LOG_DETAIL, "Dropped %d matched sources with no valid flux", nDropped);
     611    psLogMsg ("psphot", PS_LOG_DETAIL, "       Input  Num Dropped");
     612    for (int i=0; i<numImages; i++) {
     613        psLogMsg ("psphot", PS_LOG_DETAIL, "    %8d     %8d", i, dropped->data.U32[i]);
     614    }
     615    psFree(dropped);
     616
     617    return true;
     618}
     619
     620
  • trunk/psphot/src/psphotStackReadout.c

    r34336 r34354  
    355355
    356356    psMemDump("psfstats");
     357
     358    // drop matched sources without any useful measurements
     359    psphotDropBadMatchedSources (config, view, STACK_SRC, objects);
    357360
    358361    // measure elliptical apertures, petrosians (objects sorted by S/N)
Note: See TracChangeset for help on using the changeset viewer.