Changeset 26897 for trunk/psastro/src/psastroConvert.c
- Timestamp:
- Feb 10, 2010, 7:39:43 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroConvert.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroConvert.c
r26259 r26897 1 1 /** @file psastroConvert.c 2 2 * 3 * @brief 3 * @brief 4 4 * 5 5 * @ingroup libpsastro … … 47 47 48 48 // PSPHOT.SOURCES carries the pmSource objects (from psphot analysis or loaded externally) 49 psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES"); 50 if (sources == NULL) 51 return false; 49 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 50 psAssert (detections, "missing detections?"); 51 52 psArray *sources = detections->allSources; 53 psAssert (sources, "missing sources?"); 52 54 53 55 // convert the pmSource objects into pmAstromObj objects (drop !STAR and SATSTAR?) … … 61 63 // XXX need to exit gracefully is inStars->n is 0 (or 1?) 62 64 63 // we are going to select the brighter Nmax subset for astrometry 65 // we are going to select the brighter Nmax subset for astrometry 64 66 int nMax = psMetadataLookupS32 (&status, recipe, "PSASTRO.MAX.NRAW"); 65 67 if (!status || !nMax) nMax = inStars->n; 66 68 67 // we are going to select the brighter Nmax subset for astrometry 69 // we are going to select the brighter Nmax subset for astrometry 68 70 float iMagMax = psMetadataLookupF32 (&status, recipe, "PSASTRO.MAX.INST.MAG.RAW"); 69 71 float iMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.MIN.INST.MAG.RAW"); 70 72 71 // we are going to select the brighter Nmax subset for astrometry 73 // we are going to select the brighter Nmax subset for astrometry 72 74 pmSourceMode skip = PM_SOURCE_MODE_DEFAULT; 73 75 char *ignoreList = psMetadataLookupStr (&status, recipe, "PSASTRO.IGNORE"); … … 75 77 psArray *list = psStringSplitArray (ignoreList, ",", false); 76 78 for (int i = 0; i < list->n; i++) { 77 pmSourceMode mode = pmSourceModeFromString (list->data[i]);78 if (mode == PM_SOURCE_MODE_DEFAULT) {79 psWarning ("unknown source mode in PSASTRO.IGNORE, skipping");80 continue;81 }82 skip |= mode;79 pmSourceMode mode = pmSourceModeFromString (list->data[i]); 80 if (mode == PM_SOURCE_MODE_DEFAULT) { 81 psWarning ("unknown source mode in PSASTRO.IGNORE, skipping"); 82 continue; 83 } 84 skip |= mode; 83 85 } 84 86 psFree (list); … … 97 99 98 100 for (int i = 0; (i < inStars->n) && (j < rawStars->n); i++) { 99 int n = index->data.S32[i];100 pmSource *source = sources->data[n];101 int n = index->data.S32[i]; 102 pmSource *source = sources->data[n]; 101 103 102 104 psTrace ("psastro", 6, "mag: %f +/- %f, mode: %x, skip: %x\n", source->psfMag, source->errMag, source->mode, skip); 103 105 104 if (source->mode & skip) { 105 nModeSkip ++;106 continue;107 }106 if (source->mode & skip) { 107 nModeSkip ++; 108 continue; 109 } 108 110 109 if ((iMagMax != 0.0) && (source->psfMag > iMagMax)) {110 nFaintSkip ++;111 continue;112 }113 if ((iMagMin != 0.0) && (source->psfMag < iMagMin)) {114 nBrightSkip ++;115 continue;116 }117 if (!isfinite(source->psfMag)) {118 nInfSkip ++;119 continue;120 }121 mMin = PS_MIN (mMin, source->psfMag);122 mMax = PS_MAX (mMax, source->psfMag);123 rawStars->data[j] = psMemIncrRefCounter (inStars->data[n]);124 j++;111 if ((iMagMax != 0.0) && (source->psfMag > iMagMax)) { 112 nFaintSkip ++; 113 continue; 114 } 115 if ((iMagMin != 0.0) && (source->psfMag < iMagMin)) { 116 nBrightSkip ++; 117 continue; 118 } 119 if (!isfinite(source->psfMag)) { 120 nInfSkip ++; 121 continue; 122 } 123 mMin = PS_MIN (mMin, source->psfMag); 124 mMax = PS_MAX (mMax, source->psfMag); 125 rawStars->data[j] = psMemIncrRefCounter (inStars->data[n]); 126 j++; 125 127 } 126 128 rawStars->n = j; … … 147 149 148 150 // only accept the PSF sources? 149 // XXX drop SATSTAR?151 // XXX drop SATSTAR? 150 152 // if (source->type != PM_SOURCE_TYPE_STAR) continue; 151 153 … … 154 156 155 157 psF32 *PAR = model->params->data.F32; 156 psF32 *dPAR = model->dparams->data.F32;158 psF32 *dPAR = model->dparams->data.F32; 157 159 158 160 pmAstromObj *obj = pmAstromObjAlloc ();
Note:
See TracChangeset
for help on using the changeset viewer.
