From 3d322b099ec2f62c112fe0328a634e5cc0223310 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 13 Sep 2017 01:03:20 +0800 Subject: fits2skymodel.py: Convert image to float32; Fix a string format error --- astro/oskar/fits2skymodel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/astro/oskar/fits2skymodel.py b/astro/oskar/fits2skymodel.py index 4d2f847..324ee2a 100755 --- a/astro/oskar/fits2skymodel.py +++ b/astro/oskar/fits2skymodel.py @@ -179,7 +179,7 @@ class SkyModel: Write the converted sky model for simulation. """ if os.path.exists(outfile) and (not clobber): - raise OSError("OSKAR sky model file already exists: " % outfile) + raise OSError("OSKAR sky model file already exists: %s" % outfile) sky = self.sky counts = sky.shape[0] percent = 100 * counts / self.image.size @@ -282,8 +282,8 @@ def main(): os.mkdir(args.outdir) with fits.open(args.infile) as f: - image = f[0].data - header = f[0].header + image = f[0].data.astype(np.float32) + header = f[0].header.copy(strip=True) logger.info("Read input FITS image: %s" % args.infile) # Check data unit -- cgit v1.2.2