IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2011, 1:04:41 PM (15 years ago)
Author:
eugene
Message:

updates to pmPeak to better distinguish peak flux versions; updates to visualization; add bits for substantial suspect masking; consolidate assignment of source position and flux based on peak, moments, etc; improve footprint culling process; fix PSF_QF and PSF_QF_PERFECT calculations; fix source model chisq values

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

    • Property svn:ignore
      •  

        old new  
        2828ChangeLog
        2929psmodules-*.tar.*
         30a.out.dSYM
  • trunk/psModules/src/objects/pmPeaks.c

    r29004 r31153  
    115115XXX: Macro this.
    116116*****************************************************************************/
     117# if (0)
    117118static bool isItInThisRegion(const psRegion valid,
    118119                             psS32 x,
     
    130131    return(false);
    131132}
     133# endif
    132134
    133135/******************************************************************************
     
    148150    tmp->x = x;
    149151    tmp->y = y;
    150     tmp->value = value;
    151     tmp->flux = value;
    152     tmp->SN = 0;
     152    tmp->detValue        = value;
     153    tmp->rawFlux         = value; // set this by default: it is up to the user to supply a better value
     154    tmp->rawFluxStdev    = NAN;
     155    tmp->smoothFlux      = value; // set this by default: it is up to the user to supply a better value
     156    tmp->smoothFluxStdev = NAN;
     157    // tmp->SN = 0;
    153158    tmp->xf = x;
    154159    tmp->yf = y;
     
    170175
    171176
    172 // psSort comparison function for peaks
     177// psSort comparison functions for peaks
    173178// XXX: Add error-checking for NULL args
    174 int pmPeaksCompareAscend (const void **a, const void **b)
    175 {
    176     psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
     179int pmPeaksSortByDetValueAscend (const void **a, const void **b)
     180{
    177181    pmPeak *A = *(pmPeak **)a;
    178182    pmPeak *B = *(pmPeak **)b;
     
    180184    psF32 diff;
    181185
    182     diff = A->value - B->value;
     186    diff = A->detValue - B->detValue;
    183187    if (diff < FLT_EPSILON) {
    184         psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__);
    185188        return (-1);
    186189    } else if (diff > FLT_EPSILON) {
    187         psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__);
    188190        return (+1);
    189191    }
    190     psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__);
    191192    return (0);
    192193}
    193 
    194 // psSort comparison function for peaks
    195 // XXX: Add error-checking for NULL args
    196 int pmPeaksCompareDescend (const void **a, const void **b)
    197 {
    198     psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
     194int pmPeaksSortByDetValueDescend (const void **a, const void **b)
     195{
    199196    pmPeak *A = *(pmPeak **)a;
    200197    pmPeak *B = *(pmPeak **)b;
     
    202199    psF32 diff;
    203200
    204     diff = A->value - B->value;
     201    diff = A->detValue - B->detValue;
    205202    if (diff < FLT_EPSILON) {
    206         psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__);
    207203        return (+1);
    208204    } else if (diff > FLT_EPSILON) {
    209         psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__);
    210205        return (-1);
    211206    }
    212     psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__);
    213207    return (0);
    214208}
    215 
    216 // sort by SN (descending)
    217 int pmPeakSortBySN (const void **a, const void **b)
     209int pmPeaksSortByRawFluxAscend (const void **a, const void **b)
    218210{
    219211    pmPeak *A = *(pmPeak **)a;
    220212    pmPeak *B = *(pmPeak **)b;
    221213
    222     psF32 fA = A->SN;
    223     psF32 fB = B->SN;
    224     if (isnan (fA)) fA = 0;
    225     if (isnan (fB)) fB = 0;
    226 
    227     psF32 diff = fA - fB;
    228     if (diff > FLT_EPSILON) return (-1);
    229     if (diff < FLT_EPSILON) return (+1);
     214    psF32 diff;
     215
     216    diff = A->rawFlux - B->rawFlux;
     217    if (diff < FLT_EPSILON) {
     218        return (-1);
     219    } else if (diff > FLT_EPSILON) {
     220        return (+1);
     221    }
    230222    return (0);
    231223}
    232 
    233 // sort by Y (ascending)
    234 int pmPeakSortByY (const void **a, const void **b)
     224int pmPeaksSortByRawFluxDescend (const void **a, const void **b)
    235225{
    236226    pmPeak *A = *(pmPeak **)a;
    237227    pmPeak *B = *(pmPeak **)b;
    238228
    239     psF32 fA = A->y;
    240     psF32 fB = B->y;
    241 
    242     psF32 diff = fA - fB;
    243     if (diff > FLT_EPSILON) return (+1);
    244     if (diff < FLT_EPSILON) return (-1);
     229    psF32 diff;
     230
     231    diff = A->rawFlux - B->rawFlux;
     232    if (diff < FLT_EPSILON) {
     233        return (+1);
     234    } else if (diff > FLT_EPSILON) {
     235        return (-1);
     236    }
    245237    return (0);
    246238}
     239int pmPeaksSortBySmoothFluxAscend (const void **a, const void **b)
     240{
     241    pmPeak *A = *(pmPeak **)a;
     242    pmPeak *B = *(pmPeak **)b;
     243
     244    psF32 diff;
     245
     246    diff = A->smoothFlux - B->smoothFlux;
     247    if (diff < FLT_EPSILON) {
     248        return (-1);
     249    } else if (diff > FLT_EPSILON) {
     250        return (+1);
     251    }
     252    return (0);
     253}
     254int pmPeaksSortBySmoothFluxDescend (const void **a, const void **b)
     255{
     256    pmPeak *A = *(pmPeak **)a;
     257    pmPeak *B = *(pmPeak **)b;
     258
     259    psF32 diff;
     260
     261    diff = A->smoothFlux - B->smoothFlux;
     262    if (diff < FLT_EPSILON) {
     263        return (+1);
     264    } else if (diff > FLT_EPSILON) {
     265        return (-1);
     266    }
     267    return (0);
     268}
     269
     270// // sort by SN (descending)
     271// int pmPeakSortBySN (const void **a, const void **b)
     272// {
     273//     pmPeak *A = *(pmPeak **)a;
     274//     pmPeak *B = *(pmPeak **)b;
     275//
     276//     psF32 fA = A->flux;
     277//     psF32 fB = B->flux;
     278//     if (isnan (fA)) fA = 0;
     279//     if (isnan (fB)) fB = 0;
     280//
     281//     psF32 diff = fA - fB;
     282//     if (diff > FLT_EPSILON) return (-1);
     283//     if (diff < FLT_EPSILON) return (+1);
     284//     return (0);
     285// }
     286//
     287// // sort by Y (ascending)
     288// int pmPeakSortByY (const void **a, const void **b)
     289// {
     290//     pmPeak *A = *(pmPeak **)a;
     291//     pmPeak *B = *(pmPeak **)b;
     292//
     293//     psF32 fA = A->y;
     294//     psF32 fB = B->y;
     295//
     296//     psF32 diff = fA - fB;
     297//     if (diff > FLT_EPSILON) return (+1);
     298//     if (diff < FLT_EPSILON) return (-1);
     299//     return (0);
     300// }
    247301
    248302/******************************************************************************
     
    554608    return(list);
    555609}
    556 
    557 // return a new array of peaks which are in the valid region and below threshold
    558 // XXX this function is unused and probably could be dropped
    559 psArray *pmPeaksSubset(
    560     psArray *peaks,
    561     psF32 maxValue,
    562     const psRegion valid)
    563 {
    564     psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    565     PS_ASSERT_PTR_NON_NULL(peaks, NULL);
    566 
    567     psArray *output = psArrayAllocEmpty (200);
    568 
    569     psTrace ("psModules.objects", 3, "list size is %ld\n", peaks->n);
    570 
    571     for (int i = 0; i < peaks->n; i++) {
    572         pmPeak *tmpPeak = (pmPeak *) peaks->data[i];
    573         if (tmpPeak->value > maxValue)
    574             continue;
    575         if (isItInThisRegion(valid, tmpPeak->x, tmpPeak->y))
    576             continue;
    577         psArrayAdd (output, 200, tmpPeak);
    578     }
    579     psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    580     return(output);
    581 }
Note: See TracChangeset for help on using the changeset viewer.