summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-12-14 18:24:35 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-12-14 18:24:35 (GMT)
commit4fe93025d3bac59a1c906bae498bc3c61e0af494 (patch)
tree065482e76070f236992397a15eaf9994020ed43d /tksao
parentfcbdc9136aeaa70ec26a4ed0f5923aeb0ad93451 (diff)
downloadblt-4fe93025d3bac59a1c906bae498bc3c61e0af494.zip
blt-4fe93025d3bac59a1c906bae498bc3c61e0af494.tar.gz
blt-4fe93025d3bac59a1c906bae498bc3c61e0af494.tar.bz2
bring forward any 3rd column WCS defines for binned 3d cubes
Diffstat (limited to 'tksao')
-rw-r--r--tksao/fitsy++/hist.C38
1 files changed, 31 insertions, 7 deletions
diff --git a/tksao/fitsy++/hist.C b/tksao/fitsy++/hist.C
index 970bc02..afd71aa 100644
--- a/tksao/fitsy++/hist.C
+++ b/tksao/fitsy++/hist.C
@@ -463,18 +463,24 @@ void FitsHist::mapWCSString(FitsHead* head, char* w,
void FitsHist::mapWCSString(FitsHead* head, char* w,
const char* out, const char* prim, const char* alt)
{
- ostringstream istr1, istr2;
+ ostringstream istr1, istr2, istr3;
if (!w[0]) {
istr1 << prim << xcol_->index() << w << ends;
istr2 << prim << ycol_->index() << w << ends;
+ if (zcol_)
+ istr3 << prim << zcol_->index() << w << ends;
}
else {
istr1 << alt << xcol_->index() << w << ends;
istr2 << alt << ycol_->index() << w << ends;
+ if (zcol_)
+ istr3 << alt << zcol_->index() << w << ends;
}
- ostringstream ostr1, ostr2;
+ ostringstream ostr1, ostr2, ostr3;
ostr1 << out << "1" << w << ends;
ostr2 << out << "2" << w << ends;
+ if (zcol_)
+ ostr3 << out << "3" << w << ends;
if (head->find(istr1.str().c_str())) {
char* cc1 = head->getString(istr1.str().c_str());
@@ -484,6 +490,12 @@ void FitsHist::mapWCSString(FitsHead* head, char* w,
char* cc2 = head->getString(istr2.str().c_str());
head_->appendString(ostr2.str().c_str(), cc2, NULL);
}
+ if (zcol_) {
+ if (head->find(istr3.str().c_str())) {
+ char* cc3 = head->getString(istr3.str().c_str());
+ head_->appendString(ostr3.str().c_str(), cc3, NULL);
+ }
+ }
}
void FitsHist::mapWCSReal(FitsHead* head, const char* out, const char* in)
@@ -497,7 +509,7 @@ void FitsHist::mapWCSReal(FitsHead* head, const char* out, const char* in)
}
}
-void FitsHist::mapWCSReal(FitsHead* head, char* w,
+void FitsHist::mapWCSReal(FitsHead* head, char* w,
const char* out, const char* in)
{
ostringstream istr;
@@ -513,21 +525,26 @@ void FitsHist::mapWCSReal(FitsHead* head, char* w,
const char* out, const char* prim, const char* alt,
Matrix mm)
{
- ostringstream istr1, istr2;
+ ostringstream istr1, istr2, istr3;
if (!w[0]) {
istr1 << prim << xcol_->index() << w << ends;
istr2 << prim << ycol_->index() << w << ends;
+ if (zcol_)
+ istr3 << prim << zcol_->index() << w << ends;
}
else {
istr1 << alt << xcol_->index() << w << ends;
istr2 << alt << ycol_->index() << w << ends;
+ if (zcol_)
+ istr3 << alt << zcol_->index() << w << ends;
}
- ostringstream ostr1, ostr2;
+ ostringstream ostr1, ostr2, ostr3;
ostr1 << out << "1" << w << ends;
ostr2 << out << "2" << w << ends;
+ if (zcol_)
+ ostr3 << out << "3" << w << ends;
- if (head->find(istr1.str().c_str()) ||
- head->find(istr2.str().c_str())) {
+ if (head->find(istr1.str().c_str()) || head->find(istr2.str().c_str())) {
float cc1 = head->getReal(istr1.str().c_str(),0);
float cc2 = head->getReal(istr2.str().c_str(),0);
Vector cc = Vector(cc1,cc2) * mm;
@@ -535,6 +552,13 @@ void FitsHist::mapWCSReal(FitsHead* head, char* w,
head_->appendReal(ostr1.str().c_str(), cc[0], 10, NULL);
head_->appendReal(ostr2.str().c_str(), cc[1], 10, NULL);
}
+
+ if (zcol_) {
+ if (head->find(istr3.str().c_str())) {
+ float cc3 = head->getReal(istr3.str().c_str(),0);
+ head_->appendReal(ostr3.str().c_str(), cc3, 10, NULL);
+ }
+ }
}
void FitsHist::mapWCSMatrix(FitsHead* head, char* w,