“Astropy”的版本间差异

来自Shiyin's note
跳到导航 跳到搜索
(创建页面,内容为“== astropy.io.fits == >>> hdulist = fits.open('input.fits') >>> hdulist.info() *each element of an HDUList is an HDU object with .header and .data attributes, wh...”)
 
无编辑摘要
第1行: 第1行:
== astropy.io.fits ==
== astropy.io.fits ==
[http://docs.astropy.org/en/stable/io/fits/]


>>> hdulist = fits.open('input.fits')
>>> hdulist = fits.open('input.fits')

2017年8月22日 (二) 07:53的版本

astropy.io.fits

[1]

>>> hdulist = fits.open('input.fits')
>>> hdulist.info()
  • each element of an HDUList is an HDU object with .header and .data attributes, which can be used to access the header and data portions of the HDU.
>>> hdulist[0].header['targname']
  • To see the entire header as it appears in the FITS file (with the END card and padding stripped), simply enter the header object by itself, or print(repr(header)):
  • It’s also possible to view a slice of the header:
>>> header[:2]
  • Another way to either update an existing card or append a new one is to use the Header.set() method:
>>> prihdr.set('observer', 'Edwin Hubble')