diff options
author | Aaron LI <aly@aaronly.me> | 2017-09-02 10:45:57 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-09-02 10:46:32 +0800 |
commit | 04aef0c64a49f94f0e5db9c2ccc4bed63f7b4f5d (patch) | |
tree | d9faa3d191469fbd97a61c9e0220f17e060e372d /astro/oskar/correct-pb.py | |
parent | d31c8bd4901ca4400727f8ca6e68c94edc747d0c (diff) | |
download | atoolbox-04aef0c64a49f94f0e5db9c2ccc4bed63f7b4f5d.tar.bz2 |
oskar: Delete obsolete scripts runOSKAR.py & correct-pb.py
* runOSKAR.py: superseded by "fits2skymodel.py" and "run_oskar.py"
* correct-pb.py: it is generally not recommended to correct for
primary beam
Diffstat (limited to 'astro/oskar/correct-pb.py')
-rwxr-xr-x | astro/oskar/correct-pb.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/astro/oskar/correct-pb.py b/astro/oskar/correct-pb.py deleted file mode 100755 index cac20ff..0000000 --- a/astro/oskar/correct-pb.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) Weitna LI <weitian@aaronly.me> -# MIT License -# -# Correct for primary beam by dividing the image by the (simulated) -# primary beam pattern. -# -# 2017-06-20 -# - -import os -import sys -import argparse - -from astropy.io import fits - - -def main(): - parser = argparse.ArgumentParser( - description="Correct for the primary beam pattern") - parser.add_argument("-C", "--clobber", dest="clobber", - action="store_true", - help="overwrite existing files") - parser.add_argument("-p", "--primary-beam", dest="pb", - required=True, - help="file of the primary beam pattern") - parser.add_argument("infile", help="input image to be corrected for") - parser.add_argument("outfile", nargs="?", - help="output pb-corrected image (default: add " + - "'pbcorr.fits' suffix)") - args = parser.parse_args() - - if args.outfile: - outfile = args.outfile - else: - outfile = os.path.splitext(args.infile)[0] + ".pbcorr.fits" - - with fits.open(args.infile) as f: - imgin = f[0].data - header = f[0].header - pb = fits.open(args.pb)[0].data - imgout = imgin / pb - header.add_history(" ".join(sys.argv)) - hdu = fits.PrimaryHDU(data=imgout, header=header) - try: - hdu.writeto(outfile, overwrite=args.clobber) - except TypeError: - hdu.writeto(outfile, clobber=args.clobber) - print("Wrote pb-corrected image: %s" % outfile) - - -if __name__ == "__main__": - main() |