def calc_beam_size(header):
"""
Calculate the beam/PSF size using the 'WSCNORMF' keyword recorded by
the WSClean imager, which applies to the natural-weighted image, and
is more accurate than the fitted beam (stored as 'BMAJ' and 'BMIN'.)
"""
try:
weight = header["WSCWEIGH"]
normf = header["WSCNORMF"]
print("WSCWEIGH: %s" % weight)
print("WSCNORMF: %.1f" % normf)
except KeyError:
raise RuntimeError("NO necessary WSC* keyword; switch to " +
"--use-fitted-beam instead")
if weight.upper() != "NATURAL":
print("WARNING: weighting scheme is '%s' != natural!" % weight)
width = header["NAXIS1"]
height = header["NAXIS2"]
pixelsize = np.abs(header["CDELT1"]) * 3600 # [arcsec]
print("Image: %dx%d, %.1f [arcsec/pixel]" % (width, height, pixelsize))
beam_size = (width*height * pixelsize**2) / normf
return beam_size
评论列表
文章目录