aboutsummaryrefslogtreecommitdiffstats
path: root/astro/fits
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-09-02 13:13:15 +0800
committerAaron LI <aly@aaronly.me>2017-09-02 13:55:32 +0800
commit5cd9e9133748793f74eccf15906ea8e0a91e950b (patch)
tree866f0b8245ad5bda50ce016c8cb3dac9fea7eed6 /astro/fits
parent6d58d41451935466a9cbaaf0502e843f3d7904ee (diff)
downloadatoolbox-5cd9e9133748793f74eccf15906ea8e0a91e950b.tar.bz2
Fix WCS delta sign
Diffstat (limited to 'astro/fits')
-rwxr-xr-xastro/fits/rescale_image.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/astro/fits/rescale_image.py b/astro/fits/rescale_image.py
index 47db31f..9008b33 100755
--- a/astro/fits/rescale_image.py
+++ b/astro/fits/rescale_image.py
@@ -89,7 +89,7 @@ class FITSImage:
if hasattr(self, "_pixelsize"):
return self._pixelsize
else:
- return self.header["CDELT1"] * 3600 # [deg] -> [arcsec]
+ return abs(self.header["CDELT1"]) * 3600 # [deg] -> [arcsec]
@pixelsize.setter
def pixelsize(self, value):
@@ -114,7 +114,7 @@ class FITSImage:
w.wcs.crval = np.array([hdr.get("CRVAL1", 0.0),
hdr.get("CRVAL2", 0.0)])
w.wcs.crpix = np.array([self.Ny/2+1, self.Nx/2+1])
- w.wcs.cdelt = np.array([self.pixelsize/3600, self.pixelsize/3600])
+ w.wcs.cdelt = np.array([-self.pixelsize/3600, self.pixelsize/3600])
w.wcs.cunit = [hdr.get("CUNIT1", "deg"), hdr.get("CUNIT2", "deg")]
return w