IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15083


Ignore:
Timestamp:
Sep 28, 2007, 11:05:24 AM (19 years ago)
Author:
eugene
Message:

skip saturated stars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroConvert.c

    r12806 r15083  
    4343
    4444    // sort in ascending magnitude order
    45     psArraySort (inStars, psastroSortByMag);
     45    // psArraySort (inStars, psastroSortByMag);
     46    // psVector *index = psArraySortIndex (sources, pmSourceSortBySN);
     47    psVector *index = psArraySortIndex (NULL, inStars, psastroSortByMag);
     48    for (int i = 0; i < 10; i++) {
     49        int n = index->data.S32[i];
     50        pmAstromObj *obj = inStars->data[n];
     51        fprintf (stderr, "%d %d %f\n", i, n, obj->Mag);
     52    }
    4653
    4754    // we are going to select the brighter Nmax subset for astrometry
     
    5158    // choose the first nMax sources
    5259    psArray *rawStars = psArrayAlloc (PS_MIN (nMax, inStars->n));
    53     for (int i = 0; i < rawStars->n; i++) {
    54         rawStars->data[i] = psMemIncrRefCounter (inStars->data[i]);
     60    for (int i = 0, j = 0; (i < inStars->n) && (j < rawStars->n); i++) {
     61        int n = index->data.S32[i];
     62        pmSource *source = sources->data[n];
     63        if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
     64        rawStars->data[j] = psMemIncrRefCounter (inStars->data[n]);
     65        j++;
    5566    }
    5667
     
    5869    psLogMsg ("psastro", 4, "loaded %ld sources, using %ld of %ld good sources\n", sources->n, rawStars->n, inStars->n);
    5970
     71    psFree (index);
    6072    psFree (inStars);
    6173    psFree (rawStars);
     
    100112
    101113// sort by Mag (ascending)
    102 int psastroSortByMag (const void **a, const void **b)
     114int psastroSortByMag (const void *a, const void *b)
    103115{
    104     pmAstromObj *A = *(pmAstromObj **) a;
    105     pmAstromObj *B = *(pmAstromObj **) b;
     116    const pmAstromObj *A = a;
     117    const pmAstromObj *B = b;
    106118
    107119    psF32 mA = (isfinite(A->Mag)) ? A->Mag : FLT_MAX;
Note: See TracChangeset for help on using the changeset viewer.