summaryrefslogtreecommitdiffstats
path: root/tksao/frame
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-11-30 22:35:05 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-11-30 22:35:05 (GMT)
commit6ac9587702e94857e264cc672fb7fd5b6a35ffb0 (patch)
tree3a53170a66c8041769a27294a020dcc7cb371f01 /tksao/frame
parent6d8c1064b17824fa67a081dc3a7efe630677fc58 (diff)
downloadblt-6ac9587702e94857e264cc672fb7fd5b6a35ffb0.zip
blt-6ac9587702e94857e264cc672fb7fd5b6a35ffb0.tar.gz
blt-6ac9587702e94857e264cc672fb7fd5b6a35ffb0.tar.bz2
update AST WCS
Diffstat (limited to 'tksao/frame')
-rw-r--r--tksao/frame/fitsimage.C19
-rw-r--r--tksao/frame/fitsimage.h1
-rw-r--r--tksao/frame/frame3dbase.C15
3 files changed, 29 insertions, 6 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index ec1387e..cc3b1ef 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -3155,7 +3155,7 @@ Vector3d FitsImage::pix2wcs(Vector3d in, Coord::CoordSystem sys,
setWCSSystem(newast_,sys);
setWCSSkyFrame(newast_,sky);
- Vector out = wcsTran(newast_, in, 1);
+ Vector3d out = wcsTran(newast_, in, 1);
if (astOK && checkWCS(out)) {
if (wcsIsASkyFrame(newast_))
return out.radToDeg();
@@ -3348,7 +3348,7 @@ Vector3d FitsImage::wcs2pix(Vector3d in, Coord::CoordSystem sys,
if (wcsIsASkyFrame(newast_))
in *= M_PI/180.;
- Vector out = wcsTran(newast_, in, 0);
+ Vector3d out = wcsTran(newast_, in, 0);
if (astOK && checkWCS(out))
return out;
}
@@ -3815,7 +3815,16 @@ void FitsImage::astinit0(int ss, FitsHead* hd, FitsHead* prim)
int FitsImage::checkWCS(Vector& vv)
{
// check for reasonable values
- return (fabs(vv[0]) < FLT_MAX && fabs(vv[1]) < FLT_MAX) ? 1 : 0;
+ return (fabs(vv[0]) < FLT_MAX &&
+ fabs(vv[1]) < FLT_MAX) ? 1 : 0;
+}
+
+int FitsImage::checkWCS(Vector3d& vv)
+{
+ // check for reasonable values
+ return (fabs(vv[0]) < FLT_MAX &&
+ fabs(vv[1]) < FLT_MAX &&
+ fabs(vv[2]) < FLT_MAX ) ? 1 : 0;
}
void FitsImage::setWCSFormat(AstFrameSet* aa, int id, const char* format)
@@ -4157,7 +4166,7 @@ Vector3d FitsImage::wcsTran(AstFrameSet* ast, Vector3d& in, int forward)
double pout[3];
pin[0] = in[0];
pin[1] = in[1];
- pin[2] = in[3];
+ pin[2] = in[2];
astTranN(ast, 1, 3, 1, pin, forward, 3, 1, pout);
return Vector3d(pout[0],pout[1],pout[2]);
}
@@ -4168,7 +4177,7 @@ Vector3d FitsImage::wcsTran(AstFrameSet* ast, Vector3d& in, int forward)
double pout[4];
pin[0] = in[0];
pin[1] = in[1];
- pin[2] = in[3];
+ pin[2] = in[2];
pin[3] = forward ? context_->slice(3) : 0;
astTranN(ast, 1, 4, 1, pin, forward, 4, 1, pout);
return Vector3d(pout[0],pout[1],pout[2]);
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index 44ea871..db0951e 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -156,6 +156,7 @@ class FitsImage {
#endif
void astinit0(int, FitsHead*, FitsHead*);
int checkWCS(Vector&);
+ int checkWCS(Vector3d&);
AstFrameSet* fits2ast(FitsHead*);
public:
diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C
index 889918a..0b56286 100644
--- a/tksao/frame/frame3dbase.C
+++ b/tksao/frame/frame3dbase.C
@@ -179,7 +179,8 @@ void Frame3dBase::getInfoWCS(char* var, Vector3d& rr, FitsImage* ptr,
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),argv[1],0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0);
- // coord3ToTclArray(ptr,rr,www,var,"wcs");
+
+ coordToTclArray(ptr,rr,www,var,"wcs");
char* wcsname = (char*)sptr->getWCSName(www);
if (wcsname)
@@ -200,6 +201,7 @@ void Frame3dBase::getInfoWCS(char* var, Vector3d& rr, FitsImage* ptr,
}
}
+#ifndef NEWWCS
void Frame3dBase::coordToTclArray(FitsImage* ptr, const Vector3d& vv,
Coord::CoordSystem out,
const char* var, const char* base)
@@ -211,6 +213,17 @@ void Frame3dBase::coordToTclArray(FitsImage* ptr, const Vector3d& vv,
double ss = ptr->mapFromRef3axis(((Vector3d&)vv)[2],out,2);
doubleToTclArray(ss, var, base, "z");
}
+#else
+void Frame3dBase::coordToTclArray(FitsImage* ptr, const Vector3d& vv,
+ Coord::CoordSystem out,
+ const char* var, const char* base)
+{
+ Vector3d rr = ptr->mapFromRef(vv, out);
+ doubleToTclArray(rr[0], var, base, "x");
+ doubleToTclArray(rr[1], var, base, "y");
+ doubleToTclArray(rr[2], var, base, "z");
+}
+#endif
void Frame3dBase::calcBorder(Coord::InternalSystem sys, FrScale::SecMode mode,
Vector3d* vv, int* dd)