Changeset 10880 for trunk/psastro/src/psastroMosaicAstrom.c
- Timestamp:
- Jan 2, 2007, 3:26:52 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroMosaicAstrom.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroMosaicAstrom.c
r10864 r10880 4 4 // XXX require this fpa to have multiple chip extensions and a PHU? 5 5 bool psastroMosaicAstrom (pmConfig *config, psArray *refs) { 6 7 bool status;8 psArray *gradients = NULL;9 6 10 7 // select the current recipe … … 29 26 30 27 // given the existing per-chip astrometry, determine matches between raw and ref stars 28 // is this needed? yes, if we didn't do SingleChip astrometry first 31 29 psastroMosaicSetMatch (fpa, recipe, 0); 30 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.0.dat"); } 32 31 33 32 // fitted chips will follow the local plate-scale, hiding the distortion … … 35 34 // then recalculate raw and ref positions 36 35 psastroMosaicCommonScale (fpa, recipe); 37 psastroMosaicSetAstrom (fpa);36 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.1.dat"); } 38 37 39 gradients = psastroMosaicGradients (fpa, recipe); 38 // fit the distortion by fitting its gradient 39 // apply the new distortion terms up and down 40 // refit the per-chip terms with linear fits only 41 psastroMosaicGradients (fpa, recipe); 42 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.2.dat"); } 40 43 41 // allocate mosaic-level polynomial transformation and set masks needed by DVO 42 int order = psMetadataLookupF32 (&status, recipe, "PSASTRO.MOSAIC.ORDER"); 43 if (!status) { 44 psError(PSASTRO_ERR_UNKNOWN, false, "failed to find single-chip fit order\n"); 45 return false; 46 } 47 psFree (fpa->toTPA); 48 fpa->toTPA = psPlaneTransformAlloc (order, order); 49 for (int i = 0; i <= fpa->toTPA->x->nX; i++) { 50 for (int j = 0; j <= fpa->toTPA->x->nY; j++) { 51 if (i + j > order) { 52 fpa->toTPA->x->mask[i][j] = 1; 53 fpa->toTPA->y->mask[i][j] = 1; 54 } 55 } 56 } 44 psastroMosaicChipAstrom (fpa, recipe, false); 45 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.3.dat"); } 57 46 58 // fit the measured gradients with the telescope distortion model (polynomial order based on toTPA)59 pmAstromFitDistortion (fpa, gradients, recipe);60 psFree (gradients);61 62 // apply the new distortion terms up and down63 47 // re-perform the match with a slightly tighter circle 64 // XXX modify match radius65 // XXX set chip.order to 166 psastroMosaicSetAstrom_tmp (fpa);67 48 psastroMosaicSetMatch (fpa, recipe, 1); 68 psastroMosaicChipAstrom (fpa, recipe, 1);69 49 70 50 // do a second pass on the distortion with improved chip positions and rotations 71 // XXX do we need to iterate with this step until the distortions don't change?72 51 psastroMosaicCommonScale (fpa, recipe); 73 gradients =psastroMosaicGradients (fpa, recipe);74 p mAstromFitDistortion (fpa, gradients, recipe);75 ps Free (gradients);52 psastroMosaicGradients (fpa, recipe); 53 psastroMosaicChipAstrom (fpa, recipe, false); 54 psastroMosaicSetMatch (fpa, recipe, 1); 76 55 77 56 // now fit the chips under the common distortion with higher-order terms 78 // XXX modify match radius 79 // XXX set chip.order to NORDER 80 psastroMosaicSetAstrom (fpa); 81 psastroMosaicSetMatch (fpa, recipe, 2); 82 psastroMosaicChipAstrom (fpa, recipe, 2); 57 // first, re-perform the match with a slightly tighter circle 58 psastroMosaicChipAstrom (fpa, recipe, true); 83 59 84 60 // save WCS and analysis metadata in update header 85 // XXX need to add global summary statistics86 61 psMetadata *updates = psMetadataAlloc(); 87 62 pmAstromWriteBilevelMosaic (updates, fpa, NONLIN_TOL); 88 psMetadataAdd (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_DATA_METADATA, "psastro header stats", updates);63 psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates); 89 64 psFree (updates); 90 65 91 66 // update the headers based on the results 67 // XXX need to add global summary statistics 92 68 // psastroMosaicHeaders (config); 93 69
Note:
See TracChangeset
for help on using the changeset viewer.
