IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31020


Ignore:
Timestamp:
Mar 23, 2011, 9:58:17 AM (15 years ago)
Author:
eugene
Message:

use a subset of RAW and REF sources when doing grid search (was only RAW)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psastro/src/psastroOneChipGrid.c

    r26259 r31020  
    2828
    2929    // do we need to get a rough initial match?
    30     REQUIRED_RECIPE_VALUE (int maxNstar, "PSASTRO.GRID.NSTAR.MAX", S32);
    31 
    32     // generate the bright subset of maxNstar entries (note: rawstars is sorted by S/N)
    33     psArray *gridStars = psArrayAlloc (PS_MIN (maxNstar, rawstars->n));
    34     for (int i = 0; (i < maxNstar) && (i < rawstars->n); i++) {
    35         gridStars->data[i] = psMemIncrRefCounter (rawstars->data[i]);
     30    int nMaxRaw = psMetadataLookupS32(&status, recipe, "PSASTRO.GRID.NRAW.MAX");
     31    if (!status) {
     32        nMaxRaw = psMetadataLookupS32(&status, recipe, "PSASTRO.GRID.NSTAR.MAX");
     33    }
     34    int nMaxRef = psMetadataLookupS32(&status, recipe, "PSASTRO.GRID.NREF.MAX");
     35    if (!status) {
     36        nMaxRef = refstars->n;
    3637    }
    3738
    38     psLogMsg ("psastro", 3, "grid search using %ld raw vs %ld ref stars\n", gridStars->n, refstars->n);
     39    // generate the bright subset of nMaxRaw entries of rawstars (already sorted by S/N)
     40    psArray *rawGridStars = psArrayAlloc (PS_MIN (nMaxRaw, rawstars->n));
     41    for (int i = 0; (i < nMaxRaw) && (i < rawstars->n); i++) {
     42        rawGridStars->data[i] = psMemIncrRefCounter (rawstars->data[i]);
     43    }
     44
     45    // generate the bright subset of nMaxRef entries of refstars (already sorted by S/N)
     46    psArray *refGridStars = psArrayAlloc (PS_MIN (nMaxRef, refstars->n));
     47    for (int i = 0; (i < nMaxRef) && (i < refstars->n); i++) {
     48        refGridStars->data[i] = psMemIncrRefCounter (refstars->data[i]);
     49    }
     50
     51    psLogMsg ("psastro", 3, "grid search using %ld raw vs %ld ref stars\n", rawGridStars->n, refGridStars->n);
    3952
    4053    // find initial offset / rotation / scale
    41     pmAstromStats *gridStats = pmAstromGridMatch (gridStars, refstars, recipe);
     54    pmAstromStats *gridStats = pmAstromGridMatch (rawGridStars, refGridStars, recipe);
    4255    if (gridStats == NULL) {
    4356        psLogMsg ("psastro", 3, "failed to find a grid match solution\n");
    44         psFree (gridStars);
     57        psFree (rawGridStars);
     58        psFree (refGridStars);
    4559        return false;
    4660    }
     
    4862
    4963    // tweak the position by finding peak of matches stars
    50     stats = pmAstromGridTweak (gridStars, refstars, recipe, gridStats);
     64    stats = pmAstromGridTweak (rawGridStars, refGridStars, recipe, gridStats);
    5165    if (stats == NULL) {
    5266        psLogMsg ("psastro", 3, "failed to measure tweaked grid solution\n");
    5367        psFree (gridStats);
    54         psFree (gridStars);
     68        psFree (rawGridStars);
     69        psFree (refGridStars);
    5570        return false;
    5671    }
     
    6176    psastroUpdateChipToFPA (fpa, chip); // updates PSASTRO.RAWSTARS and PSASTRO.REFSTARS
    6277    psFree (gridStats);
    63     psFree (gridStars);
     78    psFree (rawGridStars);
     79    psFree (refGridStars);
    6480    psFree (stats);
    6581
Note: See TracChangeset for help on using the changeset viewer.