本文整理汇总了Python中linetools.spectralline.AbsLine.attrib['vel']方法的典型用法代码示例。如果您正苦于以下问题:Python AbsLine.attrib['vel']方法的具体用法?Python AbsLine.attrib['vel']怎么用?Python AbsLine.attrib['vel']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类linetools.spectralline.AbsLine
的用法示例。
在下文中一共展示了AbsLine.attrib['vel']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: abslines_from_VPfile
# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['vel'] [as 别名]
def abslines_from_VPfile(parfile,specfile=None,ra=None,dec=None):
'''
Takes a joebvp parameter file and builds a list of linetools AbsLines from the measurements therein.
Parameters
----------
parfile : str
Name of the parameter file in the joebvp format
ra : float, optional
Right Ascension of the QSO in decimal degrees
dec : float, optional
Declination of the QSO in decimal degress
Returns
-------
abslinelist: list
List of AbsLine objects
'''
from linetools.spectralline import AbsLine
from linetools.lists.linelist import LineList
import astropy.units as u
llist = LineList('ISM')
if specfile!=None:
spec=readspec(specfile) # Allow spectrum file to be declared in call
linetab = ascii.read(parfile) # Read parameters from file
linetab['restwave']=linetab['restwave']*u.AA
abslinelist = [] # Initiate list to populate
for i,row in enumerate(linetab):
### Check to see if errors for this line are defined
colerr,berr,velerr=get_errors(linetab,i)
### Adjust velocity limits according to centroid errors and limits from file
vcentmin = row['vel']-velerr
vcentmax = row['vel']+velerr
v1 = vcentmin + row['vlim1']
v2 = vcentmax + row['vlim2']
line=AbsLine(row['restwave']*u.AA, z=row['zsys'],closest=True, linelist=llist)
vlims=[v1,v2]*u.km/u.s
line.limits.set(vlims)
### Set other parameters
line.attrib['logN'] = row['col']
line.attrib['sig_logN'] = colerr
line.attrib['b'] = row['bval'] * u.km/u.s
line.attrib['sig_b'] = berr * u.km/u.s
line.attrib['vel'] = row['vel'] * u.km/u.s
### Attach the spectrum to this AbsLine but check first to see if this one is same as previous
if specfile==None:
if i==0:
spec=readspec(row['specfile'])
elif row['specfile']!=linetab['specfile'][i-1]:
spec=readspec(row['specfile'])
else:
pass
line.analy['spec']=spec
### Add it to the list and go on
abslinelist.append(line)
return abslinelist