Changeset 24403
- Timestamp:
- Jun 14, 2009, 2:20:31 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V2.c
r24401 r24403 624 624 return true; 625 625 } 626 627 bool pmSourceLocalAstrometry (psSphere *ptSky, float *posAngle, float *pltScale, pmChip *chip, float xPos, float yPos) {628 629 pmFPA *fpa = chip->parent;630 631 if (!chip->toFPA) goto escape;632 if (!fpa->toTPA) goto escape;633 if (!fpa->toSky) goto escape;634 635 // generate RA,DEC636 psPlane ptCH, ptFP, ptTP_o, ptTP_x, ptTP_y;637 638 // calculate the astrometry for the coordinate of interest639 ptCH.x = xPos;640 ptCH.y = yPos;641 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);642 psPlaneTransformApply (&ptTP_o, fpa->toTPA, &ptFP);643 psDeproject (ptSky, &ptTP_o, fpa->toSky);644 645 // calculate the astrometry for the coordinate + 1pix in X646 ptCH.x = xPos + 1.0;647 ptCH.y = yPos;648 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);649 psPlaneTransformApply (&ptTP_x, fpa->toTPA, &ptFP);650 651 // calculate the astrometry for the coordinate + 1pix in Y652 ptCH.x = xPos;653 ptCH.y = yPos + 1.0;654 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);655 psPlaneTransformApply (&ptTP_y, fpa->toTPA, &ptFP);656 657 // the resulting Tangent Plane coordinates are in TP pixels; convert to local Tangent Plane658 // degrees659 660 float dTPx_dCHx = fpa->toSky->Xs * (ptTP_x.x - ptTP_o.x);661 float dTPy_dCHx = fpa->toSky->Ys * (ptTP_x.y - ptTP_o.y);662 663 float dTPx_dCHy = fpa->toSky->Xs * (ptTP_y.x - ptTP_o.x);664 float dTPy_dCHy = fpa->toSky->Ys * (ptTP_y.y - ptTP_o.y);665 666 float pltScale_x = hypot(dTPx_dCHx, dTPy_dCHx);667 float pltScale_y = hypot(dTPx_dCHy, dTPy_dCHy);668 *pltScale = 0.5*(pltScale_x + pltScale_y);669 670 float posAngle_x = atan2 (+dTPy_dCHx, +dTPx_dCHx);671 float posAngle_y = atan2 (-dTPy_dCHy, +dTPx_dCHy);672 *posAngle = 0.5*(posAngle_x + posAngle_y);673 674 return true;675 676 escape:677 // no astrometry calibration, give up678 ptSky->r = NAN;679 ptSky->d = NAN;680 *posAngle = NAN;681 *pltScale = NAN;682 683 return false;684 }
Note:
See TracChangeset
for help on using the changeset viewer.
