本文整理汇总了Python中astropy.cosmology.FlatLambdaCDM.arcsec_per_kpc_proper方法的典型用法代码示例。如果您正苦于以下问题:Python FlatLambdaCDM.arcsec_per_kpc_proper方法的具体用法?Python FlatLambdaCDM.arcsec_per_kpc_proper怎么用?Python FlatLambdaCDM.arcsec_per_kpc_proper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astropy.cosmology.FlatLambdaCDM
的用法示例。
在下文中一共展示了FlatLambdaCDM.arcsec_per_kpc_proper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: overplot_ruler
# 需要导入模块: from astropy.cosmology import FlatLambdaCDM [as 别名]
# 或者: from astropy.cosmology.FlatLambdaCDM import arcsec_per_kpc_proper [as 别名]
def overplot_ruler(ax, z, pixsize=0.396, rlength_arcsec=10., nx=64, ny=64):
"""
Params
------
ax:
kpc_per_arcsec
pixsize=0.396
in arcsec
rulerlength_arcsec=10.
in arcsec
"""
# import
from astropy.cosmology import FlatLambdaCDM
cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
# set up
xmid = 0.5*nx+5 # x ending point of bar
y = ny-10. # y loc of bar
# conversion
kpc_per_arcsec = 1./cosmo.arcsec_per_kpc_proper(z)
rlength_pix = rlength_arcsec/pixsize
rlength_kpc = (rlength_arcsec*kpc_per_arcsec).value
#===== plotting
ax.plot([xmid-rlength_pix, xmid], [y, y], color='white', lw=2)
ax.plot([xmid-rlength_pix, xmid-rlength_pix], [y+1., y-1.], color='white', lw=2)
ax.plot([xmid, xmid], [y+1., y-1.], color='white', lw=2)
ax.text(xmid+4., y+1, '10" ('+'%.0f'%rlength_kpc+' kpc)', color='white', fontsize=12)