diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-07-26 19:45:06 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-07-26 19:45:06 (GMT) |
commit | f363b34387596b75f0b3e1bc9f213498cf2a9f63 (patch) | |
tree | ca7c9d8580f4e6a444f8b7eea56b775a02ccee5b /tksao | |
parent | 7893a11b6dbc514d583a414577979b12226d58d9 (diff) | |
download | blt-f363b34387596b75f0b3e1bc9f213498cf2a9f63.zip blt-f363b34387596b75f0b3e1bc9f213498cf2a9f63.tar.gz blt-f363b34387596b75f0b3e1bc9f213498cf2a9f63.tar.bz2 |
clean up getWCSSize code
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/fitsimage.C | 26 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 3 | ||||
-rw-r--r-- | tksao/frame/frblt.C | 21 |
3 files changed, 18 insertions, 32 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 105f0b0..2655be9 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -1434,7 +1434,7 @@ void FitsImage::initWCS0(const Vector& pix) hd->appendReal("CRVAL2", 0, 8, NULL); // CD - float ss = getWCSPixelSize(Coord::WCS); + Vector ss = getWCSSize(Coord::WCS); double ang = getWCSRotation(Coord::WCS,Coord::FK5); Matrix flip; switch (getWCSOrientation(Coord::WCS,Coord::FK5)) { @@ -3056,7 +3056,7 @@ Vector FitsImage::getWCScdelt(Coord::CoordSystem sys) #endif #ifndef OLDWCS -double FitsImage::getWCSPixelSize(Coord::CoordSystem sys) +Vector FitsImage::getWCSSize(Coord::CoordSystem sys) { if (!hasWCS(sys)) return 0; @@ -3070,30 +3070,10 @@ double FitsImage::getWCSPixelSize(Coord::CoordSystem sys) in[1] = center()+Vector(1,0); in[2] = center()+Vector(0,1); wcsTran(3, in, 1, out); - double dd = (wcsDistance(out[0],out[1]) + wcsDistance(out[0],out[2]))/2.; + Vector dd = Vector(wcsDistance(out[0],out[1]), wcsDistance(out[0],out[2])); return hasWCSCel(sys) ? radToDeg(dd) : dd; } - -double FitsImage::getWCSPixelArea(Coord::CoordSystem sys) -{ - if (!hasWCS(sys)) - return 0; - - astClearStatus; // just to make sure - setWCSSkyFrame(sys, Coord::FK5); - - Vector in[3]; - Vector out[3]; - in[0] = center(); - in[1] = center()+Vector(1,0); - in[2] = center()+Vector(0,1); - wcsTran(3, in, 1, out); - double ll = wcsDistance(out[0], out[1]); - double mm = wcsDistance(out[0], out[2]); - - return hasWCSCel(sys) ? radToDeg(ll)*radToDeg(mm) : ll*mm; -} #endif #ifdef OLDWCS diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index acea52a..071d77c 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -451,8 +451,7 @@ class FitsImage { void setWCSSkyFrame(Coord::CoordSystem, Coord::SkyFrame); void setWCSFormat(int, const char*); - double getWCSPixelSize(Coord::CoordSystem); - double getWCSPixelArea(Coord::CoordSystem); + Vector getWCSSize(Coord::CoordSystem); #endif int hasWCS(Coord::CoordSystem); diff --git a/tksao/frame/frblt.C b/tksao/frame/frblt.C index acfe79f..f9aa4fc 100644 --- a/tksao/frame/frblt.C +++ b/tksao/frame/frblt.C @@ -376,7 +376,8 @@ int Base::markerAnalysisRadial(Marker* pp, double** x, double** y, double** e, Vector cdelt= ptr->getWCScdelt(sys); double ll = fabs(cdelt[0]); #else - double ll = ptr->getWCSPixelSize(sys); + Vector rr = ptr->getWCSSize(sys); + double ll = (rr[0]+rr[1])/2.; #endif if (ptr->hasWCSCel(sys)) { @@ -393,7 +394,8 @@ int Base::markerAnalysisRadial(Marker* pp, double** x, double** y, double** e, Vector cdelt= ptr->getWCScdelt(sys); double aa = fabs(cdelt[0]*cdelt[1]); #else - double aa = ptr->getWCSPixelArea(sys); + Vector rr = ptr->getWCSSize(sys); + double aa = rr.area(); #endif for (int kk=0; kk<num; kk++) { @@ -499,7 +501,8 @@ int Base::markerAnalysisPanda(Marker* pp, double** x, double** y, double** e, Vector cdelt= ptr->getWCScdelt(sys); double ll = fabs(cdelt[0]); #else - double ll = ptr->getWCSPixelSize(sys); + Vector rr = ptr->getWCSSize(sys); + double ll = (rr[0]+rr[1])/2.; #endif if (ptr->hasWCSCel(sys)) { @@ -516,7 +519,8 @@ int Base::markerAnalysisPanda(Marker* pp, double** x, double** y, double** e, Vector cdelt= ptr->getWCScdelt(sys); double aa = fabs(cdelt[0]*cdelt[1]); #else - double aa= ptr->getWCSPixelArea(sys); + Vector rr = ptr->getWCSSize(sys); + double aa = rr.area(); #endif for (int qq=0; qq<aa; qq++) { @@ -836,7 +840,8 @@ int Base::markerAnalysisStats1(Marker* pp,FitsImage* ptr, ostream& str, Vector cdelt= ptr->getWCScdelt(sys); double ll = fabs(cdelt[0]); #else - double ll = ptr->getWCSPixelSize(sys); + Vector rr = ptr->getWCSSize(sys); + double ll = (rr[0]+rr[1])/2.; #endif if (ptr->hasWCSCel(sys)) { str << "1 pixel = "<< ll*60*60 << " arcsec"; @@ -882,7 +887,8 @@ void Base::markerAnalysisStats2(FitsImage* ptr, ostream& str, Vector cdelt= ptr->getWCScdelt(sys); double aa = fabs(cdelt[0]*cdelt[1]); #else - double aa = ptr->getWCSPixelArea(sys); + Vector rr = ptr->getWCSSize(sys); + double aa = rr.area(); #endif area = aa*60*60*60*60*cnt; } @@ -894,7 +900,8 @@ void Base::markerAnalysisStats2(FitsImage* ptr, ostream& str, Vector cdelt= ptr->getWCScdelt(sys); double aa = fabs(cdelt[0]*cdelt[1]); #else - double aa = ptr->getWCSPixelArea(sys); + Vector rr = ptr->getWCSSize(sys); + double aa = rr.area(); #endif area = aa*cnt; } |