From 57e00fc8ac9b9143dd47acf97346db16ae53c26f Mon Sep 17 00:00:00 2001 From: dencheva Date: Wed, 22 Sep 2010 19:30:12 +0000 Subject: Moved utils from stwcs to updatewcs git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@10375 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/utils.py | 28 ---------------------------- updatewcs/corrections.py | 2 +- updatewcs/det2im.py | 2 +- updatewcs/dgeo.py | 2 +- updatewcs/makewcs.py | 2 +- updatewcs/utils.py | 28 ++++++++++++++++++++++++++++ 6 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 lib/utils.py create mode 100644 updatewcs/utils.py diff --git a/lib/utils.py b/lib/utils.py deleted file mode 100644 index 29ba5f3..0000000 --- a/lib/utils.py +++ /dev/null @@ -1,28 +0,0 @@ -from __future__ import division # confidence high - -def diff_angles(a,b): - """ - Perform angle subtraction a-b taking into account - small-angle differences across 360degree line. - """ - - diff = a - b - - if diff > 180.0: - diff -= 360.0 - - if diff < -180.0: - diff += 360.0 - - return diff - -def getBinning(fobj, extver=1): - # Return the binning factor - binned = 1 - if fobj[0].header['INSTRUME'] == 'WFPC2': - mode = fobj[0].header.get('MODE', "") - if mode == 'AREA': binned = 2 - else: - binned = fobj['SCI', extver].header.get('BINAXIS',1) - return binned - diff --git a/updatewcs/corrections.py b/updatewcs/corrections.py index fea44c1..686277c 100644 --- a/updatewcs/corrections.py +++ b/updatewcs/corrections.py @@ -4,7 +4,7 @@ import datetime import numpy as np from numpy import linalg from pytools import fileutil -from stwcs.utils import diff_angles +from utils import diff_angles import makewcs, dgeo MakeWCS = makewcs.MakeWCS diff --git a/updatewcs/det2im.py b/updatewcs/det2im.py index 0d87134..c9837c9 100644 --- a/updatewcs/det2im.py +++ b/updatewcs/det2im.py @@ -2,7 +2,7 @@ from __future__ import division # confidence high import pyfits from pytools import fileutil -from stwcs import utils +import utils class DET2IMCorr(object): def updateWCS(cls, fobj): diff --git a/updatewcs/dgeo.py b/updatewcs/dgeo.py index 3d49a8b..fd1c214 100644 --- a/updatewcs/dgeo.py +++ b/updatewcs/dgeo.py @@ -2,7 +2,7 @@ from __future__ import division # confidence high import pyfits from pytools import fileutil -from stwcs import utils +import utils import numpy as np class DGEOCorr(object): diff --git a/updatewcs/makewcs.py b/updatewcs/makewcs.py index 77c8aa9..49bca0b 100644 --- a/updatewcs/makewcs.py +++ b/updatewcs/makewcs.py @@ -3,7 +3,7 @@ from __future__ import division # confidence high from stwcs import DEGTORAD, RADTODEG import numpy as np from math import sin, sqrt, pow, cos, asin, atan2,pi -from stwcs import utils +import utils from pytools import fileutil class MakeWCS(object): diff --git a/updatewcs/utils.py b/updatewcs/utils.py new file mode 100644 index 0000000..29ba5f3 --- /dev/null +++ b/updatewcs/utils.py @@ -0,0 +1,28 @@ +from __future__ import division # confidence high + +def diff_angles(a,b): + """ + Perform angle subtraction a-b taking into account + small-angle differences across 360degree line. + """ + + diff = a - b + + if diff > 180.0: + diff -= 360.0 + + if diff < -180.0: + diff += 360.0 + + return diff + +def getBinning(fobj, extver=1): + # Return the binning factor + binned = 1 + if fobj[0].header['INSTRUME'] == 'WFPC2': + mode = fobj[0].header.get('MODE', "") + if mode == 'AREA': binned = 2 + else: + binned = fobj['SCI', extver].header.get('BINAXIS',1) + return binned + -- cgit