builtins作者:Austin Peel,电子邮件:奥斯汀·皮尔@cea.fr公司,年份:2019,Python中的弱透镜工具集合
lenspack的Python项目详细描述
伦斯帕克
Author: Austin Peel
Email: austin.peel@cea.fr
Year: 2019
这个存储库是一个python代码的集合,用于星系目录和剪切/会聚图的弱透镜分析。完整的文档可以在here找到。在
目录
正在进行中。在
依赖关系
安装
将此存储库克隆到本地计算机。您可能会发现在虚拟环境中这样做有助于保持一个干净的工作区。在
$ git clone https://github.com/cosmostat/lenspack.git
将生成一个新目录lenspack
。导航到它。在
运行安装脚本来安装lenspack及其必要的依赖项。在
$ pip install .
该软件包也很快就可以使用pip直接安装了。在
示例
峰值检测
假设你有一个星系目录cat
,它包含天空位置列ra
和{e1
和{
importmatplotlib.pyplotaspltfromlenspack.utilsimportbin2dfromlenspack.image.inversionimportks93fromlenspack.peaksimportfind_peaks2d# Bin ellipticity components based on galaxy position into a 128 x 128 mape1map,e2map=bin2d(cat['ra'],cat['dec'],v=(cat['e1'],cat['e2']),npix=128)# Recover convergence via Kaiser-Squires inversionkappaE,kappaB=ks93(e1map,e2map)# Detect peaks on the convergence E-mode mapx,y,h=find_peaks2d(kappaE,threshold=0.03,include_border=True)# Plot peak positions over the convergencefig,ax=plt.subplots(1,1,figsize=(7,5.5))mappable=ax.imshow(kappaE,origin='lower',cmap='bone')ax.scatter(y,x,s=10,c='orange')# reverse x and y due to array indexingax.set_axis_off()fig.colorbar(mappable)plt.show()
小波变换
使用两种不同的方法对图像进行starlet变换。将结果与给定标度下的等效孔径质量过滤器进行比较。在
importnumpyasnpimportmatplotlib.pyplotaspltfromlenspack.image.transformsimportstarlet2d,mr_transformfromlenspack.image.filtersimportaperture_mass# Generate a test imageimg=np.random.randn(256,256)# Take the starlet transform with 5 wavelet scalesst=starlet2d(img,nscales=5)mrt=mr_transform(img,nscales=5)# The iSAP mr_transform binary is required for this wrapper function to work# Compute the aperture mass map at scale 4 using the starlet filterapm=aperture_mass(img,theta=2**4,filter='starlet')# Plotfig,(ax1,ax2,ax3)=plt.subplots(1,3,figsize=(12,5))ax1.imshow(st[3],cmap='magma')ax2.imshow(mrt[3],cmap='magma')ax3.imshow(apm,cmap='magma')foraxin(ax1,ax2,ax3):ax.set_axis_off()
- 项目
标签: