IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 26, 2007, 5:35:29 PM (19 years ago)
Author:
eugene
Message:

adding PS1_DEV_1 as pmSource I/O format; various cleanups of I/O operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSource.c

    r14950 r15039  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-21 00:21:57 $
     8 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-09-27 03:35:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8787    pmSource *source = (pmSource *) psAlloc(sizeof(pmSource));
    8888    *(int *)&source->id = id++;
     89    source->seq = -1;
    8990    source->peak = NULL;
    9091    source->pixels = NULL;
     
    111112    source->skyErr = NAN;
    112113    source->pixWeight = NAN;
     114
     115    source->psfProb = NAN;
     116    source->crNsigma = NAN;
     117    source->extNsigma = NAN;
    113118
    114119    psTrace("psModules.objects", 5, "---- end ----\n");
     
    930935    return NULL;
    931936}
     937
     938// sort by SN (descending)
     939int pmSourceSortBySN (const void **a, const void **b)
     940{
     941    pmSource *A = *(pmSource **)a;
     942    pmSource *B = *(pmSource **)b;
     943
     944    psF32 fA = (A->peak == NULL) ? 0 : A->peak->SN;
     945    psF32 fB = (B->peak == NULL) ? 0 : B->peak->SN;
     946    if (isnan (fA)) fA = 0;
     947    if (isnan (fB)) fB = 0;
     948
     949    psF32 diff = fA - fB;
     950    if (diff > FLT_EPSILON) return (-1);
     951    if (diff < FLT_EPSILON) return (+1);
     952    return (0);
     953}
     954
     955// sort by Y (ascending)
     956int pmSourceSortByY (const void **a, const void **b)
     957{
     958    pmSource *A = *(pmSource **)a;
     959    pmSource *B = *(pmSource **)b;
     960
     961    psF32 fA = (A->peak == NULL) ? 0 : A->peak->y;
     962    psF32 fB = (B->peak == NULL) ? 0 : B->peak->y;
     963
     964    psF32 diff = fA - fB;
     965    if (diff > FLT_EPSILON) return (+1);
     966    if (diff < FLT_EPSILON) return (-1);
     967    return (0);
     968}
     969
Note: See TracChangeset for help on using the changeset viewer.