Changeset 20800
- Timestamp:
- Nov 19, 2008, 10:08:24 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroMosaicAstrom.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroMosaicAstrom.c
r20269 r20800 13 13 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE); 14 14 if (!recipe) { 15 psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n");16 return false;15 psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n"); 16 return false; 17 17 } 18 18 … … 20 20 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); 21 21 if (!input) { 22 psError(PSASTRO_ERR_CONFIG, false, "Can't find input data!\n");23 return false;22 psError(PSASTRO_ERR_CONFIG, false, "Can't find input data!\n"); 23 return false; 24 24 } 25 25 … … 27 27 28 28 // before we do object matches, we need to (optionally) fix failed chips. We compare chips with 29 // the supplied mosaic model. Adjust significant outliers to match model. 29 // the supplied mosaic model. Adjust significant outliers to match model. 30 30 # if (0) 31 31 if (!psastroFixChips (config, recipe)) { 32 psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips");33 return false;32 psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips"); 33 return false; 34 34 } 35 35 if (!psastroFixChipsTest (config, recipe)) { 36 psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips");37 return false;36 psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips"); 37 return false; 38 38 } 39 39 # endif … … 50 50 // first, re-perform the match with a slightly tighter circle 51 51 if (!psastroMosaicSetMatch (fpa, recipe, 4)) { 52 psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (4th pass)");53 return false;52 psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (4th pass)"); 53 return false; 54 54 } 55 55 if (!psastroMosaicChipAstrom (fpa, recipe, 4)) { 56 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (4th pass)");57 return false;56 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (4th pass)"); 57 return false; 58 58 } 59 if (psTraceGetLevel("psastro.dump") > 0) { 60 snprintf (filename, 256, "%s.10.dat", outroot);61 psastroDumpMatches (fpa, filename); 59 if (psTraceGetLevel("psastro.dump") > 0) { 60 snprintf (filename, 256, "%s.10.dat", outroot); 61 psastroDumpMatches (fpa, filename); 62 62 } 63 63 … … 66 66 psMetadata *updates = psMetadataLookupMetadata (&status, fpa->analysis, "PSASTRO.HEADER"); 67 67 if (!updates) { 68 updates = psMetadataAlloc ();69 psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates);70 psFree (updates);68 updates = psMetadataAlloc (); 69 psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates); 70 psFree (updates); 71 71 } 72 72 if (!pmAstromWriteBilevelMosaic (updates, fpa, NONLIN_TOL)) { 73 psAbort ("failed to save header terms");73 psAbort ("failed to save header terms"); 74 74 } 75 75 … … 103 103 // is this needed? yes, if we didn't do SingleChip astrometry first 104 104 if (!psastroMosaicSetMatch (fpa, recipe, pass)) { 105 psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (pass %d)", pass);106 return false;105 psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (pass %d)", pass); 106 return false; 107 107 } 108 108 109 if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) { 110 snprintf (filename, 256, "%s.0.dat", rootname);111 psastroDumpMatches (fpa, filename); 109 if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) { 110 snprintf (filename, 256, "%s.0.dat", rootname); 111 psastroDumpMatches (fpa, filename); 112 112 } 113 113 … … 116 116 // then recalculate raw and ref positions 117 117 if (!psastroMosaicCommonScale (fpa, recipe)) { 118 psError(PSASTRO_ERR_UNKNOWN, false, "failed to set a common scale for the chips (pass %d)", pass);119 return false;118 psError(PSASTRO_ERR_UNKNOWN, false, "failed to set a common scale for the chips (pass %d)", pass); 119 return false; 120 120 } 121 121 122 if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) { 123 snprintf (filename, 256, "%s.1.dat", rootname);124 psastroDumpMatches (fpa, filename); 122 if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) { 123 snprintf (filename, 256, "%s.1.dat", rootname); 124 psastroDumpMatches (fpa, filename); 125 125 } 126 126 … … 129 129 // refit the per-chip terms with linear fits only 130 130 if (!psastroMosaicDistortion (fpa, recipe, pass)) { 131 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure mosaic gradients (pass %d)", pass);132 return false;131 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure mosaic gradients (pass %d)", pass); 132 return false; 133 133 } 134 134 135 135 snprintf (filename, 256, "%s.%d.dat", rootname, 2*pass + 2); 136 136 if (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1) { psastroDumpMatches (fpa, filename); } 137 137 138 138 // measure the astrometry for the chips under the distortion term 139 139 if (!psastroMosaicChipAstrom (fpa, recipe, pass)) { 140 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", pass);141 return false;140 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", pass); 141 return false; 142 142 } 143 143 144 int traceLevel = psTraceGetLevel("psastro.dump.psastroMosaicAstrom"); 145 if (traceLevel > 1) { 146 snprintf (filename, 256, "%s.%d.dat", rootname, 2*pass + 3); 147 psastroDumpMatches (fpa, filename); 148 } else { 149 snprintf (filename, 256, "%s.dat", rootname); 150 psastroDumpMatches (fpa, filename); 144 if (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1) { 145 snprintf (filename, 256, "%s.%d.dat", rootname, 2*pass + 3); 146 psastroDumpMatches (fpa, filename); 151 147 } 152 148
Note:
See TracChangeset
for help on using the changeset viewer.
