当前位置: 首页>>代码示例>>Python>>正文


Python AbsLine.vpeak方法代码示例

本文整理汇总了Python中linetools.spectralline.AbsLine.vpeak方法的典型用法代码示例。如果您正苦于以下问题:Python AbsLine.vpeak方法的具体用法?Python AbsLine.vpeak怎么用?Python AbsLine.vpeak使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在linetools.spectralline.AbsLine的用法示例。


在下文中一共展示了AbsLine.vpeak方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_zpeak

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import vpeak [as 别名]
    def get_zpeak(self):
        """ Measure zpeak from an ionic transition
        """
        if self.ions is None:
            print('get_zpeak: Need to fill ions with get_ions first.')
            return

        # Ions for analysis
        low_ions = [ (14,2), (6,2), (13,2), (26,2), (13,3)]  # SiII,CII,AlII,FeII,AlIII
        high_ions= [(14,4), (6,4)]  # SiIV, CIV

        for tt in range(4):
            if tt == 0:
                ions = low_ions
                iflg = 1 # Standard
            elif tt == 1:
                ions = low_ions
                iflg = 2 # Saturated
            elif tt == 2:
                ions = high_ions
                iflg = 1 # Standard
            elif tt == 3:
                ions = high_ions
                iflg = 2 # Standard
            else:
                raise ValueError('Bad value')

            # Search 
            for ion in ions:
                try:
                    t = self.ions[ion]
                except KeyError:
                    continue
                # Measurement?
                if t['flag_N'] == iflg:
                # Identify the transition
                    gdi = np.where( (self.ions.trans['Z'] == ion[0]) &
                                (self.ions.trans['ion'] == ion[1]) &
                                (self.ions.trans['flag_N'] <= iflg) )[0]
                    # Take the first one
                    gdt = self.ions.trans[gdi[0]]
                    wrest = gdt['wrest']
                    flgs = self.clm_analy.clm_lines[wrest].analy['FLAGS']
                    spec_file = self.clm_analy.fits_files[flgs[1] % 64]
                    # Generate an Abs_Line with spectrum
                    line = AbsLine(wrest, z=self.clm_analy.zsys, spec_file=spec_file)
                    # vpeak
                    from linetools import utils as ltu
                    vpeak = line.vpeak()
                    self.zpeak = ltu.z_from_v(self.clm_analy.zsys, vpeak)
                    if tt == 3:
                        print('zpeak WARNING: Using saturated high-ions!!')
                    break
            else:
                continue
            break

        # Error catching
        if self.zpeak is None:
            # Skip primordial LLS
            print('lls.zpeak: No transition in {:s}'.format(self.clm_analy.clm_fil))
            return (0,0), 0.
        # Return
        return ion, vpeak
开发者ID:mneeleman,项目名称:pyigm,代码行数:66,代码来源:lls.py


注:本文中的linetools.spectralline.AbsLine.vpeak方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。