Changeset 15891 for trunk/psastro/src/psastroAstromGuess.c
- Timestamp:
- Dec 22, 2007, 7:42:46 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroAstromGuess.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroAstromGuess.c
r15200 r15891 32 32 } 33 33 34 // have we already supplied the astrometry from the model? 35 bool useModel = psMetadataLookupBool (&status, config->arguments, "PSASTRO.USE.MODEL"); 36 if (!status) { 37 useModel = psMetadataLookupBool (&status, recipe, "PSASTRO.USE.MODEL"); 38 } 39 34 40 // select the input data sources 35 41 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); … … 46 52 } 47 53 48 pmFPAview *view = pmFPAviewAlloc (0);49 54 pmFPA *fpa = input->fpa; 50 55 51 56 // load mosaic-level astrometry? 52 57 bool bilevelAstrometry = false; 53 pmHDU *phu = pmFPAviewThisPHU (view, fpa); 54 if (phu) { 55 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); 56 if (ctype) { 57 bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 58 } 58 if (!useModel) { 59 psastroAstromGuessSetFPA (fpa, &bilevelAstrometry); 59 60 } 60 if (bilevelAstrometry) {61 pmAstromReadBilevelMosaic (fpa, phu->header);62 }63 61 62 pmFPAview *view = pmFPAviewAlloc (0); 64 63 while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) { 65 64 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 66 65 if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; } 67 66 68 // read WCS data from the corresponding header 69 pmHDU *hdu = pmFPAviewThisHDU (view, fpa); 70 if (bilevelAstrometry) { 71 if (!pmAstromReadBilevelChip (chip, hdu->header)) { 72 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 73 continue; 74 } 75 } else { 76 if (!pmAstromReadWCS (fpa, chip, hdu->header, pixelScale)) { 77 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 78 continue; 79 } 67 if (!useModel) { 68 if (!psastroAstromGuessSetChip (fpa, chip, view, pixelScale, bilevelAstrometry)) continue; 80 69 } 81 70 … … 160 149 sky (ra, dec) 161 150 */ 151 152 bool psastroAstromGuessSetChip (pmFPA *fpa, pmChip *chip, pmFPAview *view, double pixelScale, bool bilevelAstrometry) { 153 154 // read WCS data from the corresponding header 155 pmHDU *hdu = pmFPAviewThisHDU (view, fpa); 156 if (bilevelAstrometry) { 157 if (!pmAstromReadBilevelChip (chip, hdu->header)) { 158 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 159 return false; 160 } 161 } else { 162 if (!pmAstromReadWCS (fpa, chip, hdu->header, pixelScale)) { 163 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 164 return false; 165 } 166 } 167 return true; 168 } 169 170 bool psastroAstromGuessSetFPA (pmFPA *fpa, bool *bilevelAstrometry) { 171 172 pmFPAview *view = pmFPAviewAlloc (0); 173 pmHDU *phu = pmFPAviewThisPHU (view, fpa); 174 175 *bilevelAstrometry = false; 176 177 // load mosaic-level astrometry? 178 if (phu) { 179 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); 180 if (ctype) { 181 *bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 182 } 183 } 184 if (*bilevelAstrometry) { 185 pmAstromReadBilevelMosaic (fpa, phu->header); 186 } 187 psFree (view); 188 return true; 189 }
Note:
See TracChangeset
for help on using the changeset viewer.
