From 3325fa297dd7950589cf0b396eefc1ec18f8d6bb Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 9 Aug 2018 15:56:06 -0400 Subject: simplify wcs code --- ds9/library/coord.tcl | 34 ++-- ds9/library/info.tcl | 51 +++--- tksao/frame/basecommand.C | 6 +- tksao/frame/fitsimage.C | 432 +++++++++++++++++----------------------------- tksao/frame/fitsimage.h | 15 +- tksao/frame/frame3dbase.C | 40 +++-- tksao/frame/framebase.C | 27 +-- tksao/frame/grid25d.C | 2 +- tksao/frame/grid2d.C | 2 +- tksao/frame/grid3d.C | 2 +- 10 files changed, 246 insertions(+), 365 deletions(-) diff --git a/ds9/library/coord.tcl b/ds9/library/coord.tcl index 7e569c9..2d40cc0 100644 --- a/ds9/library/coord.tcl +++ b/ds9/library/coord.tcl @@ -108,51 +108,49 @@ proc DisplayCoordDialog {which x y} { global pcoord global wcs - set r {} + set rr {} if {$pcoord(filename)} { - append r "[$which get fits file name full]" + append rr "[$which get fits file name full]" } - foreach l {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} { - if {"$pcoord(wcs$l)" && [$which has wcs "wcs$l"]} { - set cd "[$which get coordinates $x $y wcs$l $wcs(sky) $wcs(skyformat)]" - puts ":$cd:" - - if {[$which has wcs celestial "wcs$l"]} { - append r " [lindex $cd 0] [lindex $cd 1] $wcs(sky)" + foreach ll {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} { + if {"$pcoord(wcs$ll)" && [$which has wcs "wcs$ll"]} { + append rr " [$which get coordinates $x $y wcs$ll $wcs(sky) $wcs(skyformat)]" + if {[$which has wcs celestial "wcs$ll"]} { + append rr " $wcs(sky)" } else { - set name [$which get wcs name "wcs$l"] + set name [$which get wcs name "wcs$ll"] if {$name != {}} { - append r " [lindex $cd 0] [lindex $cd 1] $name" + append rr " $name" } else { - append r " [lindex $cd 0] [lindex $cd 1] [lindex $cd 3]" + append rr " wcs$ll" } } } } if {$pcoord(detector) && [$which has detector]} { - append r " [$which get coordinates $x $y detector] detector" + append rr " [$which get coordinates $x $y detector] detector" } if {$pcoord(amplifier) && [$which has amplifier]} { - append r " [$which get coordinates $x $y amplifier] amplifier" + append rr " [$which get coordinates $x $y amplifier] amplifier" } if {$pcoord(physical) && [$which has physical]} { - append r " [$which get coordinates $x $y physical] physical" + append rr " [$which get coordinates $x $y physical] physical" } if {$pcoord(image)} { - append r " [$which get coordinates $x $y image]" + append rr " [$which get coordinates $x $y image]" } if {$pcoord(value)} { - append r " [$which get value canvas $x $y]" + append rr " [$which get value canvas $x $y]" } - append r " \n" + append rr " \n" SimpleTextDialog coordtxt [msgcat::mc {Coordinates}] \ 80 20 append bottom "$r" diff --git a/ds9/library/info.tcl b/ds9/library/info.tcl index d44686a..405b13e 100644 --- a/ds9/library/info.tcl +++ b/ds9/library/info.tcl @@ -536,6 +536,7 @@ proc UpdateInfoBox {which x y sys} { global view $which get info $sys $x $y infobox + set infobox(bunit) [$which get fits header keyword BUNIT] if {$view(info,keyvalue) != ""} { set infobox(keyvalue) \ @@ -553,41 +554,37 @@ proc UpdateInfoBox {which x y sys} { foreach ll {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} { if {$view(info,wcs$ll)} { - if {![$which has fits]} { - set infobox(wcs$ll,sys) "WCS $ll" - $infobox(wcs$ll,x,nm) configure -text {} - $infobox(wcs$ll,y,nm) configure -text {} - } elseif {[$which has wcs celestial wcs$ll]} { - switch -- $infobox(wcs$ll,sys) { - fk4 - - fk5 - - icrs { - $infobox(wcs$ll,x,nm) configure -text "\u03b1" \ + foreach aa {x y z} { + switch $infobox(wcs$ll,$aa,sys) { + RA { + $infobox(wcs$ll,$aa,nm) configure -text "\u03b1" \ -font "$ds9(times) $fsz" - $infobox(wcs$ll,y,nm) configure -text "\u03b4" \ + } + Dec { + $infobox(wcs$ll,$aa,nm) configure -text "\u03b4" \ -font "$ds9(times) $fsz" } - galactic { - $infobox(wcs$ll,x,nm) configure -text {l} \ - -font "{$ds9(times)} $pds9(font,size) normal italic" - $infobox(wcs$ll,y,nm) configure -text {b} \ - -font "{$ds9(times)} $pds9(font,size) normal italic" + l { + $infobox(wcs$ll,$aa,nm) configure -text {l} -font \ + "{$ds9(times)} $pds9(font,size) normal italic" + } + b { + $infobox(wcs$ll,$aa,nm) configure -text {b} -font \ + "{$ds9(times)} $pds9(font,size) normal italic" } - ecliptic { - $infobox(wcs$ll,x,nm) configure -text "\u03bb" \ + Lambda { + $infobox(wcs$ll,$aa,nm) configure -text "\u03bb" \ -font "$ds9(times) $fsz" - $infobox(wcs$ll,y,nm) configure -text "\u03b2" \ + } + Beta { + $infobox(wcs$ll,$aa,nm) configure -text "\u03b2" \ -font "$ds9(times) $fsz" } + default { + $infobox(wcs$ll,$aa,nm) configure \ + -text [string range $infobox(wcs$ll,$aa,sys) 0 0] + } } - } else { - if {$infobox(wcs$ll,sys) == {}} { - set infobox(wcs$ll,sys) "WCS $ll" - } - $infobox(wcs$ll,x,nm) configure -text {x} \ - -font "{$ds9(times)} $pds9(font,size) normal italic" - $infobox(wcs$ll,y,nm) configure -text {y} \ - -font "{$ds9(times)} $pds9(font,size) normal italic" } } } diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C index 12fdf17..4233057 100644 --- a/tksao/frame/basecommand.C +++ b/tksao/frame/basecommand.C @@ -2126,9 +2126,9 @@ void Base::getWCSAlignPointerCmd() void Base::getWCSNameCmd(Coord::CoordSystem sys) { if (currentContext->cfits && currentContext->cfits->hasWCS(sys)) { - char* wcsname = (char*)currentContext->cfits->getWCSName(sys); - if (wcsname) { - Tcl_AppendResult(interp, wcsname, NULL); + char* name = (char*)currentContext->cfits->getWCSName(sys); + if (name) { + Tcl_AppendResult(interp, name, NULL); return; } } diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 8c6c5f8..b360a75 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -78,15 +78,16 @@ FitsImage::FitsImage(Context* cx, Tcl_Interp* pp) manageWCS_ =1; ast_ =NULL; - astInv_ =0; wcs_ =NULL; + wcsNaxes_ =NULL; wcsCel_ =NULL; wcsCelLon_ =NULL; wcsCelLat_ =NULL; - wcs3D_ =NULL; - wcsHPX_ =0; wcsSize_ =NULL; + wcsHPX_ =0; + wcsInv_ =1; + wcsAltHeader_ =NULL; wfpc2Header_ =NULL; wcs0Header_ =NULL; @@ -146,16 +147,19 @@ FitsImage::~FitsImage() if (manageWCS_) { if (ast_) astAnnul(ast_); + if (wcs_) delete [] wcs_; + if (wcsNaxes_) + delete [] wcsNaxes_; + if (wcsCel_) delete [] wcsCel_; if (wcsCelLon_) delete [] wcsCelLon_; if (wcsCelLat_) delete [] wcsCelLat_; - if (wcs3D_) - delete [] wcs3D_; + if (wcsSize_) delete [] wcsSize_; } @@ -1028,12 +1032,17 @@ void FitsImage::initWCS(FitsHead* hd) if (ast_) astAnnul(ast_); ast_ =NULL; + if (wcs_) delete [] wcs_; wcs_ =NULL; if (wcs_) delete [] wcs_; wcs_ =NULL; + if (wcsNaxes_) + delete [] wcsNaxes_; + wcsNaxes_ =NULL; + if (wcsCel_) delete [] wcsCel_; wcsCel_ =NULL; @@ -1043,13 +1052,13 @@ void FitsImage::initWCS(FitsHead* hd) if (wcsCelLat_) delete [] wcsCelLat_; wcsCelLat_ =NULL; - if (wcs3D_) - delete [] wcs3D_; - wcs3D_ =NULL; - wcsHPX_ = 0; + if (wcsSize_) delete [] wcsSize_; wcsSize_ =NULL; + + wcsHPX_ = 0; + wcsInv_ = 1; } // shareWCS? @@ -1064,16 +1073,19 @@ void FitsImage::initWCS(FitsHead* hd) while (sptr) { if (sptr == this) { ast_ = ptr->ast_; - astInv_ = ptr->astInv_; + wcs_ = ptr->wcs_; + wcsNaxes_ = ptr->wcsNaxes_; + wcsCel_ = ptr->wcsCel_; wcsCelLon_ = ptr->wcsCelLon_; wcsCelLat_ = ptr->wcsCelLat_; - wcs3D_ = ptr->wcs3D_; - wcsHPX_ = ptr->wcsHPX_; wcsSize_ = ptr->wcsSize_; - initWCSPhysical(); + wcsHPX_ = ptr->wcsHPX_; + wcsInv_ = ptr->wcsInv_; + + wcsPhyInit(); manageWCS_ =0; return; } @@ -1085,14 +1097,27 @@ void FitsImage::initWCS(FitsHead* hd) int hasWCSAST = hd->find("BEGAST_A") ? 1 : 0; - astInit(hd); + if (ast_) + astAnnul(ast_); + ast_ =NULL; + + ast_ = fits2ast(hd); + if (!ast_) + return; + + // special case + if (astGetI(ast_,"Naxes") == 2 && + astIsASkyFrame(astGetFrame(ast_,AST__CURRENT)) && + astGetI(ast_,"LatAxis") == 1) { + int orr[] = {2,1}; + astPermAxes(ast_,orr); + } + wcsInit(hasWCSAST); wcsCelInit(hasWCSAST); - wcs3DInit(hasWCSAST); wcsHPXInit(); wcsSizeInit(); - - initWCSPhysical(); + wcsPhyInit(); if (DebugWCS && ast_) astShow(ast_); @@ -1171,43 +1196,6 @@ void FitsImage::initWCS0(const Vector& pix) initWCS(wcs0Header_); } -void FitsImage::initWCSPhysical() -{ - // now see if we have a 'physical' in WCSP, if so, set LTMV keywords - keyLTMV =0; - - char* wcsname = image_->getString("WCSNAMEP"); - if (wcsname && *wcsname && !strncmp(wcsname, "PHYSICAL", 8)) { - if (image_->find("CD1_1P") || image_->find("CD1_2P") || - image_->find("CD2_1P") || image_->find("CD2_2P") || - image_->find("CRPIX1P") || image_->find("CRPIX2P") || - image_->find("CRVAL1P") || image_->find("CRVAL2P")) { - keyLTMV = 1; - - double cd11 = image_->getReal("CD1_1P", 1); - double cd12 = image_->getReal("CD1_2P", 0); - double cd21 = image_->getReal("CD2_1P", 0); - double cd22 = image_->getReal("CD2_2P", 1); - - double crpix1 = image_->getReal("CRPIX1P", 0); - double crpix2 = image_->getReal("CRPIX2P", 0); - double crval1 = image_->getReal("CRVAL1P", 0); - double crval2 = image_->getReal("CRVAL2P", 0); - - double ltm11 = cd11 != 0 ? 1/cd11 : 0; - double ltm12 = cd12 != 0 ? 1/cd12 : 0; - double ltm21 = cd21 != 0 ? 1/cd21 : 0; - double ltm22 = cd22 != 0 ? 1/cd22 : 0; - - double ltv1 = crpix1 - crval1*ltm11 - crval2*ltm21; - double ltv2 = crpix2 - crval1*ltm12 - crval2*ltm22; - - physicalToImage = Matrix(ltm11, ltm12, ltm21, ltm22, ltv1, ltv2); - imageToPhysical = physicalToImage.invert(); - } - } -} - void FitsImage::load() { if (post_) @@ -2709,6 +2697,20 @@ const char* FitsImage::getWCSName(Coord::CoordSystem sys) return NULL; } +const char* FitsImage::getWCSAxisName(Coord::CoordSystem sys, int axis) +{ + if (!hasWCSCel(sys)) + return NULL; + + int id = sys-Coord::WCS; + if (wcsNaxes_[id] < axis) + return NULL; + + ostringstream str; + str << "Symbol(" << axis+1 << ")" << ends; + return astGetC(ast_, str.str().c_str()); +} + Vector FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, Coord::SkyFrame sky) { @@ -2746,56 +2748,13 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, wcsSystem(ast_,sys); wcsSkyFrame(ast_,sky); - ostringstream str; Vector out = wcsTran(ast_, in, 1); if (astOK && checkWCS(out)) { - if (1) { - setWCSFormat(sys,sky,format); - astNorm(ast_, out.v); - str << astFormat(ast_,1,out[0]) << ' ' << astFormat(ast_,2,out[1]) - << ends; - } - else { - if (hasWCSCel(sys)) { - switch (format) { - case Coord::DEGREES: - out = zero360(radToDeg(out)); - str << setprecision(context_->parent_->precDeg_) - << out[0] << ' ' << out[1] << ends; - - break; + setWCSFormat(sys,sky,format); + astNorm(ast_, out.v); - case Coord::SEXAGESIMAL: - { - ostringstream hms; - hms << "hms." << context_->parent_->precHMS_; - ostringstream dms; - dms << "+dms." << context_->parent_->precDMS_; - - out = zeroTWOPI(out); - switch (sky) { - case Coord::FK4: - case Coord::FK5: - case Coord::ICRS: - wcsFormat(ast_, 1, hms.str().c_str()); - wcsFormat(ast_, 2, dms.str().c_str()); - break; - case Coord::GALACTIC: - case Coord::ECLIPTIC: - wcsFormat(ast_, 1, dms.str().c_str()); - wcsFormat(ast_, 2, dms.str().c_str()); - break; - } - str << astFormat(ast_,1,out[0]) << ' ' << astFormat(ast_,2,out[1]) - << ends; - } - break; - } - } - else - str << setprecision(context_->parent_->precLinear_) - << out[0] << ' ' << out[1] << ends; - } + ostringstream str; + str << astFormat(ast_,1,out[0]) << ' ' << astFormat(ast_,2,out[1]) << ends; strncpy(lbuf, str.str().c_str(), str.str().length()); } @@ -2840,48 +2799,14 @@ char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, wcsSystem(ast_,sys); wcsSkyFrame(ast_,sky); - ostringstream str; Vector3d out = wcsTran(ast_, in, 1); if (astOK && checkWCS(out)) { - if (hasWCSCel(sys)) { - switch (format) { - case Coord::DEGREES: - out = zero360(radToDeg(out)); - str << setprecision(context_->parent_->precDeg_) - << out[0] << ' ' << out[1] << ' ' << out[2] << ends; - break; - - case Coord::SEXAGESIMAL: - { - ostringstream hms; - hms << "hms." << context_->parent_->precHMS_; - ostringstream dms; - dms << "+dms." << context_->parent_->precDMS_; - - out = zeroTWOPI(out); - switch (sky) { - case Coord::FK4: - case Coord::FK5: - case Coord::ICRS: - wcsFormat(ast_, 1, hms.str().c_str()); - wcsFormat(ast_, 2, dms.str().c_str()); - break; - case Coord::GALACTIC: - case Coord::ECLIPTIC: - wcsFormat(ast_, 1, dms.str().c_str()); - wcsFormat(ast_, 2, dms.str().c_str()); - break; - } - str << astFormat(ast_,1,out[0]) << ' ' << astFormat(ast_,2,out[1]) - << ' ' << out[2] << ends; - } - break; - } - } - else - str << setprecision(context_->parent_->precLinear_) - << out[0] << ' ' << out[1] << ' ' << out[2] <2) ? 1 : 0; } void FitsImage::wcsInit(int hasWCSAST) @@ -3008,12 +2901,21 @@ void FitsImage::wcsInit(int hasWCSAST) wcs_ = new int[MULTWCS]; for (int ii=0; ii2) ? 1 : 0; - } - } - else { - for (int ii=0; ii2) ? 1 : 0; - } - } - } - - astEnd; -} - void FitsImage::wcsHPXInit() { wcsHPX_ =0; @@ -3193,6 +3058,43 @@ void FitsImage::wcsSizeInit() wcsSize_[ii] = calcWCSSize((Coord::CoordSystem)(ii+Coord::WCS)); } +void FitsImage::wcsPhyInit() +{ + // now see if we have a 'physical' in WCSP, if so, set LTMV keywords + keyLTMV =0; + + char* wcsname = image_->getString("WCSNAMEP"); + if (wcsname && *wcsname && !strncmp(wcsname, "PHYSICAL", 8)) { + if (image_->find("CD1_1P") || image_->find("CD1_2P") || + image_->find("CD2_1P") || image_->find("CD2_2P") || + image_->find("CRPIX1P") || image_->find("CRPIX2P") || + image_->find("CRVAL1P") || image_->find("CRVAL2P")) { + keyLTMV = 1; + + double cd11 = image_->getReal("CD1_1P", 1); + double cd12 = image_->getReal("CD1_2P", 0); + double cd21 = image_->getReal("CD2_1P", 0); + double cd22 = image_->getReal("CD2_2P", 1); + + double crpix1 = image_->getReal("CRPIX1P", 0); + double crpix2 = image_->getReal("CRPIX2P", 0); + double crval1 = image_->getReal("CRVAL1P", 0); + double crval2 = image_->getReal("CRVAL2P", 0); + + double ltm11 = cd11 != 0 ? 1/cd11 : 0; + double ltm12 = cd12 != 0 ? 1/cd12 : 0; + double ltm21 = cd21 != 0 ? 1/cd21 : 0; + double ltm22 = cd22 != 0 ? 1/cd22 : 0; + + double ltv1 = crpix1 - crval1*ltm11 - crval2*ltm21; + double ltv2 = crpix2 - crval1*ltm12 - crval2*ltm22; + + physicalToImage = Matrix(ltm11, ltm12, ltm21, ltm22, ltv1, ltv2); + imageToPhysical = physicalToImage.invert(); + } + } +} + int FitsImage::checkWCS(Vector& vv) { // check for reasonable values @@ -3208,8 +3110,8 @@ int FitsImage::checkWCS(Vector3d& vv) fabs(vv[2]) < FLT_MAX ) ? 1 : 0; } -void FitsImage::setWCSFormat(Coord::CoordSystem sys, - Coord::SkyFrame sky, Coord::SkyFormat format) +void FitsImage::setWCSFormat(Coord::CoordSystem sys, Coord::SkyFrame sky, + Coord::SkyFormat format) { int id = sys-Coord::WCS; @@ -3255,8 +3157,7 @@ void FitsImage::setWCSFormat(Coord::CoordSystem sys, ostringstream str; str << "%%1." << context_->parent_->precLinear_ << 'G'; - int naxes = astGetI(ast_, "Naxes"); - for (int ii=0; ii 0 && argv && argv[0]) { + if (argc > 0 && argv && argv[0]) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),argv[0],0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); - } - else { + else Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); - } - if (argc > 1 && argv && argv[1]) { + if (argc > 1 && argv && argv[1]) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),argv[1],0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); - } - else { + else Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); - } - if (argc > 2 && argv && argv[2]) { + if (argc > 2 && argv && argv[2]) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),argv[2],0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"",0); - } - else { + else Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),"",0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"",0); - } + char* xname = (char*)sptr->getWCSAxisName(www,0); + if (xname) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),xname,0); + else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"x",0); + char* yname = (char*)sptr->getWCSAxisName(www,1); + if (yname) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),yname,0); + else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"y",0); + char* zname = (char*)sptr->getWCSAxisName(www,2); + if (zname) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),zname,0); + else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"z",0); + char* wcsname = (char*)sptr->getWCSName(www); if (sptr->hasWCSCel(www)) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),coord.skyFrameStr(wcsSkyFrame_),0); diff --git a/tksao/frame/framebase.C b/tksao/frame/framebase.C index 4d1a98c..0b99786 100644 --- a/tksao/frame/framebase.C +++ b/tksao/frame/framebase.C @@ -152,24 +152,27 @@ void FrameBase::getInfoWCS(char* var, Vector& rr, FitsImage* ptr, const char** argv; Tcl_SplitList(interp, buff, &argc, &argv); - if (argc > 0 && argv && argv[0]) { + if (argc > 0 && argv && argv[0]) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),argv[0],0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); - } - else { + else Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); - } - if (argc > 1 && argv && argv[1]) { + if (argc > 1 && argv && argv[1]) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),argv[1],0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); - } - else { + else Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); - } + char* xname = (char*)sptr->getWCSAxisName(www,0); + if (xname) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),xname,0); + else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"x",0); + char* yname = (char*)sptr->getWCSAxisName(www,1); + if (yname) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),yname,0); + else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"y",0); + char* wcsname = (char*)sptr->getWCSName(www); if (sptr->hasWCSCel(www)) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),coord.skyFrameStr(wcsSkyFrame_),0); diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index 5d45d9a..0fa8a2d 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -55,7 +55,7 @@ int Grid25d::doit(RenderMode rm) default: { // set desired skyformat - if (!fits->astInv()) { + if (!fits->wcsInv()) { astEnd; // now, clean up memory return 1; } diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index 38c09db..e6c4d02 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -56,7 +56,7 @@ int Grid2d::doit(RenderMode rm) { // set desired skyformat - if (!fits->astInv()) { + if (!fits->wcsInv()) { astEnd; // now, clean up memory return 1; } diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C index 6fa9b4e..7443f5c 100644 --- a/tksao/frame/grid3d.C +++ b/tksao/frame/grid3d.C @@ -56,7 +56,7 @@ int Grid3d::doit(RenderMode rm) break; default: { - if (!fits->astInv()) { + if (!fits->wcsInv()) { astEnd; // now, clean up memory return 1; } -- cgit v0.12