本文整理汇总了Python中astrodata.AstroData.get_key_value方法的典型用法代码示例。如果您正苦于以下问题:Python AstroData.get_key_value方法的具体用法?Python AstroData.get_key_value怎么用?Python AstroData.get_key_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astrodata.AstroData
的用法示例。
在下文中一共展示了AstroData.get_key_value方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: example
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def example():
"""
This is just an example. Cut and paste that on the python prompt.
It can also be run as specplot.example().
"""
import numpy as np
import matplotlib.pyplot as plt
from astropy import wcs
from astrodata import AstroData
ad = AstroData('JHK.fits')
x_values = np.arange(ad.get_key_value('NAXIS1'))
wcs_ad = wcs.WCS(ad.header.tostring())
wlen = wcs_ad.wcs_pix2world(zip(x_values), 0)
plt.plot(wlen, ad.data)
plt.xlabel('Wavelength [Angstrom]')
plt.ylabel('Counts')
plt.axis('tight')
plt.ylim(-100, 800)
plt.show()
ad.close()
#plt.axis[[-100,1000,ymin,ymax]]
示例2: test_method_get_key_val_8
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_8():
ad = AstroData(TESTFILE)
with pytest.raises(AstroDataError):
assert ad.get_key_value('BITPIX')
示例3: test_method_get_key_val_7
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_7():
ad = AstroData(TESTFILE2)
with pytest.raises(TypeError):
assert ad.get_key_value()
示例4: test_method_get_key_val_6
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_6():
ad = AstroData(TESTFILE2)
assert ad.get_key_value('FOO') is None
示例5: test_method_get_key_val_4
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_4():
ad = AstroData(TESTFILE2)
assert ad.get_key_value('DATATYP') is None
示例6: test_method_get_key_val_3
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_3():
ad = AstroData(TESTFILE2)
assert isinstance(ad.get_key_value('CRVAL1'), float)
示例7: test_method_get_key_val_2
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_2():
ad = AstroData(TESTFILE2)
assert isinstance(ad.get_key_value('BITPIX'), int)
示例8: test_method_get_key_val_1
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import get_key_value [as 别名]
def test_method_get_key_val_1():
ad = AstroData(TESTFILE2)
assert isinstance(ad.get_key_value('EXTNAME'), str)