import os, re def psfsize(cfgfile, freq): """ Returns the PSF FWHM of cfgfile in arcsec. Only really works for snapshots at zenith. """ # print "psfsize's cfgfile:", cfgfile avgsep = os.popen('/users/rreid/bin/avgsep < ' + cfgfile) for lin in avgsep: if re.search('Nominal resolution acc. to rmssep:.*" at 300 GHz', lin): fwhm = re.search('rmssep:\s+([^"]+)"', lin).groups()[0] break avgsep.close() return float(fwhm) * 300.0 / freq