diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-12-12 18:36:48 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-12-12 18:36:48 (GMT) |
commit | fef4f2b298e7cb32904129ea6044728a67ed2fe0 (patch) | |
tree | a4eed994454b9467e2b55837c1a66a6b1d3f9767 | |
parent | a5640dad083deca5300b21c823107fc106029421 (diff) | |
download | blt-fef4f2b298e7cb32904129ea6044728a67ed2fe0.zip blt-fef4f2b298e7cb32904129ea6044728a67ed2fe0.tar.gz blt-fef4f2b298e7cb32904129ea6044728a67ed2fe0.tar.bz2 |
upgrade AST
-rw-r--r-- | tksao/frame/base.C | 4 | ||||
-rw-r--r-- | tksao/frame/fitsimage.C | 52 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 25 | ||||
-rw-r--r-- | tksao/frame/fitsmap.C | 6 | ||||
-rw-r--r-- | tksao/frame/grid25d.C | 7 | ||||
-rw-r--r-- | tksao/frame/grid2d.C | 7 | ||||
-rw-r--r-- | tksao/frame/grid3d.C | 7 |
7 files changed, 55 insertions, 53 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index 39c98de..563b110 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -649,8 +649,8 @@ Matrix Base::calcAlignWCS(FitsImage* fits1, FitsImage* fits2, astClearStatus; // just to make sure astBegin; // start memory management - fits1->setWCSSystem(fits1->ast_, sys1); - fits2->setWCSSystem(fits2->ast_, sys2); + fits1->setWCSSystem(sys1); + fits2->setWCSSystem(sys2); AstFrameSet* wcs1 = (AstFrameSet*)astCopy(fits1->ast_); AstFrameSet* wcs2 = (AstFrameSet*)astCopy(fits2->ast_); diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index f3dab44..f7145c8 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -1625,10 +1625,10 @@ void FitsImage::match(const char* xxname1, const char* yyname1, // sanity check if (nxx1 != nyy1 || nxx2 != nyy2) return; - setWCSSystem(ast_, sys1); + setWCSSystem(sys1); if (!wcsIsASkyFrame(ast_)) return; - setWCSSystem(ast_, sys2); + setWCSSystem(sys2); if (!wcsIsASkyFrame(ast_)) return; @@ -1669,13 +1669,13 @@ void FitsImage::match(const char* xxname1, const char* yyname1, Vector* ptr1 =NULL; if (sky1 != sky2) { + setWCSSystem(sys1); + setWCSSkyFrame(ast_,sky1); AstFrameSet* wcs1 = (AstFrameSet*)astCopy(ast_); - setWCSSystem(wcs1, sys1); - setWCSSkyFrame(wcs1,sky1); + setWCSSystem(sys2); + setWCSSkyFrame(ast_,sky2); AstFrameSet* wcs2 = (AstFrameSet*)astCopy(ast_); - setWCSSystem(wcs2, sys2); - setWCSSkyFrame(wcs2,sky2); AstFrameSet* cvt = (AstFrameSet*)astConvert(wcs1, wcs2, "SKY"); if (cvt != AST__NULL) { @@ -1688,7 +1688,7 @@ void FitsImage::match(const char* xxname1, const char* yyname1, // now compare if (ptr1 && ptr2) { - setWCSSystem(ast_, sys2); + setWCSSystem(sys2); setWCSSkyFrame(ast_, sky2); Tcl_Obj* objrr = Tcl_NewListObj(0,NULL); for(int jj=0; jj<nxx2; jj++) { @@ -2961,14 +2961,14 @@ double FitsImage::getWCSPixelSize(Coord::CoordSystem sys) return 0; astClearStatus; // just to make sure - setWCSSystem(ast_, sys); + setWCSSystem(sys); Vector in[3]; Vector out[3]; in[0] = center(); in[1] = center()+Vector(1,0); in[2] = center()+Vector(0,1); - wcsTran(ast_, 3, in, 1, out); + wcsTran(3, in, 1, out); double dd = (wcsDistance(out[0],out[1]) + wcsDistance(out[0],out[2]))/2.; if (wcsIsASkyFrame(ast_)) @@ -2983,14 +2983,14 @@ double FitsImage::getWCSPixelArea(Coord::CoordSystem sys) return 0; astClearStatus; // just to make sure - setWCSSystem(ast_, sys); + setWCSSystem(sys); Vector in[3]; Vector out[3]; in[0] = center(); in[1] = center()+Vector(1,0); in[2] = center()+Vector(0,1); - wcsTran(ast_, 3, in, 1, out); + wcsTran(3, in, 1, out); double ll = wcsDistance(out[0], out[1]); double mm = wcsDistance(out[0], out[2]); @@ -3040,7 +3040,7 @@ Coord::Orientation FitsImage::getWCSOrientation(Coord::CoordSystem sys, return Coord::NORMAL; astClearStatus; // just to make sure - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); Vector in[3]; @@ -3048,7 +3048,7 @@ Coord::Orientation FitsImage::getWCSOrientation(Coord::CoordSystem sys, in[0] = center(); in[1] = center()+Vector(0,1); in[2] = center()+Vector(1,0); - wcsTran(ast_, 3, in, 1, out); + wcsTran(3, in, 1, out); double ang = wcsAngle(out[0],out[1],out[2]); Coord::Orientation rr = Coord::NORMAL; @@ -3093,14 +3093,14 @@ double FitsImage::getWCSRotation(Coord::CoordSystem sys, Coord::SkyFrame sky) return 0; astClearStatus; // just to make sure - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); Vector in[2]; Vector out[2]; in[0] = center(); in[1] = center()+Vector(0,1); - wcsTran(ast_, 2, in, 1, out); + wcsTran(2, in, 1, out); double ang = wcsAxAngle(out[0], out[1]); // { @@ -3164,7 +3164,7 @@ Vector FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, if (!hasWCS(sys)) return Vector(); - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); Vector out = wcsTran(in, 1); @@ -3243,7 +3243,7 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, if (!hasWCS(sys)) return lbuf; - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); ostringstream str; @@ -3301,7 +3301,7 @@ Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, if (!hasWCS(sys)) return Vector(); - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); Vector3d out = wcsTran(in, 1); @@ -3321,7 +3321,7 @@ char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, if (!hasWCS(sys)) return lbuf; - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); ostringstream str; @@ -3395,7 +3395,7 @@ Vector FitsImage::wcs2pix(const Vector& vv, Coord::CoordSystem sys, astClearStatus; // just to make sure if (hasWCS(sys)) { - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); Vector in = wcsIsASkyFrame(ast_) ? degToRad(vv) : vv; @@ -3414,7 +3414,7 @@ Vector3d FitsImage::wcs2pix(const Vector3d& vv, Coord::CoordSystem sys, astClearStatus; // just to make sure if (hasWCS(sys)) { - setWCSSystem(ast_,sys); + setWCSSystem(sys); setWCSSkyFrame(ast_,sky); Vector3d in = wcsIsASkyFrame(ast_) ? degToRad(vv) : vv; @@ -3449,7 +3449,7 @@ double FitsImage::getWCSDist(const Vector& vv1, const Vector& vv2, return 0; astClearStatus; // just to make sure - setWCSSystem(ast_,sys); + setWCSSystem(sys); return wcsIsASkyFrame(ast_) ? radToDeg(wcsDistance(degToRad(vv1), degToRad(vv2))) : @@ -3955,9 +3955,9 @@ void FitsImage::setWCSSkyFrame(AstFrameSet* ast, Coord::SkyFrame sky) } #ifdef NEWWCS -void FitsImage::setWCSSystem(AstFrameSet* ast, Coord::CoordSystem sys) +void FitsImage::setWCSSystem(Coord::CoordSystem sys) { - int nn = astGetI(ast,"nframe"); + int nn = astGetI(ast_,"nframe"); char cc = ' '; int ww = sys-Coord::WCS; switch (sys) { @@ -3974,9 +3974,9 @@ void FitsImage::setWCSSystem(AstFrameSet* ast, Coord::CoordSystem sys) } for (int ss=0; ss<nn; ss++) { - const char* id = astGetC(astGetFrame(ast,ss+1),"Ident"); + const char* id = astGetC(astGetFrame(ast_,ss+1),"Ident"); if (cc == id[0]) { - astSetI(ast,"Current",ss+1); + astSetI(ast_,"Current",ss+1); break; } } diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index b1c0724..4a7becc 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -418,30 +418,29 @@ class FitsImage { #ifndef NEWWCS Vector wcsTran(AstFrameSet*, const Vector&, int); + void wcsTran(AstFrameSet*, int, Vector*, int, Vector*); double wcsDistance(AstFrameSet*, const Vector&, const Vector&); + + AstFrameSet* getAST(Coord::CoordSystem sys) + {return (ast_ && ast_[sys-Coord::WCS]) ? ast_[sys-Coord::WCS] : NULL;} #else Vector wcsTran(const Vector&, int); - double wcsDistance(const Vector&, const Vector&); Vector3d wcsTran(const Vector3d&, int); + void wcsTran(int num, Vector* in, int forward, Vector* out) + {wcsTran(ast_,num,in,forward,out);} + void wcsTran(AstFrameSet*, int, Vector*, int, Vector*); + double wcsDistance(const Vector&, const Vector&); double wcsAngle(const Vector&, const Vector&, const Vector&); double wcsAxAngle(const Vector&, const Vector&); + + void setWCSSystem(Coord::CoordSystem); + AstFrameSet* getAST(Coord::CoordSystem sys) {return ast_;} #endif int wcsIsASkyFrame(AstFrameSet*); - void wcsTran(AstFrameSet*, int, Vector*, int, Vector*); - -#ifdef NEWWCS - void setWCSSystem(AstFrameSet*, Coord::CoordSystem); -#endif void setWCSSkyFrame(AstFrameSet*, Coord::SkyFrame); void setWCSFormat(AstFrameSet*, int, const char*); -#ifndef NEWWCS - AstFrameSet* getAST(Coord::CoordSystem sys) - {return (ast_ && ast_[sys-Coord::WCS]) ? ast_[sys-Coord::WCS] : NULL;} -#else - AstFrameSet* getAST(Coord::CoordSystem sys) {return ast_;} -#endif - + int hasWCS(Coord::CoordSystem); int hasWCSEqu(Coord::CoordSystem); int hasWCSCel(Coord::CoordSystem); diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C index 618cc98..f0e56e3 100644 --- a/tksao/frame/fitsmap.C +++ b/tksao/frame/fitsmap.C @@ -208,14 +208,14 @@ double FitsImage::mapLenFromRef(double dd, Coord::CoordSystem sys, if (!hasWCS(sys)) return 0; - setWCSSystem(ast_, sys); + setWCSSystem(sys); setWCSSkyFrame(ast_, Coord::FK5); Vector in[2]; Vector out[2]; in[0] = center(); in[1] = center()+Vector(0,dd); - wcsTran(ast_, 2, in, 1, out); + wcsTran(2, in, 1, out); double rr = wcsDistance(out[0], out[1]); if (wcsIsASkyFrame(ast_)) { @@ -310,7 +310,7 @@ double FitsImage::mapLenToRef(double dd, Coord::CoordSystem sys, return 0; astClearStatus; // just to make sure - setWCSSystem(ast_, sys); + setWCSSystem(sys); double rdd = dd; if (wcsIsASkyFrame(ast_)) { diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index eb051ca..456adcf 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -57,14 +57,15 @@ int Grid25d::doit(RenderMode rm) break; default: { - AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); // set desired skyformat #ifndef NEWWCS + AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); fits->setWCSSkyFrame(ast, sky_); #else - fits->setWCSSystem(ast, system_); - fits->setWCSSkyFrame(ast, sky_); + fits->setWCSSystem(system_); + fits->setWCSSkyFrame(fits->getAST(system_), sky_); + AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); int naxes = astGetI(ast,"Naxes"); switch (naxes) { diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index c12014a..d92b4d6 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -57,14 +57,15 @@ int Grid2d::doit(RenderMode rm) break; default: { - AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); // set desired skyformat #ifndef NEWWCS + AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); fits->setWCSSkyFrame(ast, sky_); #else - fits->setWCSSystem(ast, system_); - fits->setWCSSkyFrame(ast, sky_); + fits->setWCSSystem(system_); + fits->setWCSSkyFrame(fits->getAST(system_), sky_); + AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); int naxes = astGetI(ast,"Naxes"); switch (naxes) { diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C index 4436a01..52925da 100644 --- a/tksao/frame/grid3d.C +++ b/tksao/frame/grid3d.C @@ -80,10 +80,10 @@ int Grid3d::doit(RenderMode rm) break; default: { - AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); #ifndef NEWWCS foobar = fits; + AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); fits->setWCSSkyFrame(ast, sky_); AstFrame* zbase = astFrame(1,""); @@ -108,8 +108,9 @@ int Grid3d::doit(RenderMode rm) ast = astFrameSet(cmpwcsbase,""); astAddFrame(ast, AST__CURRENT, cmpwcsmap, cmpwcscurr); #else - fits->setWCSSystem(ast, system_); - fits->setWCSSkyFrame(ast, sky_); + fits->setWCSSystem(system_); + fits->setWCSSkyFrame(fits->getAST(system_), sky_); + AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); int naxes = astGetI(ast,"Naxes"); switch (naxes) { |