From 5cd9e9133748793f74eccf15906ea8e0a91e950b Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 2 Sep 2017 13:13:15 +0800 Subject: Fix WCS delta sign --- astro/fits/rescale_image.py | 4 ++-- astro/ps2d.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'astro') 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) -- cgit v1.2.2