summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-08-30 16:57:20 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-08-30 16:57:20 (GMT)
commite3503d8d655bf4f6542a990050e2adcf50e9e7b3 (patch)
tree3218c836102dd5de4b0be4e240ebf11e810d7616 /tksao
parentb4c0e2c1103c06b7ee65f8c122c937fe18b68c2d (diff)
downloadblt-e3503d8d655bf4f6542a990050e2adcf50e9e7b3.zip
blt-e3503d8d655bf4f6542a990050e2adcf50e9e7b3.tar.gz
blt-e3503d8d655bf4f6542a990050e2adcf50e9e7b3.tar.bz2
handle non equatorial wcs correctly
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/base.C5
-rw-r--r--tksao/frame/base.h2
-rw-r--r--tksao/frame/basecommand.C5
-rw-r--r--tksao/frame/fitsimage.C31
-rw-r--r--tksao/frame/fitsimage.h4
-rw-r--r--tksao/frame/parser.C8
-rw-r--r--tksao/frame/parser.Y2
7 files changed, 49 insertions, 8 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C
index df69044..4079595 100644
--- a/tksao/frame/base.C
+++ b/tksao/frame/base.C
@@ -664,6 +664,11 @@ int Base::hasWCSCel(Coord::CoordSystem sys)
return currentContext->cfits && currentContext->cfits->hasWCSCel(sys);
}
+int Base::hasWCSEqu(Coord::CoordSystem sys)
+{
+ return currentContext->cfits && currentContext->cfits->hasWCSEqu(sys);
+}
+
int Base::hasWCSLinear(Coord::CoordSystem sys)
{
return currentContext->cfits && currentContext->cfits->hasWCSLinear(sys);
diff --git a/tksao/frame/base.h b/tksao/frame/base.h
index a2ba182..d47c7d3 100644
--- a/tksao/frame/base.h
+++ b/tksao/frame/base.h
@@ -367,6 +367,7 @@ public:
int hasLTMV();
int hasWCS(Coord::CoordSystem);
int hasWCSCel(Coord::CoordSystem);
+ int hasWCSEqu(Coord::CoordSystem);
int hasWCSLinear(Coord::CoordSystem);
int hasWCS3D(Coord::CoordSystem);
@@ -713,6 +714,7 @@ public:
void hasWCSAltCmd();
void hasWCSCmd(Coord::CoordSystem);
void hasWCSCelCmd(Coord::CoordSystem);
+ void hasWCSEquCmd(Coord::CoordSystem);
void hasWCSLinearCmd(Coord::CoordSystem);
void hasWCS3DCmd(Coord::CoordSystem);
diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C
index 807fac6..48ff38e 100644
--- a/tksao/frame/basecommand.C
+++ b/tksao/frame/basecommand.C
@@ -2391,6 +2391,11 @@ void Base::hasWCSCelCmd(Coord::CoordSystem sys)
Tcl_AppendResult(interp, (hasWCSCel(sys) ? "1" : "0"), NULL);
}
+void Base::hasWCSEquCmd(Coord::CoordSystem sys)
+{
+ Tcl_AppendResult(interp, (hasWCSEqu(sys) ? "1" : "0"), NULL);
+}
+
void Base::hasWCSLinearCmd(Coord::CoordSystem sys)
{
Tcl_AppendResult(interp, (hasWCSLinear(sys) ? "1" : "0"), NULL);
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index bf5a027..ced4303 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -86,9 +86,12 @@ FitsImage::FitsImage(Context* cx, Tcl_Interp* pp)
ast_ =NULL;
wcs_ =NULL;
wcsNaxes_ =NULL;
+
wcsCel_ =NULL;
+ wcsEqu_ =NULL;
wcsCelLon_ =NULL;
wcsCelLat_ =NULL;
+
wcsSize_ =NULL;
wcsHPX_ =0;
@@ -163,6 +166,8 @@ FitsImage::~FitsImage()
if (wcsCel_)
delete [] wcsCel_;
+ if (wcsEqu_)
+ delete [] wcsEqu_;
if (wcsCelLon_)
delete [] wcsCelLon_;
if (wcsCelLat_)
@@ -1055,6 +1060,9 @@ void FitsImage::initWCS(FitsHead* hd)
if (wcsCel_)
delete [] wcsCel_;
wcsCel_ =NULL;
+ if (wcsEqu_)
+ delete [] wcsEqu_;
+ wcsEqu_ =NULL;
if (wcsCelLon_)
delete [] wcsCelLon_;
wcsCelLon_ =NULL;
@@ -1087,8 +1095,10 @@ void FitsImage::initWCS(FitsHead* hd)
wcsNaxes_ = ptr->wcsNaxes_;
wcsCel_ = ptr->wcsCel_;
+ wcsEqu_ = ptr->wcsEqu_;
wcsCelLon_ = ptr->wcsCelLon_;
wcsCelLat_ = ptr->wcsCelLat_;
+
wcsSize_ = ptr->wcsSize_;
wcsHPX_ = ptr->wcsHPX_;
@@ -2949,6 +2959,14 @@ int FitsImage::hasWCSCel(Coord::CoordSystem sys)
return wcsCel_[sys-Coord::WCS];
}
+int FitsImage::hasWCSEqu(Coord::CoordSystem sys)
+{
+ if (!wcsEqu_ || sys<Coord::WCS)
+ return 0;
+ else
+ return wcsEqu_[sys-Coord::WCS];
+}
+
int FitsImage::hasWCSLinear(Coord::CoordSystem sys)
{
if (!wcs_ || !wcsCel_ || sys<Coord::WCS)
@@ -2980,6 +2998,9 @@ void FitsImage::scanWCS(FitsHead* hd)
wcsCel_ = new int[MULTWCS];
for (int ii=0; ii<MULTWCS; ii++)
wcsCel_[ii] =0;
+ wcsEqu_ = new int[MULTWCS];
+ for (int ii=0; ii<MULTWCS; ii++)
+ wcsEqu_[ii] =0;
wcsCelLon_ = new int[MULTWCS];
for (int ii=0; ii<MULTWCS; ii++)
wcsCelLon_[ii] =0;
@@ -3030,11 +3051,15 @@ void FitsImage::scanWCS(FitsHead* hd)
ii = (*id == ' ') ? 0 : *id-'@';
AstFrameSet* fs =
(AstFrameSet*)astFindFrame(ff, astSkyFrame(" MaxAxes=4")," ");
+
if (fs) {
wcsCel_[ii] =1;
- const char* str = astGetC(ff, "System");
- if (str && *str) {
- // cerr << "System: " << str << endl;
+ const char* sys = astGetC(ff, "System");
+ if (sys && *sys) {
+ // cerr << "System: " << sys << endl;
+ if (strncmp(sys,"Unknown",7))
+ wcsEqu_[ii] =1;
+
for (int jj=0; jj<wcsNaxes_[ii]; jj++) {
ostringstream str;
str << "Symbol(" << jj+1 << ")" << ends;
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index 2423e87..ee5a4be 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -112,9 +112,12 @@ class FitsImage {
int* wcs_;
int* wcsNaxes_;
+
int* wcsCel_;
+ int* wcsEqu_;
int* wcsCelLon_;
int* wcsCelLat_;
+
double* wcsSize_;
WCSState* wcsState_;
@@ -427,6 +430,7 @@ class FitsImage {
int hasWCS(Coord::CoordSystem);
int hasWCSCel(Coord::CoordSystem);
+ int hasWCSEqu(Coord::CoordSystem);
int hasWCSLinear(Coord::CoordSystem);
int hasWCS3D(Coord::CoordSystem);
int hasWCSHPX() {return wcsHPX_;}
diff --git a/tksao/frame/parser.C b/tksao/frame/parser.C
index 45c8e99..33fc869 100644
--- a/tksao/frame/parser.C
+++ b/tksao/frame/parser.C
@@ -1437,8 +1437,8 @@ static const yytype_int16 yyrhs[] =
-1, 182, 460, -1, 218, -1, 156, -1, 268, -1,
278, 360, -1, 307, 461, -1, 72, 5, -1, -1,
31, -1, -1, 44, -1, 87, -1, 191, -1, 149,
- -1, 255, -1, 215, -1, 293, -1, 360, -1, 115,
- 360, -1, 58, 360, -1, 172, 360, -1, 18, -1,
+ -1, 255, -1, 215, -1, 293, -1, 360, -1, 58,
+ 360, -1, 115, 360, -1, 172, 360, -1, 18, -1,
284, 360, -1, 199, 4, 4, -1, 116, -1, 184,
5, -1, 88, 464, -1, 256, 120, 195, 463, -1,
256, 6, 4, 4, 4, 4, -1, 297, -1, 307,
@@ -2384,7 +2384,7 @@ static const yytype_uint16 yydefact[] =
0, 0, 0, 0, 925, 927, 926, 0, 1019, 0,
998, 0, 1001, 0, 0, 1021, 1023, 0, 1014, 344,
0, 474, 476, 486, 479, 488, 480, 490, 481, 492,
- 478, 0, 0, 497, 494, 495, 150, 521, 534, 533,
+ 478, 0, 0, 497, 494, 495, 150, 521, 533, 534,
535, 537, 0, 550, 538, 0, 0, 0, 0, 0,
0, 163, 163, 157, 0, 0, 0, 0, 0, 0,
0, 0, 0, 160, 160, 157, 0, 0, 157, 0,
@@ -7251,7 +7251,7 @@ yyreduce:
case 534:
#line 1341 "frame/parser.Y"
- {fr->hasWCSCelCmd((Coord::CoordSystem)(yyvsp[(2) - (2)].integer));;}
+ {fr->hasWCSEquCmd((Coord::CoordSystem)(yyvsp[(2) - (2)].integer));;}
break;
case 535:
diff --git a/tksao/frame/parser.Y b/tksao/frame/parser.Y
index fb6c739..8c22392 100644
--- a/tksao/frame/parser.Y
+++ b/tksao/frame/parser.Y
@@ -1337,8 +1337,8 @@ hasMarker : HIGHLITE_ {fr->hasMarkerHighlitedCmd();}
;
hasWCS : coordSystem {fr->hasWCSCmd((Coord::CoordSystem)$1);}
- | EQUATORIAL_ coordSystem {fr->hasWCSCelCmd((Coord::CoordSystem)$2);}
| CELESTIAL_ coordSystem {fr->hasWCSCelCmd((Coord::CoordSystem)$2);}
+ | EQUATORIAL_ coordSystem {fr->hasWCSEquCmd((Coord::CoordSystem)$2);}
| LINEAR_ coordSystem {fr->hasWCSLinearCmd((Coord::CoordSystem)$2);}
| ALT_ {fr->hasWCSAltCmd();}
| THREED_ coordSystem {fr->hasWCS3DCmd((Coord::CoordSystem)$2);}