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


Python AbsLine.measure_aodm方法代码示例

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


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

示例1: test_voigt_model

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import measure_aodm [as 别名]
def test_voigt_model():
    from astropy.modeling import fitting
    # Wavelength array
    wave = np.linspace(3644, 3650, 100)*u.AA
    # HI line
    abslin = AbsLine(1215.670*u.AA, z=2.)
    abslin.attrib['N'] = 10**14./u.cm**2
    abslin.attrib['b'] = 25.*u.km/u.s
    # Voigt
    vmodel = abslin.generate_voigt(wave=wave)
    vmodel.sig = 0.1
    # Voigt fit
    abslin.analy['spec'] = vmodel
    abslin.limits.set([-100.,100]*u.km/u.s)
    abslin.measure_aodm(normalize=False)  # Sets analysis pixels
    fitvoigt = lav.single_voigt_model(logN=np.log10(abslin.attrib['N'].value),
        b=abslin.attrib['b'].value, z=2., wrest=abslin.wrest.value,
        gamma=abslin.data['gamma'].value,
        f=abslin.data['f'], fwhm=3.)
    # Restrict parameter space
    fitvoigt.logN.min = 12.
    fitvoigt.b.min = 10.
    fitvoigt.z.min = 2. + -100. * (1 + 2.) / c_kms
    fitvoigt.z.max = 2. + 100 * (1 + 2.) / c_kms

    # Fit
    fitter = fitting.LevMarLSQFitter()
    parm = fitter(fitvoigt,vmodel.wavelength[abslin.analy['pix']].value,
                  vmodel.flux[abslin.analy['pix']].value)
    assert np.abs(parm.logN.value-np.log10(abslin.attrib['N'].value)) < 0.1
开发者ID:linetools,项目名称:linetools,代码行数:32,代码来源:test_voigt.py

示例2: test_aodm_absline

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

    # Set spectrum
    abslin.analy['spec'] = lsio.readspec(data_path('UM184_nF.fits')) # Fumagalli+13 MagE spectrum
    abslin.analy['wvlim'] = [6080.78, 6087.82]*u.AA
    #
    abslin.measure_aodm()
    N, sigN, flgN = [abslin.attrib[key] for key in ['N','sigN','flagN']]

    np.testing.assert_allclose(N.value, 300009659372018.7)
    assert N.unit == 1/u.cm**2
    assert flgN == 1
    # Now velocity limits

    abslin.analy['wvlim'] = np.zeros(2)*u.AA
    abslin.analy['vlim'] = (-150., 150.)*u.km/u.s
    abslin.attrib['z'] = 2.92929
    #
    abslin.measure_aodm()
    N, sigN, flgN = [abslin.attrib[key] for key in ['N','sigN','flagN']]
    np.testing.assert_allclose(N.value, 80369196079224.42)
开发者ID:nhmc,项目名称:linetools,代码行数:25,代码来源:test_absline_anly.py

示例3: test_aodm_absline

# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import measure_aodm [as 别名]
def test_aodm_absline():
    # Init CIV 1548
    abslin = AbsLine('CIV 1548', z=2.9304)

    # Set spectrum
    abslin.analy['spec'] = lsio.readspec(data_path('UM184_nF.fits')) # Fumagalli+13 MagE spectrum
    abslin.limits.set([6080.78, 6087.82]*u.AA)
    #abslin.analy['wvlim'] = [6080.78, 6087.82]*u.AA
    #
    abslin.measure_aodm()
    N, sig_N, flgN = [abslin.attrib[key] for key in ['N','sig_N','flag_N']]

    np.testing.assert_allclose(N.value, 76369981945649.38)
    assert N.unit == 1/u.cm**2
    assert flgN == 1

    # Now velocity limits
    abslin.setz(2.92929)
    abslin.limits.set((-150., 150.)*u.km/u.s)
    #
    abslin.measure_aodm()
    N, sig_N, flgN = [abslin.attrib[key] for key in ['N','sig_N','flag_N']]
    np.testing.assert_allclose(N.value, 80410608889125.64)
    return
开发者ID:linetools,项目名称:linetools,代码行数:26,代码来源:test_absline_anly.py


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