Changeset 15083
- Timestamp:
- Sep 28, 2007, 11:05:24 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroConvert.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroConvert.c
r12806 r15083 43 43 44 44 // 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 } 46 53 47 54 // we are going to select the brighter Nmax subset for astrometry … … 51 58 // choose the first nMax sources 52 59 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++; 55 66 } 56 67 … … 58 69 psLogMsg ("psastro", 4, "loaded %ld sources, using %ld of %ld good sources\n", sources->n, rawStars->n, inStars->n); 59 70 71 psFree (index); 60 72 psFree (inStars); 61 73 psFree (rawStars); … … 100 112 101 113 // sort by Mag (ascending) 102 int psastroSortByMag (const void * *a, const void **b)114 int psastroSortByMag (const void *a, const void *b) 103 115 { 104 pmAstromObj *A = *(pmAstromObj **)a;105 pmAstromObj *B = *(pmAstromObj **)b;116 const pmAstromObj *A = a; 117 const pmAstromObj *B = b; 106 118 107 119 psF32 mA = (isfinite(A->Mag)) ? A->Mag : FLT_MAX;
Note:
See TracChangeset
for help on using the changeset viewer.
