- Timestamp:
- Jul 22, 2011, 5:10:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceOutputs.c
r31451 r31927 181 181 return true; 182 182 } 183 184 bool pmSourceLocalAstrometry (psSphere *ptSky, float *posAngle, float *pltScale, pmChip *chip, float xPos, float yPos) { 185 186 pmFPA *fpa = chip->parent; 187 188 if (!chip->toFPA) goto escape; 189 if (!fpa->toTPA) goto escape; 190 if (!fpa->toSky) goto escape; 191 192 // generate RA,DEC 193 psPlane ptCH, ptFP, ptTP_o, ptTP_x, ptTP_y; 194 195 // calculate the astrometry for the coordinate of interest 196 ptCH.x = xPos; 197 ptCH.y = yPos; 198 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH); 199 psPlaneTransformApply (&ptTP_o, fpa->toTPA, &ptFP); 200 psDeproject (ptSky, &ptTP_o, fpa->toSky); 201 202 // calculate the astrometry for the coordinate + 1pix in X 203 ptCH.x = xPos + 1.0; 204 ptCH.y = yPos; 205 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH); 206 psPlaneTransformApply (&ptTP_x, fpa->toTPA, &ptFP); 207 208 // calculate the astrometry for the coordinate + 1pix in Y 209 ptCH.x = xPos; 210 ptCH.y = yPos + 1.0; 211 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH); 212 psPlaneTransformApply (&ptTP_y, fpa->toTPA, &ptFP); 213 214 // the resulting Tangent Plane coordinates are in TP pixels; convert to local Tangent Plane 215 // degrees 216 217 float dTPx_dCHx = fpa->toSky->Xs * (ptTP_x.x - ptTP_o.x); 218 float dTPy_dCHx = fpa->toSky->Ys * (ptTP_x.y - ptTP_o.y); 219 220 float dTPx_dCHy = fpa->toSky->Xs * (ptTP_y.x - ptTP_o.x); 221 float dTPy_dCHy = fpa->toSky->Ys * (ptTP_y.y - ptTP_o.y); 222 223 float pltScale_x = hypot(dTPx_dCHx, dTPy_dCHx); 224 float pltScale_y = hypot(dTPx_dCHy, dTPy_dCHy); 225 *pltScale = 0.5*(pltScale_x + pltScale_y); 226 227 float posAngle_x = atan2 (+dTPy_dCHx, +dTPx_dCHx); 228 float posAngle_y = atan2 (-dTPy_dCHy, +dTPx_dCHy); 229 *posAngle = 0.5*(posAngle_x + posAngle_y); 230 231 return true; 232 233 escape: 234 // no astrometry calibration, give up 235 ptSky->r = NAN; 236 ptSky->d = NAN; 237 *posAngle = NAN; 238 *pltScale = NAN; 239 240 return false; 241 } 242
Note:
See TracChangeset
for help on using the changeset viewer.
