IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37775


Ignore:
Timestamp:
Dec 30, 2014, 1:35:45 PM (12 years ago)
Author:
eugene
Message:

only use footprint pixels in the object of interest; clean test code a bit

Location:
tags/ipp-20141224/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20141224/psphot/src/psphotExtendedSourceAnalysis.c

    r36375 r37775  
    3838
    3939/*** for the moment, this test code : it is not thread safe ***/
    40 int    Nall = 0;
    41 int  Nskip1 = 0;
    42 int  Nskip2 = 0;
    43 int  Nskip3 = 0;
    44 int  Nskip4 = 0;
    45 int  Nskip5 = 0;
    46 int  Nskip6 = 0;
     40static int    Nall = 0;
     41static int  Nskip1 = 0;
     42static int  Nskip2 = 0;
     43static int  Nskip3 = 0;
     44static int  Nskip4 = 0;
     45static int  Nskip5 = 0;
     46static int  Nskip6 = 0;
    4747
    4848# define SKIP(VALUE) { VALUE++; continue; }
  • tags/ipp-20141224/psphot/src/psphotGalaxyParams.c

    r37773 r37775  
    11# include "psphotInternal.h"
    22
    3 #define USE_FOOTPRINTS 1
     3# define PRINT_STUFF 0
     4# define USE_FOOTPRINTS 1
    45
    56// measure some properties on the exended objects
     
    4041}
    4142
    42 #ifdef notdef
     43// # define COUNT_SKIPS
     44# ifdef COUNT_SKIPS
    4345/*** for the moment, this test code : it is not thread safe ***/
    44 int  Nall = 0;
    45 int  Nskip1 = 0;
    46 int  Nskip2 = 0;
    47 int  Nskip3 = 0;
    48 int  Nskip4 = 0;
    49 int  Nskip5 = 0;
    50 int  Nskip6 = 0;
    51 
     46static int  Nskip1 = 0;
     47static int  Nskip2 = 0;
     48static int  Nskip3 = 0;
     49static int  Nskip4 = 0;
     50static int  Nskip5 = 0;
     51static int  Nskip6 = 0;
     52static int  Nskip7 = 0;
     53static int  Nskip8 = 0;
    5254# define SKIP(VALUE) { VALUE++; continue; }
    53 
    54 #endif //notdef
    55 
    56 #define SKIP(VALUE) {continue;}
     55# else
     56# define SKIP(VALUE) {continue;}
     57# endif //notdef
    5758
    5859// aperture-like measurements for extended sources
     
    107108    footprintImage = psImageAlloc(readout->image->numCols, readout->image->numRows, PS_TYPE_S32);
    108109    psImageInit(footprintImage, 0);
    109     pmSetFootprintArrayIDsForImage(footprintImage, detections->footprints, true);
     110    pmSetFootprintArrayIDsForImage(footprintImage, detections->footprints, false);
    110111#endif
    111112
     
    207208
    208209// # if (PS_TRACE_ON)
    209 # if (0)
     210# ifdef COUNT_SKIPS
    210211    fprintf (stderr, "ext analysis skipped @ 1  : %d\n", Nskip1);
    211212    fprintf (stderr, "ext analysis skipped @ 2  : %d\n", Nskip2);
     
    214215    fprintf (stderr, "ext analysis skipped @ 5  : %d\n", Nskip5);
    215216    fprintf (stderr, "ext analysis skipped @ 6  : %d\n", Nskip6);
     217    fprintf (stderr, "ext analysis skipped @ 7  : %d\n", Nskip7);
     218    fprintf (stderr, "ext analysis skipped @ 8  : %d\n", Nskip8);
    216219#endif
    217220
     
    221224
    222225    // psphotVisualShowPetrosians (sources);
     226
     227    // XXX TEST: SAVE IMAGE:
     228    // psphotSaveImage (NULL, readout->image, "resid.fits");
    223229
    224230    return true;
     
    291297
    292298        // Nall ++;
     299
     300        bool testObject = FALSE;
     301        // testObject = testObject || ((fabs(source->peak->xf - 5788) < 10) && (fabs(source->peak->yf - 5711) < 10));
     302        // testObject = testObject || ((fabs(source->peak->xf -   96) < 10) && (fabs(source->peak->yf - 5550) < 10));
     303        // testObject = testObject || ((fabs(source->peak->xf -  300) < 10) && (fabs(source->peak->yf - 5988) < 10));
     304        if (testObject) {
     305          fprintf (stderr, "test object: %f, %f\n", source->peak->xf, source->peak->yf);
     306          testObject = TRUE;
     307        }
    293308
    294309        // rules for measuring petrosian parameters for specific objects are set in
     
    437452
    438453#ifdef USE_FOOTPRINTS
    439                 if (vFootprint[yImage][xImage]) {
    440 #else
    441                 if (fabs(pixel) >= threshold) {
    442 #endif
     454                // this is a pixel in the object
     455                if (vFootprint[yImage][xImage] == source->peak->footprint->id) {
    443456                    SET_MARK(MARK_SOURCE);
    444457                    continue;
     458                }
     459                // this is a pixel in another object
     460                if (vFootprint[yImage][xImage] > 0.0) continue;
     461#else
     462                // this is a pixel in an object (this or the other)
     463                if (fabs(pixel) >= threshold) {
     464                  continue
    445465                }
     466#endif
    446467                // we have a background pixel.
    447468                // Check whether it's mirror is a background pixel as well.
     
    583604#ifdef PRINT_STUFF
    584605        if (Ngood % 40 == 1) {
    585             printf("   id  sumI rHL rad   sumI     gRT   gRA       sumRt      sumBt         numPixels numBGPixels\n");
    586         }
    587         printf("%5d %5.2e %3.1f %10.1f %6.3f %6.3f %5.2e %5.2e %10d %6ld\n",
    588             source->id, sumI, source->extpars->ghalfLightRadius, radius, source->extpars->gRT, source->extpars->gRA, sumRt, sumBt, numPixels, bgPixels->n);
     606          fprintf (stderr, "   id  sumI rHL rad   sumI     gRT   gRA       sumRt      sumBt         numPixels numBGPixels\n");
     607        }
     608        fprintf (stderr, "%5d %5.1f %5.1f : %5.2e %4.1f %10.1f %6.3f %6.3f %5.2e %5.2e %10d %6ld\n",
     609                 source->id, source->peak->xf, source->peak->yf,
     610                 sumI, source->extpars->ghalfLightRadius,
     611                 radius,
     612                 source->extpars->gRT,
     613                 source->extpars->gRA, sumRt, sumBt, numPixels, bgPixels->n);
    589614#endif
    590615
     
    592617restoreModel:
    593618
    594         if ((extModel != sersicModel) || !isExtended) {
     619        if (testObject) {
     620          fprintf (stderr, "done with %d\n", source->id);
     621        }
     622
     623        // XXX TEST: Keep the sersic model regardless
     624        if (FALSE && ((extModel != sersicModel) || !isExtended)) {
    595625            // add the sersic model back in
    596626            if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) {
Note: See TracChangeset for help on using the changeset viewer.