From cb09aba6a89636e7d60b30eee5308ecbd14dd802 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 12 Jul 2018 15:14:33 -0400 Subject: simplify wcs code --- tksao/frame/fitsimage.C | 56 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index b047ca2..2db98ad 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -1351,34 +1351,6 @@ void FitsImage::initWCS() #endif #ifndef NEWWCS -void FitsImage::initWCSPhysical() -{ - // now see if we have a 'physical' wcs, if so, set LTMV keywords - keyLTMV =0; - for (int ii=1; iiwcsname && - !strncmp(wcs_[ii]->wcsname, "PHYSICAL", 8)) { - keyLTMV = 1; - - double ltm11 = wcs_[ii]->cd[0] != 0 ? 1/wcs_[ii]->cd[0] : 0; - double ltm12 = wcs_[ii]->cd[1] != 0 ? 1/wcs_[ii]->cd[1] : 0; - double ltm21 = wcs_[ii]->cd[2] != 0 ? 1/wcs_[ii]->cd[2] : 0; - double ltm22 = wcs_[ii]->cd[3] != 0 ? 1/wcs_[ii]->cd[3] : 0; - - double ltv1 = wcs_[ii]->crpix[0] - - wcs_[ii]->crval[0]*ltm11 - wcs_[ii]->crval[1]*ltm21; - double ltv2 = wcs_[ii]->crpix[1] - - wcs_[ii]->crval[0]*ltm12 - wcs_[ii]->crval[1]*ltm22; - - physicalToImage = Matrix(ltm11, ltm12, ltm21, ltm22, ltv1, ltv2); - imageToPhysical = physicalToImage.invert(); - } - } -} -#endif - -#ifndef NEWWCS void FitsImage::initWCS0(const Vector& pix) { FitsHead* hd =NULL; @@ -1427,6 +1399,34 @@ void FitsImage::initWCS0(const Vector& pix) } #endif +#ifndef NEWWCS +void FitsImage::initWCSPhysical() +{ + // now see if we have a 'physical' wcs, if so, set LTMV keywords + keyLTMV =0; + for (int ii=1; iiwcsname && + !strncmp(wcs_[ii]->wcsname, "PHYSICAL", 8)) { + keyLTMV = 1; + + double ltm11 = wcs_[ii]->cd[0] != 0 ? 1/wcs_[ii]->cd[0] : 0; + double ltm12 = wcs_[ii]->cd[1] != 0 ? 1/wcs_[ii]->cd[1] : 0; + double ltm21 = wcs_[ii]->cd[2] != 0 ? 1/wcs_[ii]->cd[2] : 0; + double ltm22 = wcs_[ii]->cd[3] != 0 ? 1/wcs_[ii]->cd[3] : 0; + + double ltv1 = wcs_[ii]->crpix[0] - + wcs_[ii]->crval[0]*ltm11 - wcs_[ii]->crval[1]*ltm21; + double ltv2 = wcs_[ii]->crpix[1] - + wcs_[ii]->crval[0]*ltm12 - wcs_[ii]->crval[1]*ltm22; + + physicalToImage = Matrix(ltm11, ltm12, ltm21, ltm22, ltv1, ltv2); + imageToPhysical = physicalToImage.invert(); + } + } +} +#endif + void FitsImage::load() { if (post_) -- cgit v0.12