diff options
author | Aaron LI <aly@aaronly.me> | 2017-09-01 21:32:49 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-09-01 21:32:49 +0800 |
commit | d00116b42bc0609a12273823113d4828654d4ba8 (patch) | |
tree | 9a5c8b05d983a9161796fdccca83335fa98e276a /astro/oskar | |
parent | 774bff57c34da5d7e2fa950a03d9cab51c60ec64 (diff) | |
download | atoolbox-d00116b42bc0609a12273823113d4828654d4ba8.tar.bz2 |
fits2skymodel.py: print and save source fraction after masking
Diffstat (limited to 'astro/oskar')
-rwxr-xr-x | astro/oskar/fits2skymodel.py | 7 |
1 files changed, 4 insertions, 3 deletions
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) |