aboutsummaryrefslogtreecommitdiffstats
path: root/astro
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-11-21 17:18:57 +0800
committerAaron LI <aly@aaronly.me>2017-11-21 17:18:57 +0800
commitb97f35bfce69a4d5b6da3a95814812c5c3c8411f (patch)
tree4f63b6cc23b04c57b912fd50421a30f1622b2c9a /astro
parentd85b93ef7273b2724a04f2e4a7a6c3f2bb238c8e (diff)
downloadatoolbox-b97f35bfce69a4d5b6da3a95814812c5c3c8411f.tar.bz2
astro/jybeam2k.py: Add argument --beam to allow to specify beam size
Diffstat (limited to 'astro')
-rwxr-xr-xastro/oskar/jybeam2k.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/astro/oskar/jybeam2k.py b/astro/oskar/jybeam2k.py
index 76072e3..0f774c1 100755
--- a/astro/oskar/jybeam2k.py
+++ b/astro/oskar/jybeam2k.py
@@ -48,9 +48,13 @@ def main():
parser.add_argument("-C", "--clobber", dest="clobber",
action="store_true",
help="overwrite existing output file")
+ parser.add_argument("-b", "--beam", dest="beam", type=float,
+ help="instrumental beam size [arcsec^2] " +
+ "(=pi*bmajor*bminor/4/ln(2)) (default: obtain " +
+ "from the header BMAJ and BMIN keywords)")
parser.add_argument("-f", "--frequency", dest="frequency",
help="frequency [MHz] of the input image (NOTE: " +
- "required if cannot get frequency from file header)")
+ "required if failed to obtain from the header)")
parser.add_argument("infile",
help="input FITS image file (NOTE: only single " +
"frequency supported)")
@@ -81,11 +85,14 @@ def main():
print("Frequency: %.2f [MHz]" % freq)
# Elliptical Gaussian beam (full width at half power; FWHP)
- bmajor = header["BMAJ"] * 3600 # [arcsec]
- bminor = header["BMIN"] * 3600 # [arcsec]
- beam = np.pi * bmajor*bminor / (4*np.log(2)) # [arcsec^2]
- print("Beam area: %.2f [arcsec^2] (major: %.2f, minor: %.2f)" %
- (beam, bmajor, bminor))
+ if args.beam:
+ beam = args.beam
+ else:
+ bmajor = header["BMAJ"] * 3600 # [arcsec]
+ bminor = header["BMIN"] * 3600 # [arcsec]
+ beam = np.pi * bmajor*bminor / (4*np.log(2)) # [arcsec^2]
+ print("Beam: (%.2f, %.2f) [arcsec]" % (bmajor, bminor))
+ print("Beam size: %.2f [arcsec^2]" % beam)
equiv = au.brightness_temperature(beam*au.arcsec**2, freq*au.MHz)
jybeam2k = au.Unit(unit).to(au.K, equivalencies=equiv)