aboutsummaryrefslogtreecommitdiffstats
path: root/astro
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
parent6d58d41451935466a9cbaaf0502e843f3d7904ee (diff)
downloadatoolbox-5cd9e9133748793f74eccf15906ea8e0a91e950b.tar.bz2
Fix WCS delta sign
Diffstat (limited to 'astro')
-rwxr-xr-xastro/fits/rescale_image.py4
-rwxr-xr-xastro/ps2d.py4
2 files changed, 4 insertions, 4 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
diff --git a/astro/ps2d.py b/astro/ps2d.py
index 8852e97..cc4fdea 100755
--- a/astro/ps2d.py
+++ b/astro/ps2d.py
@@ -45,7 +45,7 @@ import astropy.constants as ac
logging.basicConfig(level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
- datefmt="%Y-%m-%dT%H:%M:%S")
+ datefmt="%H:%M:%S")
logger = logging.getLogger(os.path.basename(sys.argv[0]))
@@ -416,7 +416,7 @@ def main():
if args.pixelsize:
pixelsize = args.pixelsize # [arcsec]
else:
- pixelsize = wcs.wcs.cdelt[0] * 3600 # [deg] -> [arcsec]
+ pixelsize = abs(wcs.wcs.cdelt[0]) * 3600 # [deg] -> [arcsec]
ps2d = PS2D(cube=cube, pixelsize=pixelsize, frequencies=frequencies,
window_name=args.window)