aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-01-09 21:37:04 +0800
committerAaron LI <aly@aaronly.me>2018-01-09 21:37:04 +0800
commitde3a72df65ec07070f715a2a6aa886c983464353 (patch)
tree79b89b716ea2947f2bf8d13aad3c54e6115e63dc
parent9972228c9094432c7a281420f37da091f323e3c5 (diff)
downloadatoolbox-de3a72df65ec07070f715a2a6aa886c983464353.tar.bz2
astro/fits2skymodel: Fix a minus sign for WCS CDELT1
and other two minor fixes
-rwxr-xr-xastro/oskar/fits2skymodel.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/astro/oskar/fits2skymodel.py b/astro/oskar/fits2skymodel.py
index bcbb328..1617c9a 100755
--- a/astro/oskar/fits2skymodel.py
+++ b/astro/oskar/fits2skymodel.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (c) 2017 Weitian LI <weitian@aaronly.me>
+# Copyright (c) 2017-2018 Weitian LI <weitian@aaronly.me>
# MIT License
#
@@ -114,7 +114,7 @@ class SkyModel:
wcs_.wcs.ctype = ["RA---"+self.projection, "DEC--"+self.projection]
wcs_.wcs.crval = np.array([self.ra0, self.dec0])
wcs_.wcs.crpix = np.array([shape[1], shape[0]]) / 2.0 + 1
- wcs_.wcs.cdelt = np.array([delta, delta])
+ wcs_.wcs.cdelt = np.array([-delta, delta]) # NOTE the minus sign
return wcs_
@property
@@ -204,7 +204,7 @@ class SkyModel:
logger.info("Source counts: %d (%.1f%%)" % (counts, percent))
header = ("Frequency = %.3f [MHz]\n" % self.freq +
"Pixel size = %.2f [arcsec]\n" % self.pixelsize +
- "K2JyPixel = %.2f\n" % self.factor_K2JyPixel +
+ "K2JyPixel = %.3e\n" % self.factor_K2JyPixel +
"RA0 = %.4f [deg]\n" % self.ra0 +
"Dec0 = %.4f [deg]\n" % self.dec0 +
"Minimum value = %.4e [K]\n" % self.minvalue +
@@ -225,7 +225,7 @@ class SkyModel:
header = self.fits_header
header.add_history(datetime.now().isoformat())
header.add_history(" ".join(sys.argv))
- image = self.image
+ image = self.image.copy()
image[~self.mask] = np.nan
image *= self.factor_K2JyPixel
hdu = fits.PrimaryHDU(data=image, header=header)