diff options
| author | dencheva <dencheva@stsci.edu> | 2014-04-28 15:42:57 -0400 | 
|---|---|---|
| committer | dencheva <dencheva@stsci.edu> | 2014-04-28 15:42:57 -0400 | 
| commit | 7b04268af9bf0f2a7c29fcc53266fddec672793e (patch) | |
| tree | cd6fa68e3518b09b396a0b7227b9e405245cec16 /stsci/sphere | |
| parent | d80372a5d1a03bbf19be2b15775493d347c3b54f (diff) | |
| download | stsci.sphere-7b04268af9bf0f2a7c29fcc53266fddec672793e.tar.gz | |
changes to use astropy instead of pyfits and pywcs
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@31238 fe389314-cf27-0410-b35b-8c050e845b92
Former-commit-id: c1b6745fb638349430fb6b33079113dcb80c5a18
Diffstat (limited to 'stsci/sphere')
| -rw-r--r-- | stsci/sphere/polygon.py | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/stsci/sphere/polygon.py b/stsci/sphere/polygon.py index e9ad379..1dc33cd 100644 --- a/stsci/sphere/polygon.py +++ b/stsci/sphere/polygon.py @@ -254,8 +254,10 @@ class SphericalPolygon(object):          -------          polygon : `SphericalPolygon` object          """ -        import pywcs -        import pyfits +        #import pywcs +        #import pyfits +        from astropy import wcs as pywcs +        from astropy.io import fits as pyfits          if isinstance(fitspath, pyfits.Header):              header = fitspath @@ -266,7 +268,7 @@ class SphericalPolygon(object):              wcs = pywcs.WCS(fitspath)          if crval is not None:              wcs.wcs.crval = crval -        xa, ya = [wcs.naxis1, wcs.naxis2] +        xa, ya = [wcs._naxis1, wcs._naxis2]          length = steps * 4 + 1          X = np.empty(length) @@ -285,13 +287,13 @@ class SphericalPolygon(object):          Y[-1]              = 1          # Use wcslib to convert to (ra, dec) -        ra, dec = wcs.all_pix2sky(X, Y, 1) +        ra, dec = wcs.all_pix2world(X, Y, 1)          # Convert to Cartesian          x, y, z = vector.radec_to_vector(ra, dec)          # Calculate an inside point -        ra, dec = wcs.all_pix2sky(xa / 2.0, ya / 2.0, 1) +        ra, dec = wcs.all_pix2world(xa / 2.0, ya / 2.0, 1)          xc, yc, zc = vector.radec_to_vector(ra, dec)          return cls(np.dstack((x, y, z))[0], (xc[0], yc[0], zc[0])) | 
