- Timestamp:
- Feb 18, 2021, 4:08:42 PM (5 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 5 edited
-
psastro.h (modified) (1 diff)
-
psastroAnalysis.c (modified) (1 diff)
-
psastroMosaicAstrom.c (modified) (11 diffs)
-
psastroMosaicChipAstrom.c (modified) (2 diffs)
-
psastroMosaicSetMatch.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastro.h
r41367 r41499 108 108 bool psastroMosaicCorrectDistortion (pmFPA *fpa, psPlaneTransform *TPtoFP); 109 109 bool psastroMosaicCommonScale (pmFPA *fpa, psMetadata *recipe); 110 bool psastroMosaicAstrom (pmConfig *config );110 bool psastroMosaicAstrom (pmConfig *config, psMetadata *stats); 111 111 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, int iteration); 112 112 bool psastroMosaicSetMatch (pmFPA *fpa, psMetadata *recipe, int iteration); -
trunk/psastro/src/psastroAnalysis.c
r41285 r41499 139 139 140 140 if (mosastro) { 141 if (!psastroMosaicAstrom (config)) {141 if (!psastroMosaicAstrom (config, stats)) { 142 142 // This is likely a data quality issue 143 143 psWarning("Failed mosaic astrometry --- suspect bad data quality"); -
trunk/psastro/src/psastroMosaicAstrom.c
r39928 r41499 14 14 # define NONLIN_TOL 0.001 /* tolerance in pixels */ 15 15 16 bool psastroMosaicFit (pmFPA *fpa, psMetadata * recipe, const char *rootname, int pass);16 bool psastroMosaicFit (pmFPA *fpa, psMetadata *stats, psMetadata *recipe, const char *rootname, int pass); 17 17 bool psastroProjectionRefit (pmFPA *fpa, psMetadata *recipe); 18 18 19 19 // XXX require this fpa to have multiple chip extensions and a PHU? 20 bool psastroMosaicAstrom (pmConfig *config) { 20 // EAM 2021.02.18 : addings 'stats' to set bad quality as appropriate 21 bool psastroMosaicAstrom (pmConfig *config, psMetadata *stats) { 21 22 22 23 bool status; … … 25 26 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE); 26 27 if (!recipe) { 28 // recipe or programming error 27 29 psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n"); 28 30 return false; … … 32 34 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); 33 35 if (!input) { 36 // recipe or programming error 34 37 psError(PSASTRO_ERR_CONFIG, false, "Can't find input data!\n"); 35 38 return false; … … 53 56 // this should be in a loop with nIter = 54 57 for (int iter = 0; fitMosaicDistortion && (iter < nIter); iter++) { 55 if (!psastroMosaicFit (fpa, recipe, outroot, iter)) return false; 58 // NOTE: data quality (psastroMosaicDistortion) or recipe / config error 59 if (!psastroMosaicFit (fpa, stats, recipe, outroot, iter)) return false; 56 60 } 57 61 … … 59 63 // first, re-perform the match with a slightly tighter circle 60 64 if (!psastroMosaicSetMatch (fpa, recipe, nIter)) { 65 // recipe or alloc error 61 66 psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (pass %d)", nIter); 62 67 return false; 63 68 } 64 if (!psastroMosaicChipAstrom (fpa, recipe, nIter)) { 69 if (!psastroMosaicChipAstrom (fpa, stats, recipe, nIter)) { 70 // this cannot actually return false 65 71 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", nIter); 66 72 return false; … … 83 89 } 84 90 if (!pmAstromWriteBilevelMosaic (updates, fpa, NONLIN_TOL)) { 85 psError(psErrorCodeLast(), false, "Failed to save header terms"); 86 return false; 91 // error here is a data quality problem (and too bad to write smf) 92 psWarning ("Failed to save header terms"); 93 if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) { 94 psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE, "Mosaic astrometry failed", PSASTRO_ERR_DATA); 95 } 96 return false; 87 97 } 88 98 … … 109 119 // 2: match 6,7 110 120 // 3: match 8,9 111 bool psastroMosaicFit (pmFPA *fpa, psMetadata * recipe, const char *rootname, int pass) {121 bool psastroMosaicFit (pmFPA *fpa, psMetadata *stats, psMetadata *recipe, const char *rootname, int pass) { 112 122 113 123 char filename[256]; … … 117 127 if (!psastroMosaicSetMatch (fpa, recipe, pass)) { 118 128 psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (pass %d)", pass); 129 // this can only fail on alloc failure in pmAstromRadiusMatchUniq 119 130 return false; 120 131 } … … 129 140 // then recalculate raw and ref positions 130 141 if (!psastroMosaicCommonScale (fpa, recipe)) { 142 // this can only return false if the recipe value is not set 131 143 psError(PSASTRO_ERR_UNKNOWN, false, "failed to set a common scale for the chips (pass %d)", pass); 132 144 return false; … … 141 153 // apply the new distortion terms up and down 142 154 // refit the per-chip terms with linear fits only 155 // NOTE: failure here is a data quality problem 143 156 if (!psastroMosaicDistortion (fpa, recipe, pass)) { 144 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure mosaic gradients (pass %d)", pass); 157 psWarning ("failed to measure mosaic gradients (pass %d)", pass); 158 if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) { 159 psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE, "Mosaic astrometry failed", PSASTRO_ERR_DATA); 160 } 145 161 return false; 146 162 } … … 150 166 151 167 // measure the astrometry for the chips under the distortion term 152 if (!psastroMosaicChipAstrom (fpa, recipe, pass)) { 168 if (!psastroMosaicChipAstrom (fpa, stats, recipe, pass)) { 169 // this cannot actually return false 153 170 psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", pass); 154 171 return false; -
trunk/psastro/src/psastroMosaicChipAstrom.c
r41498 r41499 14 14 # define NONLIN_TOL 0.001 ///< tolerance in pixels 15 15 16 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata * recipe, int iteration) {16 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *stats, psMetadata *recipe, int iteration) { 17 17 18 18 bool status; … … 83 83 if (fGood < minGoodChipFraction) { 84 84 psWarning ("Too few good chips (%d of %d = %.2f), setting bad quality for this exposure\n", nChipGood, (nChipGood + nChipFail), fGood); 85 // return false; 85 // NOTE: set bad data quality here 86 if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) { 87 psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE, "Mosaic astrometry failed", PSASTRO_ERR_DATA); 88 } 86 89 } 87 90 -
trunk/psastro/src/psastroMosaicSetMatch.c
r26259 r41499 76 76 if (!unique) { 77 77 psLogMsg ("psastro", 3, "failed to generate a uniq set of matched sources\n"); 78 return false; 78 return false; // this can only happen if alloc fails, not a data quality problem 79 79 } 80 80 psFree (matches);
Note:
See TracChangeset
for help on using the changeset viewer.
