diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-30 17:14:37 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-30 17:14:37 (GMT) |
commit | a5a9e8ee91b713326d270ae2582b7bbf39874b62 (patch) | |
tree | b18591b0adfc09442dd5ee766a0bc171fcd32454 /tksao | |
parent | e3503d8d655bf4f6542a990050e2adcf50e9e7b3 (diff) | |
download | blt-a5a9e8ee91b713326d270ae2582b7bbf39874b62.zip blt-a5a9e8ee91b713326d270ae2582b7bbf39874b62.tar.gz blt-a5a9e8ee91b713326d270ae2582b7bbf39874b62.tar.bz2 |
handle non equatorial wcs correctly
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/base.C | 6 | ||||
-rw-r--r-- | tksao/frame/fitsimage.C | 47 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 2 | ||||
-rw-r--r-- | tksao/frame/grid25d.C | 3 | ||||
-rw-r--r-- | tksao/frame/grid2d.C | 3 | ||||
-rw-r--r-- | tksao/frame/grid3d.C | 3 |
6 files changed, 35 insertions, 29 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index 4079595..766bbe6 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -390,12 +390,14 @@ Matrix Base::calcAlignWCS(FitsImage* fits1, FitsImage* fits2, AstFrameSet* wcs1 = (AstFrameSet*)astCopy(fits1->ast_); wcsSystem(wcs1,sys1); - wcsSkyFrame(wcs1,sky); + if (fits1->hasWCSEqu(sys1)) + wcsSkyFrame(wcs1,sky); astInvert(wcs1); AstFrameSet* wcs2 = (AstFrameSet*)astCopy(fits2->ast_); wcsSystem(wcs2,sys2); - wcsSkyFrame(wcs2,sky); + if (fits1->hasWCSEqu(sys2)) + wcsSkyFrame(wcs2,sky); astInvert(wcs2); AstFrameSet* cvt = (AstFrameSet*)astConvert(wcs2, wcs1, ""); diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index ced4303..4fefa20 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -1141,7 +1141,8 @@ void FitsImage::initWCS(FitsHead* hd) astBegin; wcsSystem(ast_,wcsState_->wcsSystem_); - wcsSkyFrame(ast_,wcsState_->wcsSkyFrame_); + if (hasWCSEqu(wcsState_->wcsSystem_)) + wcsSkyFrame(ast_,wcsState_->wcsSkyFrame_); astEnd; // must wait until wcsState_ is realized @@ -1365,11 +1366,13 @@ void FitsImage::match(const char* xxname1, const char* yyname1, if (sky1 != sky2) { AstFrameSet* wcs1 = (AstFrameSet*)astCopy(ast_); wcsSystem(wcs1,sys1); - wcsSkyFrame(wcs1,sky1); + if (hasWCSEqu(sys1)) + wcsSkyFrame(wcs1,sky1); AstFrameSet* wcs2 = (AstFrameSet*)astCopy(ast_); wcsSystem(wcs2,sys2); - wcsSkyFrame(wcs2,sky2); + if (hasWCSEqu(sys2)) + wcsSkyFrame(wcs2,sky2); AstFrameSet* cvt = (AstFrameSet*)astConvert(wcs1, wcs2, "SKY"); if (cvt != AST__NULL) { @@ -1384,7 +1387,8 @@ void FitsImage::match(const char* xxname1, const char* yyname1, if (ptr1 && ptr2) { AstFrameSet* wcs = (AstFrameSet*)astCopy(ast_); wcsSystem(wcs,sys2); - wcsSkyFrame(wcs,sky2); + if (hasWCSEqu(sys2)) + wcsSkyFrame(wcs,sky2); Tcl_Obj* objrr = Tcl_NewListObj(0,NULL); for(int jj=0; jj<nxx2; jj++) { @@ -2648,8 +2652,7 @@ Coord::Orientation FitsImage::getWCSOrientation(Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector in[3]; Vector out[3]; @@ -2679,8 +2682,7 @@ double FitsImage::getWCSRotation(Coord::CoordSystem sys, Coord::SkyFrame sky) astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); if (!wcsHPX_) { Vector in[3]; @@ -2800,8 +2802,7 @@ Vector FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector out = wcsTran(ast_, in, 1); if (!astOK || !checkWCS(out)) @@ -2822,8 +2823,7 @@ VectorStr FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector out = wcsTran(ast_, in, 1); if (!astOK || !checkWCS(out)) @@ -2845,8 +2845,7 @@ Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector3d out = wcsTran(ast_, in, 1); if (!astOK || !checkWCS(out)) @@ -2866,8 +2865,7 @@ VectorStr3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector3d out = wcsTran(ast_, in, 1); if (!astOK || !checkWCS(out)) @@ -2907,8 +2905,7 @@ Vector FitsImage::wcs2pix(const Vector& vv, Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector in = vDegToRad(vv,sys); Vector out = wcsTran(ast_, in, 0); @@ -2931,8 +2928,7 @@ Vector3d FitsImage::wcs2pix(const Vector3d& vv, Coord::CoordSystem sys, astClearStatus; // just to make sure astBegin; // start memory management - setWCSSystem(sys); - setWCSSkyFrame(sky); + setWCSSysSkyFrame(sys,sky); Vector3d in = vDegToRad(vv,sys); Vector3d out = wcsTran(ast_, in, 0); @@ -3151,11 +3147,16 @@ void FitsImage::setWCSSystem(Coord::CoordSystem sys) wcsState_->wcsSystem_ = sys; } -void FitsImage::setWCSSkyFrame(Coord::SkyFrame sky) +void FitsImage::setWCSSysSkyFrame(Coord::CoordSystem sys, Coord::SkyFrame sky) { + if (wcsState_->wcsSystem_ != sys) + if (wcsSystem(ast_,sys)) + wcsState_->wcsSystem_ = sys; + if (wcsState_->wcsSkyFrame_ != sky) - if (wcsSkyFrame(ast_,sky)) - wcsState_->wcsSkyFrame_ = sky; + if (hasWCSEqu(sys)) + if (wcsSkyFrame(ast_,sky)) + wcsState_->wcsSkyFrame_ = sky; } void FitsImage::setWCSFormat(Coord::CoordSystem sys, Coord::SkyFrame sky, diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index ee5a4be..8b34631 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -163,7 +163,7 @@ class FitsImage { Vector mapLen(const Vector& v, const Matrix& mx); void setWCSSystem(Coord::CoordSystem); - void setWCSSkyFrame(Coord::SkyFrame); + void setWCSSysSkyFrame(Coord::CoordSystem, Coord::SkyFrame); void setWCSFormat(Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat); Vector vRadToDeg(const Vector& vv, Coord::CoordSystem sys); diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index 0fa8a2d..e863490 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -62,7 +62,8 @@ int Grid25d::doit(RenderMode rm) AstFrameSet* ast = (AstFrameSet*)astCopy(fits->ast_); wcsSystem(ast,system_); - wcsSkyFrame(ast,sky_); + if (fits->hasWCSEqu(system_)) + wcsSkyFrame(ast,sky_); int naxes = astGetI(ast,"Naxes"); switch (naxes) { diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index e6c4d02..923a2d1 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -63,7 +63,8 @@ int Grid2d::doit(RenderMode rm) AstFrameSet* ast = (AstFrameSet*)astCopy(fits->ast_); wcsSystem(ast,system_); - wcsSkyFrame(ast,sky_); + if (fits->hasWCSEqu(system_)) + wcsSkyFrame(ast,sky_); int naxes = astGetI(ast,"Naxes"); switch (naxes) { diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C index 7443f5c..31440cf 100644 --- a/tksao/frame/grid3d.C +++ b/tksao/frame/grid3d.C @@ -63,7 +63,8 @@ int Grid3d::doit(RenderMode rm) AstFrameSet* ast = (AstFrameSet*)astCopy(fits->ast_); wcsSystem(ast,system_); - wcsSkyFrame(ast,sky_); + if (fits->hasWCSEqu(system_)) + wcsSkyFrame(ast,sky_); int naxes = astGetI(ast,"Naxes"); switch (naxes) { |