IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 7:39:43 PM (16 years ago)
Author:
eugene
Message:

updates from eam_branches/20091201

File:
1 edited

Legend:

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

    r26259 r26897  
    11/** @file psastroConvert.c
    22 *
    3  *  @brief 
     3 *  @brief
    44 *
    55 *  @ingroup libpsastro
     
    4747
    4848    // 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?");
    5254
    5355    // convert the pmSource objects into pmAstromObj objects (drop !STAR and SATSTAR?)
     
    6163    // XXX need to exit gracefully is inStars->n is 0 (or 1?)
    6264
    63     // we are going to select the brighter Nmax subset for astrometry 
     65    // we are going to select the brighter Nmax subset for astrometry
    6466    int nMax = psMetadataLookupS32 (&status, recipe, "PSASTRO.MAX.NRAW");
    6567    if (!status || !nMax) nMax = inStars->n;
    6668
    67     // we are going to select the brighter Nmax subset for astrometry 
     69    // we are going to select the brighter Nmax subset for astrometry
    6870    float iMagMax = psMetadataLookupF32 (&status, recipe, "PSASTRO.MAX.INST.MAG.RAW");
    6971    float iMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.MIN.INST.MAG.RAW");
    7072
    71     // we are going to select the brighter Nmax subset for astrometry 
     73    // we are going to select the brighter Nmax subset for astrometry
    7274    pmSourceMode skip = PM_SOURCE_MODE_DEFAULT;
    7375    char *ignoreList = psMetadataLookupStr (&status, recipe, "PSASTRO.IGNORE");
     
    7577      psArray *list = psStringSplitArray (ignoreList, ",", false);
    7678      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;
    8385      }
    8486      psFree (list);
     
    9799
    98100    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];
    101103
    102104        psTrace ("psastro", 6, "mag: %f +/- %f, mode: %x, skip: %x\n", source->psfMag, source->errMag, source->mode, skip);
    103105
    104         if (source->mode & skip) {
    105           nModeSkip ++;
    106           continue;
    107         }
     106        if (source->mode & skip) {
     107          nModeSkip ++;
     108          continue;
     109        }
    108110
    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++;
    125127    }
    126128    rawStars->n = j;
     
    147149
    148150        // only accept the PSF sources?
    149         // XXX drop SATSTAR?
     151        // XXX drop SATSTAR?
    150152        // if (source->type != PM_SOURCE_TYPE_STAR) continue;
    151153
     
    154156
    155157        psF32 *PAR = model->params->data.F32;
    156         psF32 *dPAR = model->dparams->data.F32;
     158        psF32 *dPAR = model->dparams->data.F32;
    157159
    158160        pmAstromObj *obj = pmAstromObjAlloc ();
Note: See TracChangeset for help on using the changeset viewer.