diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-07-12 19:14:33 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-07-12 19:14:33 (GMT) |
commit | cb09aba6a89636e7d60b30eee5308ecbd14dd802 (patch) | |
tree | b8089b275957b64ae1761ee85fb158b120f47d1a | |
parent | 04731b65a3518fac20f7c4b64f90b4adaacf6c18 (diff) | |
download | blt-cb09aba6a89636e7d60b30eee5308ecbd14dd802.zip blt-cb09aba6a89636e7d60b30eee5308ecbd14dd802.tar.gz blt-cb09aba6a89636e7d60b30eee5308ecbd14dd802.tar.bz2 |
simplify wcs code
-rw-r--r-- | tksao/frame/fitsimage.C | 56 |
1 files 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; ii<MULTWCS; ii++) { - if (wcs_[ii] && - wcs_[ii]->wcsname && - !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; ii<MULTWCS; ii++) { + if (wcs_[ii] && + wcs_[ii]->wcsname && + !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_) |