diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-12-05 18:20:43 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-12-05 18:20:43 (GMT) |
commit | 0eb19159c0786ed528d9eab43b56025da1770dbb (patch) | |
tree | 4c21cd9c68fe24df568acfebeb29f494cda257e9 /tksao | |
parent | 34060e4070460b3a7befaa3501ffe2f2d137f319 (diff) | |
download | blt-0eb19159c0786ed528d9eab43b56025da1770dbb.zip blt-0eb19159c0786ed528d9eab43b56025da1770dbb.tar.gz blt-0eb19159c0786ed528d9eab43b56025da1770dbb.tar.bz2 |
update AST WCS
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/grid25d.C | 55 | ||||
-rw-r--r-- | tksao/frame/grid25d.h | 2 | ||||
-rw-r--r-- | tksao/frame/grid2d.C | 19 | ||||
-rw-r--r-- | tksao/frame/grid2d.h | 2 |
4 files changed, 25 insertions, 53 deletions
diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index 35e858a..a495ef4 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -39,28 +39,27 @@ int Grid25d::doit(RenderMode rm) astClearStatus; // just to make sure astBegin; // start memory management - AstFrameSet* frameSet = NULL; + // map from Ref to Image + AstFrameSet* frameSet = astFrameSet(astFrame(2,"Domain=Ref"),""); + matrixMap(frameSet,fits->refToImage,"Domain=IMAGE"); + switch (system_) { case Coord::IMAGE: - frameSet = (AstFrameSet*)matrixMap(fits->refToImage,"Domain=IMAGE"); break; case Coord::PHYSICAL: - frameSet = (AstFrameSet*)matrixMap(fits->refToPhysical,"Domain=PHYSICAL"); + matrixMap(frameSet,fits->imageToPhysical,"Domain=PHYSICAL"); break; case Coord::AMPLIFIER: - frameSet = (AstFrameSet*)matrixMap(fits->refToAmplifier,"Domain=AMPLIFIER"); + matrixMap(frameSet,fits->imageToAmplifier,"Domain=AMPLIFIER"); break; case Coord::DETECTOR: - frameSet = (AstFrameSet*)matrixMap(fits->refToDetector,"Domain=DETECTOR"); + matrixMap(frameSet,fits->imageToDetector,"Domain=DETECTOR"); + break; default: { AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); - // imageToData frame/map - double ss[] = {-.5, -.5}; - AstShiftMap *sm = astShiftMap(2, ss, " "); - AstFrame *df = astFrame(2, "Domain=DATA"); - + // set desired skyformat #ifndef NEWWCS fits->setWCSSkyFrame(ast, sky_); #else @@ -94,25 +93,13 @@ int Grid25d::doit(RenderMode rm) break; } #endif - // Record the index of the current Frame - int isky = astGetI(ast, "Current"); - - // Add the new DATA Frame into the FrameSet, using the ShiftMap to - // connect it to the existing IMAGE Frame. - astAddFrame(ast, AST__BASE, sm, df); - - // The above call to astAddFrame will have changed the current Frame - // in the FrameSet to be the new DATA Frame. First record the index of - // the DATA Frame, and then re-instate the original current Frame (i.e. - // the SKY Frame). - int idata = astGetI(ast, "Current"); - astSetI(ast, "Current", isky); - - // make the DATA Frame the new base Frame - astSetI(ast, "Base", idata); - - frameSet = ast; + // add wcs to frameset + // this will link frameset to wcs with unitMap + astInvert(ast); + astAddFrame(frameSet, AST__CURRENT, astUnitMap(2,""), ast); + astSetI(frameSet,"Current",astGetI(frameSet,"nframe")); } + break; } astSet(frameSet,"Title=%s", " "); @@ -143,7 +130,7 @@ int Grid25d::doit(RenderMode rm) return 1; } -void* Grid25d::matrixMap(Matrix& mx, const char* str) +void Grid25d::matrixMap(void* frameSet, Matrix& mx, const char* str) { double ss[] = {mx.matrix(0,0),mx.matrix(1,0), mx.matrix(0,1),mx.matrix(1,1)}; @@ -151,13 +138,7 @@ void* Grid25d::matrixMap(Matrix& mx, const char* str) AstMatrixMap* mm = astMatrixMap(2, 2, 0, ss, ""); AstShiftMap* sm = astShiftMap(2, tt, ""); - AstCmpMap* cmap = astCmpMap(mm, sm, 1, ""); - - AstFrame* in = astFrame(2,"Domain=REF"); - AstFrame* out = astFrame(2,str); - - AstFrameSet* frameSet = astFrameSet(in,""); - astAddFrame(frameSet,AST__CURRENT,cmap,out); + AstCmpMap* cmp = astCmpMap(mm, sm, 1, ""); - return frameSet; + astAddFrame((AstFrameSet*)frameSet, AST__CURRENT, cmp, astFrame(2, str)); } diff --git a/tksao/frame/grid25d.h b/tksao/frame/grid25d.h index a4e09cc..bbc2fb9 100644 --- a/tksao/frame/grid25d.h +++ b/tksao/frame/grid25d.h @@ -11,7 +11,7 @@ class Grid25d : public Grid, public Grid25dBase { private: - void* matrixMap(Matrix&, const char*); + void matrixMap(void*, Matrix&, const char*); int doit(RenderMode); public: diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index 38f688f..83b5d65 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -39,9 +39,8 @@ int Grid2d::doit(RenderMode rm) astClearStatus; // just to make sure astBegin; // start memory management - AstFrameSet* frameSet = astFrameSet(astFrame(2,"Domain=WIDGET"),""); - // map from Widget to Image + AstFrameSet* frameSet = astFrameSet(astFrame(2,"Domain=WIDGET"),""); matrixMap(frameSet,fits->widgetToImage,"Domain=IMAGE"); switch (system_) { @@ -60,16 +59,9 @@ int Grid2d::doit(RenderMode rm) { AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); -#ifndef NEWWCS // set desired skyformat +#ifndef NEWWCS fits->setWCSSkyFrame(ast, sky_); - - // add wcs to frameset - // this will link frame 2 of frameset to frame 3 wcs with unitMap - // set the current of frameset to last - astInvert(ast); - astAddFrame(frameSet,2,astUnitMap(2,""),ast); - astSetI(frameSet,"current",astGetI(frameSet,"nframe")); #else fits->setWCSSystem(ast, system_); fits->setWCSSkyFrame(ast, sky_); @@ -100,14 +92,14 @@ int Grid2d::doit(RenderMode rm) } break; } - +#endif // add wcs to frameset // this will link frameset to wcs with unitMap astInvert(ast); astAddFrame(frameSet, AST__CURRENT, astUnitMap(2,""), ast); astSetI(frameSet,"Current",astGetI(frameSet,"nframe")); -#endif } + break; } astSet(frameSet,"Title=%s", " "); @@ -159,7 +151,7 @@ int Grid2d::doit(RenderMode rm) return 1; } -void* Grid2d::matrixMap(void* frameSet, Matrix& mx, const char* str) +void Grid2d::matrixMap(void* frameSet, Matrix& mx, const char* str) { double ss[] = {mx.matrix(0,0),mx.matrix(1,0), mx.matrix(0,1),mx.matrix(1,1)}; @@ -170,5 +162,4 @@ void* Grid2d::matrixMap(void* frameSet, Matrix& mx, const char* str) AstCmpMap* cmp = astCmpMap(mm, sm, 1, ""); astAddFrame((AstFrameSet*)frameSet, AST__CURRENT, cmp, astFrame(2, str)); - return frameSet; } diff --git a/tksao/frame/grid2d.h b/tksao/frame/grid2d.h index 95d351a..b9546a6 100644 --- a/tksao/frame/grid2d.h +++ b/tksao/frame/grid2d.h @@ -11,7 +11,7 @@ class Grid2d : public Grid, public Grid2dBase { private: - void* matrixMap(void*, Matrix&, const char*); + void matrixMap(void*, Matrix&, const char*); int doit(RenderMode); public: |