本文整理汇总了Python中astrodata.AstroData.dispersion_axis方法的典型用法代码示例。如果您正苦于以下问题:Python AstroData.dispersion_axis方法的具体用法?Python AstroData.dispersion_axis怎么用?Python AstroData.dispersion_axis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astrodata.AstroData
的用法示例。
在下文中一共展示了AstroData.dispersion_axis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import dispersion_axis [as 别名]
def __init__(self,fname,linelist=None,extv=1,nsum=10,match=6,radius=10):
self.extv = extv
self.nsum = nsum
self.match = match
self.radius = radius
ad = AstroData(fname)
self.imdata = ad['SCI',extv].data
if ad.dispersion_axis() == 2:
# Transpose to work on the X-axis.
self.imdata = self.imdata.transpose()
self.filename = ad.filename
self.ad = ad
linelist_file = linelist
scrpix = 'crpix1'
scrval = 'crval1'
scdelt = 'cd1_1'
fpath=os.path.dirname(spu.__file__)
if ad.is_type('F2_SPECT') or self.ad.is_type('GNIRS'):
reffile = 'calibrated_arc.fits'
wmin = 7035.14 # x*0.24321 + 7035.1381. wavelength at [0]
wmax = 25344.54 # wavelength at [-1]
scrpix = 'crpix2'
scrval = 'crval2'
scdelt = 'cd2_2'
sz = np.shape(self.imdata)
if len(sz) == 3:
self.imdata = self.imdata.reshape(sz[1],sz[2])
if linelist_file==None:
linelist_file = 'argon.dat'
#linelist_file = 'lowresargon.dat'
elif ad.is_type('GMOS_SPECT'):
if linelist_file==None:
linelist_file = 'cuar.dat'
reffile = 'cuar.fits'
wmin = 3053. # x*0.25 + 3053. cuar.fits wavelength at cuarf[0]
wmax = 10423. # cuar.fits wavelength at cuarf[-1]
elif ad.is_type('NIRI_SPECT'):
reffile = 'calibrated_arc.fits'
wmin = 7032.706
wmax = 25342.113
if linelist_file==None:
linelist_file = 'lowresargon.dat'
elif ad.is_type('NIFS_SPECT'):
filtername = str(self.ad.filter_name())
if 'JH' in filtername:
if linelist_file==None:
linelist_file = 'argon.dat'
wmin = 7032.706
wmax = 25342.113
reffile = 'calibrated_arc.fits'
elif 'HK' in filtername:
if linelist_file==None:
linelist_file = 'ArXe_K.dat'
wmin = 20140.259
wmax = 24491.320
reffile = 'NIFS_K_arc_1D.fits'
elif 'ZJ' in filtername:
if linelist_file==None:
linelist_file = 'argon.dat'
wmin = 7035.14
wmax = 25344.54
reffile = 'calibrated_arc.fits'
else:
raise ValueError('Input file is not supported: '+ad.filename)
self.reffile = os.path.join(fpath,reffile)
self.wmin = wmin
self.wmax = wmax
self.pixs=[]
self.users=[]
linelist_file = os.path.join(fpath,linelist_file)
linelist = np.loadtxt(linelist_file,usecols=(0,))
hdr = ad['SCI',extv].header
self.wcs={'crpix':hdr[scrpix], 'crval':hdr[scrval], 'cdelt':hdr[scdelt]}
cdelt = self.wcs['cdelt']
if cdelt < 0:
linelist = linelist[::-1] # Change to decreasing order
self.cuar = linelist # cuar is the IRAF name
self.ad = ad
sz = np.shape(self.imdata)
nsum = 6
if len(sz) == 2:
ny = max(3,nsum/2)
ym = sz[0]/2
lpix = np.mean(self.imdata[ym-ny:ym+ny],axis=0)
elif len(sz) == 1:
#.........这里部分代码省略.........