def read_keyword2(infile, keyword):
"""
Read the specified header keyword using ``astropy.io.fits``
and return a tuple of ``(value, comment)``.
NOTE
----
Header of all extensions (a.k.a. blocks) are combined to locate
the keyword.
"""
with fits.open(infile) as f:
h = fits.header.Header()
for hdu in f:
h.extend(hdu.header)
value = h[keyword]
comment = h.comments[keyword]
return (value, comment)
评论列表
文章目录