“Astropy”的版本间差异
		
		
		
		
		
		跳到导航
		跳到搜索
		
				
		
		
	
| 无编辑摘要 | |||
| (未显示同一用户的1个中间版本) | |||
| 第2行: | 第2行: | ||
| :比如星际红化的 [https://learn.astropy.org/tutorials/color-excess.html] | :比如星际红化的 [https://learn.astropy.org/tutorials/color-excess.html] | ||
| ==io== | |||
| * [[astropy.io.fits]] | * [[astropy.io.fits]] | ||
| * ascii文件:Table格式,支持ecsv文件直接读入table | |||
| ==astrometry== | ==astrometry== | ||
| 第15行: | 第16行: | ||
|  >>> Nsel=len(sel[0]) |  >>> Nsel=len(sel[0]) | ||
|  >>> print(ra1[sel][0],ra2[idx[sel][0]) |  >>> print(ra1[sel][0],ra2[idx[sel][0]) | ||
| *算出任意两点之间距离向量的PA角,还有中点坐标 | *算出任意两点之间距离向量的PA角,还有中点坐标[https://docs.astropy.org/en/stable/coordinates/matchsep.html] | ||
| [https://docs.astropy.org/en/stable/coordinates/matchsep.html] | |||
| ==宇宙学== | ==宇宙学== | ||
2024年7月12日 (五) 14:24的最新版本
- 很好的教程网站 [1]
- 比如星际红化的 [2]
io
- astropy.io.fits
- ascii文件:Table格式,支持ecsv文件直接读入table
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])
- 算出任意两点之间距离向量的PA角,还有中点坐标[3]
宇宙学
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)