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


Python AbsComponent.from_component方法代码示例

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


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

示例1: test_init_failures

# 需要导入模块: from linetools.isgm.abscomponent import AbsComponent [as 别名]
# 或者: from linetools.isgm.abscomponent.AbsComponent import from_component [as 别名]
def test_init_failures():
    with pytest.raises(IOError):
        AbsComponent.from_abslines('blah')
    with pytest.raises(IOError):
        AbsComponent.from_abslines(['blah'])
    with pytest.raises(IOError):
        AbsComponent.from_component('blah')
开发者ID:MSeifert04,项目名称:linetools,代码行数:9,代码来源:test_init_abscomp.py

示例2: test_init_failures

# 需要导入模块: from linetools.isgm.abscomponent import AbsComponent [as 别名]
# 或者: from linetools.isgm.abscomponent.AbsComponent import from_component [as 别名]
def test_init_failures():
    with pytest.raises(IOError):
        AbsComponent.from_abslines('blah')
    with pytest.raises(IOError):
        AbsComponent.from_abslines(['blah'])
    with pytest.raises(IOError):
        AbsComponent.from_component('blah')
    with pytest.raises(IOError):
        AbsComponent((10.0*u.deg, 45*u.deg), (14,2), 1.0, [-300,300]*u.km/u.s, Ej=0.1/u.cm) # need stars!
开发者ID:banados,项目名称:linetools,代码行数:11,代码来源:test_init_abscomp.py

示例3: synthesize_components

# 需要导入模块: from linetools.isgm.abscomponent import AbsComponent [as 别名]
# 或者: from linetools.isgm.abscomponent.AbsComponent import from_component [as 别名]
def synthesize_components(components, zcomp=None, vbuff=0 * u.km / u.s):
    """Synthesize a list of components into one

    Requires consistent RA/DEC, Zion, Ej, (A; future)
    Is agnostic about z+vlim
    Melds column densities
    Melds velocities with a small buffer (10 km/s)

    Note: Could make this a way to instantiate AbsComponent

    Parameters
    ----------
    components : list
      list of AbsComponent objects
    zcomp : float, optional
      Input z to reference the synthesized component
      If not input, the mean of the input components is used
    vbuff : Quantity, optional
      Buffer for synthesizing velocities.  Deals with round off, c, etc.
    """
    # Checks
    assert chk_components(components, chk_A_none=True, chk_match=True)

    # Init final component
    synth_comp = AbsComponent.from_component(
        components[0], Ntup=(components[0].flag_N, components[0].logN, components[0].sig_logN)
    )

    # Meld column densities
    for comp in components[1:]:
        synth_comp.flag_N, synth_comp.logN, synth_comp.sig_logN = ltaa.sum_logN(synth_comp, comp)

    # Meld z, vlim
    # zcomp
    if zcomp is None:
        zcomp = np.mean([comp.zcomp for comp in components])
    synth_comp.zcomp = zcomp
    # Set vlim by min/max  [Using non-relativistic + buffer]
    vmin = u.Quantity([(comp.zcomp - zcomp) / (1 + zcomp) * const.c.to("km/s") + comp.vlim[0] for comp in components])
    vmax = u.Quantity([(comp.zcomp - zcomp) / (1 + zcomp) * const.c.to("km/s") + comp.vlim[1] for comp in components])
    synth_comp.vlim = u.Quantity([np.min(vmin) - vbuff, np.max(vmax) + vbuff])

    # Return
    return synth_comp
开发者ID:nhmc,项目名称:pyigm,代码行数:46,代码来源:utils.py


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