summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-01-21 18:46:54 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-01-21 18:46:54 (GMT)
commitb41feae138e42d9a93cc7999a812c0c08aae69e7 (patch)
tree2c49cba10925e01cff3a09f2516c229d76d64f9d /tksao
parent8e7807743d9abe7028989e9a6e26a77446edd6de (diff)
downloadblt-b41feae138e42d9a93cc7999a812c0c08aae69e7.zip
blt-b41feae138e42d9a93cc7999a812c0c08aae69e7.tar.gz
blt-b41feae138e42d9a93cc7999a812c0c08aae69e7.tar.bz2
support WCS-TAB
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/fitsimage.C11
-rw-r--r--tksao/frame/fitsimage.h1
-rw-r--r--tksao/frame/fitsmap.C2
3 files changed, 11 insertions, 3 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index 52d4994..1fd2ccf 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -113,6 +113,7 @@ FitsImage::FitsImage(Context* cx, Tcl_Interp* pp)
wcsx_ =NULL;
#else
ast_ =NULL;
+ astInv_ =0;
wcs_ =NULL;
wcsEqu_ =NULL;
wcsCel_ =NULL;
@@ -1148,6 +1149,7 @@ void FitsImage::initWCS()
wcsx_[ii] = ptr->wcsx_[ii];
#else
ast_ = ptr->ast_;
+ astInv_ = ptr->astInv_;
wcs_ = ptr->wcs_;
wcsEqu_ = ptr->wcsEqu_;
wcsCel_ = ptr->wcsCel_;
@@ -3404,7 +3406,7 @@ Vector FitsImage::wcs2pix(const Vector& vv, Coord::CoordSystem sys,
{
astClearStatus; // just to make sure
- if (hasWCS(sys)) {
+ if (hasWCS(sys) && astInv_) {
setWCSSkyFrame(sys, sky);
Vector in = hasWCSCel(sys) ? degToRad(vv) : vv;
@@ -3422,7 +3424,7 @@ Vector3d FitsImage::wcs2pix(const Vector3d& vv, Coord::CoordSystem sys,
{
astClearStatus; // just to make sure
- if (hasWCS(sys)) {
+ if (hasWCS(sys) && astInv_) {
setWCSSkyFrame(sys, sky);
Vector3d in = hasWCSCel(sys) ? degToRad(vv) : vv;
@@ -4649,6 +4651,11 @@ AstFrameSet* FitsImage::fits2ast(FitsHead* hd)
strncmp(astGetC(frameSet,"Class"), "FrameSet", 8))
return NULL;
+ // warn if no inverse
+ astInv_ = astGetI(frameSet, "TranInverse");
+ if (!astInv_)
+ internalError("Warning: the WCS has no defined inverse. Some functionality may not be available.");
+
return frameSet;
}
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index 2907854..48dae8d 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -117,6 +117,7 @@ class FitsImage {
WCSx** wcsx_; // xth Axis WCS
#else
AstFrameSet* ast_; // ast frameset;
+ int astInv_; // can we inverse?
int* wcs_;
int* wcsEqu_;
int* wcsCel_;
diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C
index ecf425a..756b227 100644
--- a/tksao/frame/fitsmap.C
+++ b/tksao/frame/fitsmap.C
@@ -308,7 +308,7 @@ double FitsImage::mapLenToRef(double dd, Coord::CoordSystem sys,
return dd*(detectorToPhysical * physicalToRef)[1].length();
default:
{
- if (!hasWCS(sys))
+ if (!hasWCS(sys) || !astInv_)
return 0;
astClearStatus; // just to make sure