diff options
author | Aaron LI <aly@aaronly.me> | 2017-06-13 23:10:08 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-06-13 23:10:08 +0800 |
commit | b2473586a3017af791e089deaeaab5683449613b (patch) | |
tree | ee6afd51d3fda572560274d20f189f44c63d3f79 /astro/oskar/fits2skymodel.py | |
parent | 83867c4af5f16d210a9fed296de5a0928ffb0e06 (diff) | |
download | atoolbox-b2473586a3017af791e089deaeaab5683449613b.tar.bz2 |
astro/oskar/fits2skymodel.py: Add argument --outdir
Diffstat (limited to 'astro/oskar/fits2skymodel.py')
-rwxr-xr-x | astro/oskar/fits2skymodel.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/astro/oskar/fits2skymodel.py b/astro/oskar/fits2skymodel.py index 781b907..dfd27d3 100755 --- a/astro/oskar/fits2skymodel.py +++ b/astro/oskar/fits2skymodel.py @@ -211,6 +211,8 @@ def main(): parser.add_argument("-F", "--osm-fits", dest="osmfits", action="store_true", help="save a FITS version of the converted sky model") + parser.add_argument("-o", "--outdir", dest="outdir", + help="output directory for sky model files") parser.add_argument("infile", help="input FITS image") parser.add_argument("outfile", nargs="?", help="output OSKAR sky model (default: " + @@ -220,7 +222,11 @@ def main(): if args.outfile: outfile = args.outfile else: - outfile = os.path.splitext(args.infile)[0] + ".osm" + outfile = os.path.splitext(os.path.basename(args.infile))[0] + ".osm" + if args.outdir: + outfile = os.path.join(args.outdir, outfile) + if not os.path.exists(args.outdir): + os.mkdir(args.outdir) with fits.open(args.infile) as f: image = f[0].data @@ -238,6 +244,7 @@ def main(): logger.info("Minimum threshold: %g [K]" % minvalue) skymodel = SkyModel(image=image, freq=freq, ra0=args.ra0, dec0=args.dec0, pixsize=pixsize, minvalue=minvalue) + logger.info("Conversion [K] -> [Jy/pixel]: %g" % skymodel.factor_K2JyPixel) skymodel.write_sky_model(outfile, clobber=args.clobber) if args.osmfits: outfits = outfile + ".fits" |