IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2010, 11:01:42 AM (16 years ago)
Author:
eugene
Message:

set up a consistent position; perform extended analysis on all sources for an object processed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.20100506/src/psphotExtendedSourceAnalysisByObject.c

    r27939 r27950  
    11# include "psphotInternal.h"
    22
    3 // ?? these cannot happen here --> we would need to do this in psphotExtendedSourceAnalysis
    4 // XXX option to choose a consistent position
    53// XXX option to choose a consistent elliptical contour
    64// XXX SDSS uses the r-band petrosian radius to measure petrosian fluxes in all bands
    7 // XXX consistent choice of extendedness...
    85
    96// aperture-like measurements for extended sources
     
    6461
    6562    // source analysis is done in S/N order (brightest first)
    66     // XXX add this in (need to put S/N in pmPhotObj) : objects = psArraySort (objects, pmPhotObjSortBySN);
     63    objects = psArraySort (objects, pmPhotObjSortBySN);
    6764
    6865    // process the objects in order. 
     
    7269        if (!object->sources) continue;
    7370
     71        // we need to decide for an object if we are going to measure all sources or not
     72        // simple rule : if *any* of the sources would be measured, measure the object
     73
    7474        // choose the sources of interest
    75         for (int j = 0; j < object->sources->n; j++) {
     75        bool measureSource = false;
     76        for (int j = 0; !measureSource && (j < object->sources->n); j++) {
    7677
    7778            pmSource *source = object->sources->data[j];
     
    8889            assert (source->peak); // how can a source not have a peak?
    8990            if (source->peak->SN < SN_LIM) continue;
     91            measureSource = true;
     92        }
     93        if (!measureSource) continue;
     94
     95        // choose the sources of interest
     96        for (int j = 0; j < object->sources->n; j++) {
     97
     98            pmSource *source = object->sources->data[j];
     99            psAssert (source, "programming error"); // all entries in object->sources must exist, right?
     100            psAssert (source->peak, "programming error"); // how can a source not have a peak?
    90101
    91102            // replace object in image
     
    146157    return true;
    147158}
    148 
    149 // sort by X (ascending)
    150 # if (0)
    151 int pmPhotObjSortBySN (const void **a, const void **b)
    152 {
    153     pmPhotObj *objA = *(pmPhotObj **)a;
    154     pmPhotObj *objB = *(pmPhotObj **)b;
    155 
    156     psF32 fA = objA->x;
    157     psF32 fB = objB->x;
    158 
    159     psF32 diff = fA - fB;
    160     if (diff > FLT_EPSILON) return (+1);
    161     if (diff < FLT_EPSILON) return (-1);
    162     return (0);
    163 }
    164 # endif
Note: See TracChangeset for help on using the changeset viewer.