IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 21, 2011, 10:59:14 AM (15 years ago)
Author:
bills
Message:

optionally use a separate list of stars with different magnitude range for grid search. This is used to
work around the bright star astrometry problem that fouls up the STS astrometry.

File:
1 edited

Legend:

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

    r31161 r31333  
    1414// leak free 2006.04.27
    1515
     16static psArray * chooseStars(psArray *inStars, char *listName, psArray *sources, psVector *index, int nMax, float iMagMin, float iMagMax, pmSourceMode skip);
     17
    1618bool psastroConvertFPA (pmFPA *fpa, psMetadata *recipe) {
    1719
     
    8789    }
    8890
     91    psArray *rawStars = chooseStars(inStars, "", sources, index, PS_MIN(nMax, inStars->n), iMagMin, iMagMax, skip);
     92    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.RAWSTARS", PS_DATA_ARRAY, "astrometry objects", rawStars);
     93
     94    bool gridSearch = psMetadataLookupBool (&status, recipe, "PSASTRO.GRID.SEARCH");
     95    if (gridSearch) {
     96        // See if different magnitude limits have been specified for grid search. If so, create a separate list of stars to use.
     97        float iGridMagMax = psMetadataLookupF32 (&status, recipe, "PSASTRO.GRID.MAX.INST.MAG.RAW");
     98        float iGridMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.GRID.MIN.INST.MAG.RAW");
     99        int   nMaxGrid = psMetadataLookupS32 (&status, recipe, "PSASTRO.GRID.NRAW.MAX");
     100   
     101        // XXX Should we check PSASTRO.GRID.NRAW.MAX != PSASTRO.MAX.NRAW as well? It usually is smaller so that would cause
     102        // us to always create a separate list. So I won't check.
     103
     104        if ((iGridMagMax != iMagMax) || (iGridMagMin != iMagMin)) {
     105            psArray *gridStars = chooseStars(inStars, "grid search ", sources, index, PS_MIN(nMaxGrid, inStars->n), iGridMagMin, iGridMagMax, skip);
     106            psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.GRID.RAWSTARS", PS_DATA_ARRAY, "astrometry objects for grid search", gridStars);
     107            psFree(gridStars);
     108        }
     109    }
     110
     111    psFree (index);
     112    psFree (inStars);
     113    psFree (rawStars);
     114
     115    return true;
     116}
     117
     118
     119psArray * chooseStars(psArray *inStars, char *listName, psArray *sources, psVector *index, int nMax, float iMagMin, float iMagMax, pmSourceMode skip) {
    89120    // choose the first nMax sources
    90121    int j = 0;
    91     psArray *rawStars = psArrayAlloc (PS_MIN (nMax, inStars->n));
     122    psArray *rawStars = psArrayAlloc(nMax);
    92123
    93124    float mMin = +100.0;
     
    128159    rawStars->n = j;
    129160
    130     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.RAWSTARS", PS_DATA_ARRAY, "astrometry objects", rawStars);
    131 
    132     psLogMsg ("psastro", 4, "loaded %ld sources, using %ld of %ld good sources (inst mag: %f to %f)\n", sources->n, rawStars->n, inStars->n, mMin, mMax);
     161    psLogMsg ("psastro", 4, "loaded %ld %ssources, using %ld of %ld good sources (inst mag: %f to %f)\n", sources->n, listName, rawStars->n, inStars->n, mMin, mMax);
    133162    psLogMsg ("psastro", 4, "skip reasons: mode: %d, faint: %d, bright: %d, inf: %d\n", nModeSkip, nFaintSkip, nBrightSkip, nInfSkip);
    134163
    135     psFree (index);
    136     psFree (inStars);
    137     psFree (rawStars);
    138 
    139     return true;
     164    return rawStars;
    140165}
    141166
Note: See TracChangeset for help on using the changeset viewer.