Astropy
跳到导航
跳到搜索
- 很好的教程网站 [1]
- 比如星际红化的 [2]
astrometry
- match 两个星表
>>> from astropy.coordinates import SkyCoord >>> from astropy import units as u >>> c = SkyCoord(ra=ra1*u.degree, dec=dec1*u.degree) >>> catalog = SkyCoord(ra=ra2*u.degree, dec=dec2*u.degree) >>> idx, d2d, d3d = c.match_to_catalog_sky(catalog) #d3d是假设距离为1的地方的3维距离,因此是以弧度为单位 >>> sel=np.where(d2d.degree < 0.00002) >>> Nsel=len(sel[0]) >>> print(ra1[sel][0],ra2[idx[sel][0])
宇宙学
http://docs.astropy.org/en/stable/cosmology/
- 从红移到年龄
>>>from astropy.cosmology import FlatLambdaCDM >>>cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
>>> lum_dis=cosmo.luminosity_distance(redshift) #计算光度距离
- 从年龄到红移
>>> import astropy.units as u >>> from astropy.cosmology import z_at_value >>> z_at_value(cosmos.age, 2 * u.Gyr)
单位转换
dL=lum_dis.to(u.cm)