summaryrefslogtreecommitdiffstats
path: root/tksao/frame
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-10-30 19:56:16 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-10-30 19:56:16 (GMT)
commit8c3a00c22ddf6c742903bbcc8a08069c7245b74a (patch)
treeef889666898b2f4d7e1eb2204f36a90b66557031 /tksao/frame
parent94697265964db90f41354df027f887872e15103c (diff)
downloadblt-8c3a00c22ddf6c742903bbcc8a08069c7245b74a.zip
blt-8c3a00c22ddf6c742903bbcc8a08069c7245b74a.tar.gz
blt-8c3a00c22ddf6c742903bbcc8a08069c7245b74a.tar.bz2
fix block WCS
Diffstat (limited to 'tksao/frame')
-rw-r--r--tksao/frame/context.C4
-rw-r--r--tksao/frame/fitsblock.C2
-rw-r--r--tksao/frame/fitsimage.C32
-rw-r--r--tksao/frame/fitsimage.h2
4 files changed, 35 insertions, 5 deletions
diff --git a/tksao/frame/context.C b/tksao/frame/context.C
index e900df4..05dff3d 100644
--- a/tksao/frame/context.C
+++ b/tksao/frame/context.C
@@ -1249,7 +1249,7 @@ int Context::loadMosaicWFPC2(Base::MemType which, const char* fn,
// Its legal, save it
bfits_ = img;
- loadInit(1, Base::WFPC2,Coord::WCS);
+ loadInit(1, Base::WFPC2, Coord::WCS);
// remember in case of compress
Base::MemType sav = which;
@@ -1418,7 +1418,7 @@ int Context::loadMosaicWFPC2(Base::MemType which, const char* fn,
<< ends;
// fix fitsimage params
- ptr->wfpc2WCS(istr);
+ ptr->wfpc2WCS(bfits_->head(), istr);
Matrix mm = parent_->calcAlignWCS(bfits_, ptr, Coord::WCS,
Coord::WCS, Coord::FK5);
diff --git a/tksao/frame/fitsblock.C b/tksao/frame/fitsblock.C
index 49629a8..bb0a844 100644
--- a/tksao/frame/fitsblock.C
+++ b/tksao/frame/fitsblock.C
@@ -5,6 +5,7 @@
#include "fitsimage.h"
#include "block.h"
#include "context.h"
+#include "wcsast.h"
void* blockproc(void* tt);
@@ -187,4 +188,3 @@ void* blockproc(void* tt)
return NULL;
}
-
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index aaf972e..889befd 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -889,10 +889,22 @@ void FitsImageIIS::iisWCS(const Matrix& mm, const Vector& z, int zt)
// FitsImage
-void FitsImage::wfpc2WCS(istream& str)
+void FitsImage::wfpc2WCS(FitsHead* pp, istream& str)
{
FitsHead* hh = parseWCS(str);
+ // EQUINOX
+ if (pp->find("EQUINOX")) {
+ char* equ = pp->getString("EQUINOX");
+ hh->appendString("EQUINOX", equ, NULL);
+ }
+
+ // DATE-OBS
+ if (pp->find("DATE-OBS")) {
+ char* equ = pp->getString("DATE-OBS");
+ hh->appendString("DATE-OBS", equ, NULL);
+ }
+
// Process OBJECT keyword
if (objectKeyword_)
delete [] objectKeyword_;
@@ -1178,6 +1190,24 @@ void FitsImage::resetWCS()
initWCS(wfpc2Header_);
else
initWCS(image_->head());
+
+
+ // apply block factor
+ if (ast_) {
+ Vector block = context_->blockFactor();
+ if (block[0] != 1 && block[1] != 1) {
+ astClearStatus; // just to make sure
+ astBegin; // start memory management
+
+ Vector ll(.5,.5);
+ Vector ur(1.5,1.5);
+ Vector rr = ur*Translate(-.5,-.5)*Scale(block)*Translate(.5,.5);
+ AstWinMap* winmap = astWinMap(2, ll.vv(), rr.vv(), ll.vv(), ur.vv(), "");
+ astRemapFrame(ast_, AST__BASE, winmap);
+
+ astEnd;
+ }
+ }
}
void FitsImage::initWCS0(const Vector& pix)
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index aad99b9..1acc5bf 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -408,7 +408,7 @@ class FitsImage {
Vector3d wcs2pix(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame);
int wcsInv() {return wcsInv_;}
- void wfpc2WCS(istream&);
+ void wfpc2WCS(FitsHead*, istream&);
void appendWCS(istream&);
void listWCS(ostream&, Coord::CoordSystem);
void resetWCS();