Changeset 31020
- Timestamp:
- Mar 23, 2011, 9:58:17 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psastro/src/psastroOneChipGrid.c
r26259 r31020 28 28 29 29 // 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; 36 37 } 37 38 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); 39 52 40 53 // find initial offset / rotation / scale 41 pmAstromStats *gridStats = pmAstromGridMatch ( gridStars, refstars, recipe);54 pmAstromStats *gridStats = pmAstromGridMatch (rawGridStars, refGridStars, recipe); 42 55 if (gridStats == NULL) { 43 56 psLogMsg ("psastro", 3, "failed to find a grid match solution\n"); 44 psFree (gridStars); 57 psFree (rawGridStars); 58 psFree (refGridStars); 45 59 return false; 46 60 } … … 48 62 49 63 // tweak the position by finding peak of matches stars 50 stats = pmAstromGridTweak ( gridStars, refstars, recipe, gridStats);64 stats = pmAstromGridTweak (rawGridStars, refGridStars, recipe, gridStats); 51 65 if (stats == NULL) { 52 66 psLogMsg ("psastro", 3, "failed to measure tweaked grid solution\n"); 53 67 psFree (gridStats); 54 psFree (gridStars); 68 psFree (rawGridStars); 69 psFree (refGridStars); 55 70 return false; 56 71 } … … 61 76 psastroUpdateChipToFPA (fpa, chip); // updates PSASTRO.RAWSTARS and PSASTRO.REFSTARS 62 77 psFree (gridStats); 63 psFree (gridStars); 78 psFree (rawGridStars); 79 psFree (refGridStars); 64 80 psFree (stats); 65 81
Note:
See TracChangeset
for help on using the changeset viewer.
