本文整理汇总了Python中linetools.spectralline.AbsLine.setz方法的典型用法代码示例。如果您正苦于以下问题:Python AbsLine.setz方法的具体用法?Python AbsLine.setz怎么用?Python AbsLine.setz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类linetools.spectralline.AbsLine
的用法示例。
在下文中一共展示了AbsLine.setz方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_multi_absline
# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import setz [as 别名]
def test_init_multi_absline():
# AbsLine(s)
lya = AbsLine(1215.670*u.AA, z=2.92939)
lya.analy['vlim'] = [-300.,300.]*u.km/u.s
lyb = AbsLine(1025.7222*u.AA)
lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
lyb.setz(lya.z)
# Instantiate
abscomp = AbsComponent.from_abslines([lya,lyb])
# Test
assert len(abscomp._abslines) == 2
np.testing.assert_allclose(abscomp.zcomp,2.92939)
示例2: test_stack_plot
# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import setz [as 别名]
def test_stack_plot(show=False):
abslin1 = AbsLine(1548.204*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.setz(2.92929)
ltap.stack_plot([abslin1], show=show)
# second line
abslin2.analy['spec'] = spec
abslin2.analy['wvlim'] = [6079.78, 6168.82]*u.AA
abslin2.setz(2.92929)
ltap.stack_plot([abslin1, abslin2], show=show)
# now with a zref
ltap.stack_plot([abslin1, abslin2], show=show, zref=2.928)
示例3: test_aodm_absline
# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import setz [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
示例4: test_redshift
# 需要导入模块: from linetools.spectralline import AbsLine [as 别名]
# 或者: from linetools.spectralline.AbsLine import setz [as 别名]
def test_redshift():
abslin = AbsLine(1215.6700*u.AA)
abslin.setz(1.)
np.testing.assert_allclose(abslin.z, 1.)
np.testing.assert_allclose(abslin.limits.z, 1.)
np.testing.assert_allclose(abslin.limits._z, 1.)