From d00116b42bc0609a12273823113d4828654d4ba8 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 1 Sep 2017 21:32:49 +0800 Subject: fits2skymodel.py: print and save source fraction after masking --- astro/oskar/fits2skymodel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'astro/oskar') diff --git a/astro/oskar/fits2skymodel.py b/astro/oskar/fits2skymodel.py index 1ab1176..a336515 100755 --- a/astro/oskar/fits2skymodel.py +++ b/astro/oskar/fits2skymodel.py @@ -163,13 +163,14 @@ class SkyModel: if os.path.exists(outfile) and (not clobber): raise OSError("OSKAR sky model file already exists: " % outfile) sky = self.sky - nsources = sky.shape[0] - logger.info("Number of sources: %d" % nsources) + counts = sky.shape[0] + percent = 100 * counts / self.image.size + logger.info("Source counts: %d (%.1f%%)" % (counts, percent)) header = ("Frequency = %.3f [MHz]\n" % self.freq + "Pixel size = %.2f [arcsec]\n" % self.pixelsize + "RA0 = %.4f [deg]\n" % self.ra0 + "Dec0 = %.4f [deg]\n" % self.dec0 + - "Number of sources = %d\n\n" % len(sky) + + "Source counts = %d (%.1f%%)\n\n" % (counts, percent) + "R.A.[deg] Dec.[deg] flux[Jy]") np.savetxt(outfile, sky, fmt='%.10e, %.10e, %.10e', header=header) logger.info("Wrote OSKAR sky model to file: %s" % outfile) -- cgit v1.2.2