diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-11-11 18:16:16 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-11-11 18:16:16 (GMT) |
commit | 820c659dfe2953f0df73abf4a846166ec836f795 (patch) | |
tree | 6f5467e1e95045b3e2844a5a2dbe96b010d67a58 /tksao/frame | |
parent | 5eff139176cd891ec2ae000c292e0bdf35c3d710 (diff) | |
download | blt-820c659dfe2953f0df73abf4a846166ec836f795.zip blt-820c659dfe2953f0df73abf4a846166ec836f795.tar.gz blt-820c659dfe2953f0df73abf4a846166ec836f795.tar.bz2 |
update AST WCS
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/fitsimage.C | 42 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 1 |
2 files changed, 36 insertions, 7 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index b677935..724ab7a 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -3156,14 +3156,12 @@ Vector FitsImage::pix2wcs(Vector in, Coord::CoordSystem sys, setWCSSkyFrame(newast_,sky); maperr =0; - double xx =0; - double yy =0; - wcsTran(newast_, 1, in.v, in.v+1, 1, &xx, &yy); - if (astOK && checkWCS(xx,yy)) { + Vector out = wcsTran(newast_, in, 1); + if (astOK && checkWCS(out)) { if (wcsIsASkyFrame(newast_)) - return Vector(radToDeg(xx),yy*180./M_PI); + return out.radToDeg(); else - return Vector(xx,yy); + return out; } maperr =1; @@ -3937,7 +3935,6 @@ void FitsImage::setWCSSkyFrame(AstFrameSet* ast, Coord::SkyFrame sky) #ifdef NEWWCS void FitsImage::setWCSSystem(AstFrameSet* ast, Coord::CoordSystem sys) { - return; int nn = astGetI(ast,"nframe"); char cc = ' '; int ww = sys-Coord::WCS; @@ -4090,6 +4087,37 @@ void FitsImage::wcsTran(AstFrameSet* ast, int npoint, break; } } + +Vector FitsImage::wcsTran(AstFrameSet* ast, Vector& in, int forward) +{ + int naxes = astGetI(ast,"Naxes"); + switch (naxes) { + case 1: + // error + break; + case 2: + double xout, yout; + astTran2(ast, 1, in.v, in.v+1, forward, &xout, &yout); + return Vector(xout, yout); + case 3: + { + double pin[3]; + double pout[3]; + pin[0] = in[0]; + pin[1] = in[1]; + pin[2] = forward ? context_->slice(2) : 0; + astTranN(ast, 1, 3, 1, pin, forward, 1, 3, pout); + return Vector(pout[0],pout[1]); + } + break; + case 4: + { + } + break; + } + return Vector(); +} + #endif AstFrameSet* FitsImage::fits2ast(FitsHead* hd) diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index b0b260b..11a2ab8 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -405,6 +405,7 @@ class FitsImage { #else void wcsTran(AstFrameSet*, int, const double*, const double*, int, double*, double*); + Vector wcsTran(AstFrameSet*, Vector&, int); #endif #ifdef NEWWCS |