def write_mask(self, outfile, clobber=False):
if os.path.exists(outfile) and (not clobber):
raise OSError("Sky mask already exists: %s" % outfile)
header = self.fits_header
header.add_history(datetime.now().isoformat())
header.add_history(" ".join(sys.argv))
hdu = fits.PrimaryHDU(data=self.mask.astype(np.int16),
header=header)
try:
hdu.writeto(outfile, overwrite=True)
except TypeError:
hdu.writeto(outfile, clobber=True) # old astropy versions
logger.info("Wrote mask of sky model to file: %s" % outfile)
评论列表
文章目录