builtins作者:Austin Peel,电子邮件:奥斯汀·皮尔@cea.fr公司,年份:2019,Python中的弱透镜工具集合

lenspack的Python项目详细描述


伦斯帕克

Build StatusCoverage Status


Author: Austin Peel
Email: austin.peel@cea.fr
Year: 2019


这个存储库是一个python代码的集合,用于星系目录和剪切/会聚图的弱透镜分析。完整的文档可以在here找到。在

目录

正在进行中。在

依赖关系

  • python(3.5版或更高版本)
  • numpy公司
  • 神经质的
  • 阿谀奉承
  • emcee(可选)
  • nicaea(可选)
  • iSAP(可选)

安装

将此存储库克隆到本地计算机。您可能会发现在虚拟环境中这样做有助于保持一个干净的工作区。在

$ git clone https://github.com/cosmostat/lenspack.git

将生成一个新目录lenspack。导航到它。在

^{pr2}$

运行安装脚本来安装lenspack及其必要的依赖项。在

$ pip install .

该软件包也很快就可以使用pip直接安装了。在

示例

峰值检测

假设你有一个星系目录cat,它包含天空位置列ra和{},还有椭圆度分量e1和{}。你可以将星系划分为像素,反转剪切以获得会聚(Kaiser&Squires,1993),探测超过给定阈值的峰值,并将结果绘制如下。在

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()

peaks

小波变换

使用两种不同的方法对图像进行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()

wavelet transfrom

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java需要64位jdk 1.5 for windows   eclipse运算符+对于参数类型java是未定义的。双,爪哇。双人   未下载文件扩展名为的java文件   java不支持带有POST的媒体类型   从动态创建的多个EditText读取文本时发生java错误   java无法为同一xpath单击多个按钮   如何在Java中动态格式化字符串   java Android Clear Middle活动   多线程Java内存模型volatile和x86   git在Java中通过Jgit忽略文件或文件夹   java“决策无法区分输入的备选方案1、2…”   子类的javajpa继承   java需要弄清楚如何操作mutator来弄清楚一个类,教授说,我对如何操作感到困惑   java如何使用JDBC将数据从文件复制到PostgreSQL?