diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-12-05 17:46:26 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-12-05 17:46:26 (GMT) |
commit | 34060e4070460b3a7befaa3501ffe2f2d137f319 (patch) | |
tree | 5ff37a71d0a606ad12aa97ce497e0300097cff25 /tksao | |
parent | a7d4915dac528c4f61d2ca887459a59ae4695846 (diff) | |
download | blt-34060e4070460b3a7befaa3501ffe2f2d137f319.zip blt-34060e4070460b3a7befaa3501ffe2f2d137f319.tar.gz blt-34060e4070460b3a7befaa3501ffe2f2d137f319.tar.bz2 |
update AST WCS
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/grid25d.C | 44 | ||||
-rw-r--r-- | tksao/frame/grid2d.C | 6 | ||||
-rw-r--r-- | tksao/frame/grid3d.C | 3 | ||||
-rw-r--r-- | tksao/frame/grid3d.h | 2 |
4 files changed, 40 insertions, 15 deletions
diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index 3bce171..35e858a 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -54,15 +54,46 @@ int Grid25d::doit(RenderMode rm) frameSet = (AstFrameSet*)matrixMap(fits->refToDetector,"Domain=DETECTOR"); 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"); - // Get 2D SkyFrame - AstFrameSet* ast = (AstFrameSet*)astCopy(fits->getAST(system_)); +#ifndef NEWWCS fits->setWCSSkyFrame(ast, sky_); - +#else + fits->setWCSSystem(ast, system_); + fits->setWCSSkyFrame(ast, sky_); + + int naxes = astGetI(ast,"Naxes"); + switch (naxes) { + case 1: + // error + astEnd; // now, clean up memory + astGrid25dPtr =NULL; + return 0; + case 2: + break; + case 3: + case 4: + { + int pick[2] = {1, 2}; + AstMapping* map =NULL; + AstFrame* perm =NULL; + + astInvert(ast); + perm = (AstFrame*)astPickAxes(ast, 2, pick, &map); + astAddFrame(ast, AST__CURRENT, map, perm); + astInvert(ast); + + perm = (AstFrame*)astPickAxes(ast, 2, pick, &map); + astAddFrame(ast, AST__CURRENT, map, perm); + } + break; + } +#endif // Record the index of the current Frame int isky = astGetI(ast, "Current"); @@ -77,18 +108,13 @@ int Grid25d::doit(RenderMode rm) int idata = astGetI(ast, "Current"); astSetI(ast, "Current", isky); - // make the DATA Frame the new base Frame + // make the DATA Frame the new base Frame astSetI(ast, "Base", idata); frameSet = ast; } } - if (!frameSet) { - astEnd; - return 0; - } - astSet(frameSet,"Title=%s", " "); // create astPlot diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index 47ca600..38f688f 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -159,10 +159,8 @@ int Grid2d::doit(RenderMode rm) return 1; } -void* Grid2d::matrixMap(void* fs, Matrix& mx, const char* str) +void* Grid2d::matrixMap(void* frameSet, Matrix& mx, const char* str) { - AstFrameSet* frameSet = (AstFrameSet*)fs; - double ss[] = {mx.matrix(0,0),mx.matrix(1,0), mx.matrix(0,1),mx.matrix(1,1)}; double tt[] = {mx.matrix(2,0),mx.matrix(2,1)}; @@ -171,6 +169,6 @@ void* Grid2d::matrixMap(void* fs, Matrix& mx, const char* str) AstShiftMap* sm = astShiftMap(2, tt, ""); AstCmpMap* cmp = astCmpMap(mm, sm, 1, ""); - astAddFrame(frameSet, AST__CURRENT, cmp, astFrame(2, str)); + astAddFrame((AstFrameSet*)frameSet, AST__CURRENT, cmp, astFrame(2, str)); return frameSet; } diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C index 8a0039d..d3c966a 100644 --- a/tksao/frame/grid3d.C +++ b/tksao/frame/grid3d.C @@ -325,8 +325,8 @@ int Grid3d::doit(RenderMode rm) astEnd; // now, clean up memory astGrid3dPtr =NULL; - return 1; */ + return 1; } void* Grid3d::matrixMap(Matrix3d& mx, const char* str) @@ -359,6 +359,7 @@ void* Grid3d::matrixMap(Matrix3d& mx, const char* str) return frameSet; */ + return NULL; } #endif diff --git a/tksao/frame/grid3d.h b/tksao/frame/grid3d.h index 995132a..628794d 100644 --- a/tksao/frame/grid3d.h +++ b/tksao/frame/grid3d.h @@ -11,7 +11,7 @@ class Grid3d : public Grid, public Grid3dBase { private: - void* matrixMap(Matrix&, const char*); + void* matrixMap(Matrix3d&, const char*); int doit(RenderMode); public: |