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


Python AbsLine.attrib['z']方法代码示例

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


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

示例1: test_multi_components

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_multi_components():
    radec = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg)
    # HI Lya, Lyb
    lya = AbsLine(1215.670*u.AA)
    lya.analy['vlim'] = [-300.,300.]*u.km/u.s
    lya.attrib['z'] = 2.92939
    lyb = AbsLine(1025.7222*u.AA)
    lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
    lyb.attrib['z'] = lya.attrib['z']
    abscomp = AbsComponent.from_abslines([lya,lyb])
    abscomp.coord = radec
    # SiII
    SiIItrans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808']
    abslines = []
    for trans in SiIItrans:
        iline = AbsLine(trans)
        iline.attrib['z'] = 2.92939
        iline.analy['vlim'] = [-250.,80.]*u.km/u.s
        abslines.append(iline)
    #
    SiII_comp = AbsComponent.from_abslines(abslines)
    SiII_comp.coord = radec
    # Instantiate
    LLSsys = GenericAbsSystem.from_components([abscomp,SiII_comp])
    # Test
    assert len(LLSsys._components) == 2
开发者ID:MSeifert04,项目名称:linetools,代码行数:28,代码来源:test_init_abssys.py

示例2: test_add_component

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_add_component():
    radec = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg)
    # HI Lya, Lyb
    lya = AbsLine(1215.670*u.AA)
    lya.analy['vlim'] = [-300.,300.]*u.km/u.s
    lya.attrib['z'] = 2.92939
    lya.attrib['N'] = 1e17 /  u.cm**2
    lyb = AbsLine(1025.7222*u.AA)
    lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
    lyb.attrib['z'] = lya.attrib['z']
    abscomp = AbsComponent.from_abslines([lya,lyb])
    abscomp.coord = radec
    # Instantiate
    abssys = GenericAbsSystem.from_components([abscomp])
    # New component
    oi = AbsLine('OI 1302')
    oi.analy['vlim'] = [-300.,300.]*u.km/u.s
    oi.attrib['z'] = lya.attrib['z']
    abscomp2 = AbsComponent.from_abslines([oi])
    abscomp2.coord = radec
    # Standard
    assert abssys.add_component(abscomp2)
    # Fail
    abssys = GenericAbsSystem.from_components([abscomp])
    abscomp2.vlim = [-400.,300.]*u.km/u.s
    assert not abssys.add_component(abscomp2)
    # Overlap
    assert abssys.add_component(abscomp2, overlap_only=True)
开发者ID:lwymarie,项目名称:linetools,代码行数:30,代码来源:test_init_abssys.py

示例3: test_list_of_abslines

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_list_of_abslines():
    radec = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg)
    # HI Lya, Lyb
    lya = AbsLine(1215.670*u.AA)
    lya.analy['vlim'] = [-300.,300.]*u.km/u.s
    lya.attrib['z'] = 2.92939
    lyb = AbsLine(1025.7222*u.AA)
    lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
    lyb.attrib['z'] = lya.attrib['z']
    abscomp = AbsComponent.from_abslines([lya,lyb])
    abscomp.coord = radec
    # SiII
    SiIItrans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808']
    abslines = []
    for trans in SiIItrans:
        iline = AbsLine(trans)
        iline.attrib['z'] = 2.92939
        iline.analy['vlim'] = [-250.,80.]*u.km/u.s
        abslines.append(iline)
    #
    SiII_comp = AbsComponent.from_abslines(abslines)
    SiII_comp.coord = radec
    # Instantiate
    gensys = GenericAbsSystem.from_components([abscomp,SiII_comp])
    # Now the list
    abslines = gensys.list_of_abslines()
    # Test
    assert len(abslines) == 6
    # Grab one line
    lyb = gensys.get_absline('HI 1025')
    np.testing.assert_allclose(lyb.wrest.value, 1025.7222)
    lyb = gensys.get_absline(1025.72*u.AA)
    np.testing.assert_allclose(lyb.wrest.value, 1025.7222)
开发者ID:ntejos,项目名称:linetools,代码行数:35,代码来源:test_use_abssys.py

示例4: lyman_comp

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def lyman_comp(radec):
    # HI Lya, Lyb
    lya = AbsLine(1215.670*u.AA)
    lya.analy['vlim'] = [-300.,300.]*u.km/u.s
    lya.attrib['z'] = 2.92939
    lya.attrib['N'] = 1e17 /  u.cm**2
    lyb = AbsLine(1025.7222*u.AA)
    lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
    lyb.attrib['z'] = lya.attrib['z']
    abscomp = AbsComponent.from_abslines([lya,lyb])
    abscomp.coord = radec
    return abscomp
开发者ID:banados,项目名称:linetools,代码行数:14,代码来源:test_init_abssys.py

示例5: test_ismatch

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_ismatch():
    # Init CIV 1548
    abslin = AbsLine(1548.195*u.AA)
    abslin.attrib['z'] = 1.2322

    abslin2 = AbsLine(1548.195*u.AA)
    abslin2.attrib['z'] = 1.2322

    assert abslin.ismatch(abslin2)
    # tuples
    assert abslin.ismatch((1.2322,1548.195*u.AA))
    assert abslin.ismatch((1.2322,1548.195*u.AA),Zion=(6,4))
开发者ID:nhmc,项目名称:linetools,代码行数:14,代码来源:test_absline_anly.py

示例6: test_init_multi_absline

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_init_multi_absline():
    # AbsLine(s)
    lya = AbsLine(1215.670*u.AA)
    lya.analy['vlim'] = [-300.,300.]*u.km/u.s
    lya.attrib['z'] = 2.92939
    lyb = AbsLine(1025.7222*u.AA)
    lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
    lyb.attrib['z'] = lya.attrib['z']
    # Instantiate
    abscomp = AbsComponent.from_abslines([lya,lyb])
    # Test
    assert len(abscomp._abslines) == 2
    np.testing.assert_allclose(abscomp.zcomp,2.92939)
开发者ID:MSeifert04,项目名称:linetools,代码行数:15,代码来源:test_init_abscomp.py

示例7: test_build_table

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_build_table():
    # AbsLine(s)
    lya = AbsLine(1215.670*u.AA)
    lya.analy['vlim'] = [-300.,300.]*u.km/u.s
    lya.attrib['z'] = 2.92939
    lyb = AbsLine(1025.7222*u.AA)
    lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
    lyb.attrib['z'] = lya.attrib['z']
    # Instantiate
    abscomp = AbsComponent.from_abslines([lya,lyb])
    comp_tbl = abscomp.build_table()
    # Test
    assert isinstance(comp_tbl,QTable)
开发者ID:nhmc,项目名称:linetools,代码行数:15,代码来源:test_use_abscomp.py

示例8: mk_comp

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def mk_comp(ctype,vlim=[-300.,300]*u.km/u.s,add_spec=False, use_rand=True,
            add_trans=False, zcomp=2.92939):
    # Read a spectrum Spec
    if add_spec:
        xspec = lsio.readspec(lt_path+'/spectra/tests/files/UM184_nF.fits')
    else:
        xspec = None
    # AbsLines
    if ctype == 'HI':
        all_trans = ['HI 1215', 'HI 1025']
    elif ctype == 'SiII':
        all_trans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808']
        if add_trans:
            all_trans += ['SiII 1193']
    abslines = []
    for trans in all_trans:
        iline = AbsLine(trans)
        iline.attrib['z'] = zcomp
        if use_rand:
            rnd = np.random.rand()
        else:
            rnd = 0.
        iline.attrib['logN'] = 13.3 + rnd
        iline.attrib['sig_logN'] = 0.15
        iline.attrib['flag_N'] = 1
        iline.analy['spec'] = xspec
        iline.analy['vlim'] = vlim
        iline.analy['wvlim'] = iline.wrest * (1 + zcomp + ltu.give_dz(vlim, zcomp))
        _,_ = ltaa.linear_clm(iline.attrib)  # Loads N, sig_N
        abslines.append(iline)
    # Component
    abscomp = AbsComponent.from_abslines(abslines)
    return abscomp, abslines
开发者ID:banados,项目名称:linetools,代码行数:35,代码来源:test_use_abscomp.py

示例9: fill_lls_lines

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
    def fill_lls_lines(self, bval=20.*u.km/u.s):
        """
        Generate an HI line list for an LLS.
        Goes into self.lls_lines 

        Parameters
        ----------
        bval : float (20.)  Doppler parameter in km/s
        """
        from linetools.lists import linelist as lll
        from linetools.spectralline import AbsLine

        # May be replaced by component class (as NT desires)
        HIlines = lll.LineList('HI')

        self.lls_lines = []
        for lline in HIlines._data:
            aline = AbsLine(lline['wrest'],linelist=HIlines)
            # Attributes
            aline.attrib['N'] = self.NHI
            aline.attrib['b'] = bval
            aline.attrib['z'] = self.zabs
            # Could set RA and DEC too
            aline.attrib['RA'] = self.coord.ra
            aline.attrib['DEC'] = self.coord.dec
            self.lls_lines.append(aline)
开发者ID:nhmc,项目名称:xastropy,代码行数:28,代码来源:lls_utils.py

示例10: stack_plot

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
 def stack_plot(self, inp, use_lines=None, ymnx=None, add_lines=None, **kwargs):
     """ Generate a stack plot of the key lines for a given COS-Halos system
     Parameters
     ----------
     inp : int or tuple
       int -- Index of the cgm_abs list
       tuple -- (field,gal_id)
     add_lines : list, optional
       List of additional lines to plot
     """
     # Init
     from linetools.analysis import plots as ltap
     if ymnx is None:
         ymnx=(-0.1,1.2)
     cgm_abs = self[inp]
     abs_lines = []
     # Setup the lines (defaults to a key seto)
     if use_lines is None:
         use_lines = [1215.6700, 1025.7223, 1334.5323, 977.020, 1031.9261, 1037.6167,
                      1260.4221, 1206.500, 1393.7550, 2796.352]*u.AA
         if add_lines is not None:
             use_lines = list(use_lines.value) + add_lines
             use_lines.sort()
             use_lines = use_lines*u.AA
     for iline in use_lines:
         spec = self.load_bg_cos_spec(inp, iline)
         if spec is None:
             print('Skipping {:g}. Assuming no coverage'.format(iline))
         aline = AbsLine(iline, closest=True)
         aline.analy['spec'] = spec
         aline.attrib['z'] = cgm_abs.galaxy.z
         abs_lines.append(aline)
     # Execute
     ltap.stack_plot(abs_lines, vlim=[-400., 400]*u.km/u.s, ymnx=ymnx, **kwargs)
开发者ID:pyigm,项目名称:pyigm,代码行数:36,代码来源:cos_halos.py

示例11: add_DLA

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
    def add_DLA(self,z, NHI=20.3,bval=30.*u.km/u.s, comment='None', model=True):
        """Generate a new DLA
        """
        # Lya, Lyb
        dla_lines = []  # For convenience
        for trans in ['HI 1025', 'HI 1215']:
            iline = AbsLine(trans)
            iline.attrib['z'] = z
            iline.attrib['N'] = 10**NHI / u.cm**2
            iline.attrib['b'] = bval
            iline.attrib['coord'] = SkyCoord(ra=0*u.deg,dec=0*u.deg)
            dla_lines.append(iline)
        # Generate system
        new_sys = DLASystem.from_abslines(dla_lines) #(0*u.deg,0*u.deg),z,None,NHI)
        new_sys.bval = bval # This is not standard, but for convenience
        new_sys.comment = comment
        new_sys.dla_lines = dla_lines  # Also for convenience
        # Name
        self.count_dla += 1
        new_sys.label = 'DLA_Sys_{:d}'.format(self.count_dla)
        # Add
        self.abssys_widg.add_fil(new_sys.label)
        self.abssys_widg.all_abssys.append(new_sys)
        self.abssys_widg.abslist_widget.item(
            len(self.abssys_widg.all_abssys)).setSelected(True)

        # Update
        self.llist['Plot'] = False # Turn off metal-lines
        if model:  # For dealing with initialization
            self.update_model()
开发者ID:jhennawi,项目名称:xastropy,代码行数:32,代码来源:xfitdlagui.py

示例12: fill_lls_lines

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
    def fill_lls_lines(self, bval=20.*u.km/u.s, do_analysis=1):
        """
        Generate an HI line list for an LLS.
        Goes into self.lls_lines 

        Now generates a component too.
        Should have it check for an existing HI component..

        Parameters
        ----------
        bval : float, optional
          Doppler parameter in km/s
        do_analysis : int, optional
          flag for analysis
        """
        from linetools.lists import linelist as lll

        # May be replaced by component class (as NT desires)
        HIlines = lll.LineList('HI')

        self.lls_lines = []
        Nval = 10**self.NHI / u.cm**2
        for lline in HIlines._data:
            aline = AbsLine(lline['wrest'], linelist=HIlines)
            # Attributes
            aline.attrib['N'] = Nval
            aline.attrib['b'] = bval
            aline.attrib['z'] = self.zabs
            aline.analy['vlim'] = self.vlim
            aline.analy['do_analysis'] = do_analysis
            aline.attrib['coord'] = self.coord
            self.lls_lines.append(aline)
        # Generate a component (should remove any previous HI)
        self.add_component(AbsComponent.from_abslines(self.lls_lines))
开发者ID:mneeleman,项目名称:pyigm,代码行数:36,代码来源:lls.py

示例13: test_stack_plot

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_stack_plot(show=False):
    abslin1 = AbsLine(1548.195*u.AA)
    abslin2 = AbsLine('CIV 1550')
    # no spectrum first
    ltap.stack_plot([abslin1], show=show)
    # Set spectrum
    spec = ltsio.readspec(data_path('UM184_nF.fits'))  # already normalized
    abslin1.analy['spec'] = spec
    abslin1.analy['wvlim'] = [6079.78, 6168.82]*u.AA
    abslin1.attrib['z'] = 2.92929
    ltap.stack_plot([abslin1], show=show)
    # second line
    abslin2.analy['spec'] = spec
    abslin2.analy['wvlim'] = [6079.78, 6168.82]*u.AA
    abslin2.attrib['z'] = 2.92929
    ltap.stack_plot([abslin1, abslin2], show=show)
开发者ID:jnburchett,项目名称:linetools,代码行数:18,代码来源:test_plots.py

示例14: read_ion_file

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
    def read_ion_file(self,ion_fil,zabs=0.,RA=0.*u.deg, Dec=0.*u.deg):
        """Read in JXP-style .ion file in an appropriate manner

        NOTE: If program breaks in this function, check the all file 
        to see if it is properly formatted.
        """
        # Read
        names=('wrest', 'clm', 'sig_clm', 'flg_clm', 'flg_inst') 
        table = ascii.read(ion_fil, format='no_header', names=names) 

        if self.linelist is None:
            self.linelist = LineList('ISM')

        # Generate AbsLine's
        for row in table:
            # Generate the line
            aline = AbsLine(row['wrest']*u.AA, linelist=self.linelist, closest=True)
            # Set z, RA, DEC, etc.
            aline.attrib['z'] = self.zabs
            aline.attrib['RA'] = self.coord.ra
            aline.attrib['Dec'] = self.coord.dec
            # Check against existing lines
            mt = [kk for kk,oline in enumerate(self.lines) if oline.ismatch(aline)]
            if len(mt) > 0:
                mt.reverse()
                for imt in mt:
                    print('read_ion_file: Removing line {:g}'.format(self.lines[imt].wrest))
                    self.lines.pop(imt)
            # Append
            self.lines.append(aline)
开发者ID:nhmc,项目名称:xastropy,代码行数:32,代码来源:abssys_utils.py

示例15: test_voigt_multi_line

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import attrib['z'] [as 别名]
def test_voigt_multi_line():
    # Wavelength array
    wave = np.linspace(3644, 3650, 100)*u.AA
    imn = np.argmin(np.abs(wave.value-3646.2))
    # HI line
    abslin = AbsLine(1215.670*u.AA)
    abslin.attrib['N'] = 10**17.5/u.cm**2
    abslin.attrib['b'] = 20.*u.km/u.s
    abslin.attrib['z'] = 2.0
    # DI line
    abslin2 = AbsLine('DI 1215')
    abslin2.attrib['N'] = 10**13./u.cm**2
    abslin2.attrib['b'] = 15.*u.km/u.s
    abslin2.attrib['z'] = 2.0
    # Voigt
    vmodel3 = voigt_from_abslines(wave,[abslin,abslin2])
    np.testing.assert_allclose(vmodel3.flux[imn].value,0.5715512949324375)
开发者ID:MSeifert04,项目名称:linetools,代码行数:19,代码来源:test_voigt.py


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