Changeset 20816 for trunk/magic/remove/src/streaksastrom.c
- Timestamp:
- Nov 21, 2008, 1:33:36 PM (18 years ago)
- Location:
- trunk/magic/remove/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
streaksastrom.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src
- Property svn:ignore
-
old new 1 1 streaksremove 2 streaksreplace 3 streakscompare
-
- Property svn:ignore
-
trunk/magic/remove/src/streaksastrom.c
r20573 r20816 150 150 } 151 151 152 static bool 153 readAstrometry(streakFiles *sf) 154 { 155 pmHDU *phu = pmFPAviewThisPHU(sf->view, sf->inAstrom->fpa); 156 if (phu) { 157 bool status; 158 char *ctype = psMetadataLookupStr(&status, phu->header, "CTYPE1"); 159 if (ctype) { 160 sf->bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 161 } 162 } 163 164 if (sf->bilevelAstrometry) { 165 // Do we get here for GPC1 ? I don't necessarily have an fpa for the input image 166 if (!pmAstromReadBilevelMosaic(sf->inAstrom->fpa, phu->header)) { 167 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input FPA."); 168 return false; 169 } 170 } else { 171 pmHDU *hdu = pmFPAviewThisHDU(sf->view, sf->inAstrom->fpa); 172 PS_ASSERT_PTR_NON_NULL(hdu, 1) 173 PS_ASSERT_PTR_NON_NULL(hdu->header, 1) 174 175 // we use a default FPA pixel scale of 1.0 176 if (!pmAstromReadWCS (sf->inAstrom->fpa, sf->chip, hdu->header, 1.0)) { 177 psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for input FPA."); 178 return false; 179 } 180 } 181 182 return true; 183 } 184 185 void 186 setupAstrometry(streakFiles *sf) 187 { 188 bool status; 189 // load astrometry file 190 if (USE_SUPPLIED_ASTROM(sf->stage)) { 191 sf->inAstrom = pmFPAfileDefineFromArgs(&status, sf->config, "PSWARP.ASTROM", "ASTROM"); 192 } else { 193 // otherwise get astrometry from pmfile 194 if (!sf->inImage->pmfile) { 195 streaksExit("unexpected null pmFPAfile", PS_EXIT_CONFIG_ERROR); 196 } 197 sf->inAstrom = sf->inImage->pmfile; 198 } 199 sf->view = pmFPAviewAlloc(0); 200 201 if (!pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_BEFORE)) { 202 psError(PS_ERR_UNKNOWN, false, "Failed to load input."); 203 streaksExit("", PS_EXIT_DATA_ERROR); 204 } 205 206 while ((sf->chip = pmFPAviewNextChip(sf->view, sf->inAstrom->fpa, 1))) { 207 if (sf->inAstrom->fpa->chips->n == 1) { 208 // There's only one chip in this FPA and we've got it so break 209 break; 210 } 211 bool status; 212 psString chip_name = psMetadataLookupStr(&status, sf->chip->concepts, "CHIP.NAME"); 213 if (!strcmp(chip_name, sf->class_id)) { 214 break; 215 } 216 } 217 if (!sf->chip) { 218 psError(PS_ERR_UNKNOWN, true, "Failed to find chip with data."); 219 streaksExit("", PS_EXIT_DATA_ERROR); 220 } 221 if (!pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_BEFORE)) { 222 psError(PS_ERR_UNKNOWN, false, "failed to load chip"); 223 streaksExit("", PS_EXIT_DATA_ERROR); 224 } 225 if (!readAstrometry(sf)) { 226 psError(PS_ERR_UNKNOWN, false, "failed to read astrometry"); 227 streaksExit("", PS_EXIT_DATA_ERROR); 228 } 229 }
Note:
See TracChangeset
for help on using the changeset viewer.
