自动强引力透镜模型

autolens的Python项目详细描述


pyautolens

当两个或两个以上的星系完全沿着我们的视线排列时,背景星系就会出现多次。这被称为强引力透镜,&;pyautolens使模拟强引力透镜变得简单,就像这个:

alt text

pyautolens基于以下论文:

强引力透镜成像的自适应半线性反演

自动镜头:强光、质量和光源的自动建模

python示例

使用pyautolens,您可以在几分钟内开始为镜头建模。下面的例子演示了一个简单的分析,它适合前景镜头星系的质量和背景光源星系的光线。

importautofitasafimportautolensasalimportos# In this example, we'll fit a simple lens galaxy + source galaxy system.data_path='{}/../data/'.format(os.path.dirname(os.path.realpath(__file__)))lens_name='example_lens'# Get the relative path to the data in our workspace & load the ccd imaging data.ccd_data=al.load_ccd_data_from_fits(image_path=data_path+lens_name+'/image.fits',psf_path=data_path+lens_name+'/psf.fits',noise_map_path=data_path+lens_name+'/noise_map.fits',pixel_scale=0.1)# Create a mask for the data, which we setup as a 3.0" circle.mask=al.Mask.circular(shape=ccd_data.shape,pixel_scale=ccd_data.pixel_scale,radius_arcsec=3.0)# We model our lens galaxy using a mass profile (a singular isothermal ellipsoid) & our source galaxy # a light profile (an elliptical Sersic).lens_mass_profile=al.mass_profiles.EllipticalIsothermalsource_light_profile=al.light_profiles.EllipticalSersic# To setup our model galaxies, we use the GalaxyModel class, which represents a galaxy whose parameters # are variable & fitted for by PyAutoLens. The galaxies are also assigned redshifts.lens_galaxy_model=al.GalaxyModel(redshift=0.5,mass=lens_mass_profile)source_galaxy_model=al.GalaxyModel(redshift=1.0,light=source_light_profile)# To perform the analysis we set up a phase, which takes our galaxy models & fits their parameters using a non-linear# search (in this case, MultiNest).phase=al.PhaseImaging(galaxies=dict(lens=lens_galaxy_model,source=source_galaxy_model),phase_name='example/phase_example',optimizer_class=af.MultiNest)# We pass the ccd data and mask to the phase, thereby fitting it with the lens model above & plot the resulting fit.result=phase.run(data=ccd_data,mask=mask)al.lens_fit_plotters.plot_fit_subplot(fit=result.most_likely_fit)

松弛度

我们正在slack上建立一个pyautolens社区,因此在开始之前,您应该通过我们的slack频道与我们联系。在这里,我将为您提供有关软件的最新更新,并讨论如何在您的科学案例中最好地使用pyautolens。

不幸的是,slack只是邀请,所以首先给我发送一封请求邀请的电子邮件。

功能

pyautolens的高级建模功能包括:

如何操作

pyautolens附带的是Howtolens系列讲座,介绍了使用pyautolens进行强引力透镜建模。它可以在工作区中找到,由4章组成:

工作空间

pyautolens附带一个工作区,可以在这里找到其中包括:

如果使用conda或pip安装pyautolens,则需要从autolens工作区存储库下载工作区,如下面的安装说明所述。

依赖性

pyautolens需要pymultinest&;numba

使用conda安装

我们建议使用conda环境进行安装,因为这样可以在安装pymultinest时避免许多兼容性问题。

首先,安装conda

创建conda环境:

conda create -n autolens python=3.7 anaconda

激活conda环境:

conda activate autolens

安装多嵌套:

conda install -c conda-forge multinest

安装自动镜头:

pip install autolens

克隆autolens workspace&set workspace环境变量:

cd /path/where/you/want/autolens_workspace
git clone https://github.com/Jammy2211/autolens_workspace
export WORKSPACE=/path/to/autolens_workspace/

将pythonpath设置为包含autolens_工作区目录:

export PYTHONPATH=/path/to/autolens_workspace/

您可以通过在autolens_工作区中运行示例pipeline runner来测试所有工作是否正常

python3 /path/to/autolens_workspace/runners/simple/runner__lens_sie__source_inversion.py

使用PIP安装

也可以通过PIP进行安装,但是在安装pymultinest时会遇到一些报告的问题,这些问题会使安装变得困难,请参阅文件install.notes

$ pip install autolens

克隆autolens workspace&set workspace环境变量:

cd /path/where/you/want/autolens_workspace
git clone https://github.com/Jammy2211/autolens_workspace
export WORKSPACE=/path/to/autolens_workspace/

将pythonpath设置为包含autolens_工作区目录:

export PYTHONPATH=/path/to/autolens_workspace/

您可以通过在autolens_工作区中运行示例pipeline runner来测试所有工作是否正常

importautofitasafimportautolensasalimportos# In this example, we'll fit a simple lens galaxy + source galaxy system.data_path='{}/../data/'.format(os.path.dirname(os.path.realpath(__file__)))lens_name='example_lens'# Get the relative path to the data in our workspace & load the ccd imaging data.ccd_data=al.load_ccd_data_from_fits(image_path=data_path+lens_name+'/image.fits',psf_path=data_path+lens_name+'/psf.fits',noise_map_path=data_path+lens_name+'/noise_map.fits',pixel_scale=0.1)# Create a mask for the data, which we setup as a 3.0" circle.mask=al.Mask.circular(shape=ccd_data.shape,pixel_scale=ccd_data.pixel_scale,radius_arcsec=3.0)# We model our lens galaxy using a mass profile (a singular isothermal ellipsoid) & our source galaxy # a light profile (an elliptical Sersic).lens_mass_profile=al.mass_profiles.EllipticalIsothermalsource_light_profile=al.light_profiles.EllipticalSersic# To setup our model galaxies, we use the GalaxyModel class, which represents a galaxy whose parameters # are variable & fitted for by PyAutoLens. The galaxies are also assigned redshifts.lens_galaxy_model=al.GalaxyModel(redshift=0.5,mass=lens_mass_profile)source_galaxy_model=al.GalaxyModel(redshift=1.0,light=source_light_profile)# To perform the analysis we set up a phase, which takes our galaxy models & fits their parameters using a non-linear# search (in this case, MultiNest).phase=al.PhaseImaging(galaxies=dict(lens=lens_galaxy_model,source=source_galaxy_model),phase_name='example/phase_example',optimizer_class=af.MultiNest)# We pass the ccd data and mask to the phase, thereby fitting it with the lens model above & plot the resulting fit.result=phase.run(data=ccd_data,mask=mask)al.lens_fit_plotters.plot_fit_subplot(fit=result.most_likely_fit)
2

支持和讨论

如果您在安装、镜头建模方面遇到困难,或者只是想聊天,请随时在我们的松弛频道上给我们留言。

贡献

如果您有任何建议或想贡献,请与我们联系。

出版物

下面的文章使用pyautolens

引力透镜合并hatlas j142935.3-002836中的分子气体性质

具有强引力透镜的星系结构:分解大质量椭圆星系的内部质量分布

新型子结构和超流体暗物质

CO、H2O、H2O+A z=3.63中的线和尘埃排放在低于千帕尺度的强透镜星暴合并中

学分

开发商

詹姆斯·南丁格尔-首席开发人员和pyautolens大师。

Richard Hayes-首席开发人员&;pyautofit大师。

ashley kelly-用于快速偏转计算的pyquad开发人员。

amy etherington-放大率、临界曲线和焦散计算。

ef="https://github.com/cao xiaoyue" rel="nofollow">cao xiaoyue-解析椭圆幂律偏转角计算。

nan li-Docker集成与支持。

代码捐赠者

andrew robertson-临界曲线和腐蚀性计算。

Mattia Negrello-通过直接傅里叶变换在紫外平面上建立可见性模型。

andrea enia-voronoi源平面绘图工具。

Aristeidis Amvrosiadis-ALMA图像数据加载。

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

推荐PyPI第三方库


热门话题
java Springdata,按视图映射的只读字段   java将会话变量传递给MessageSource   java存储库未与MongoDB和spring自动连接   爪哇为什么我的蚂蚁不动?   如何用一个使用Java泛型的方法替换这些特定于类型的方法?   java画布。半径<1时绘制倒圆   更新m2e项目时出现java错误消息   java如何停止声音   java如果Android活动位于前台,那么向其发送通知意图的合适方式是什么?   借用时java DBCP2超时   java Android apk无法使用PHP通过3g检索数据,在wifi上工作正常   java高亮显示日历视图事件中数据库中的列表数据   java解析一些从php到安卓的JSON时出现问题   java从struts2调用ajax来填充div   java无法正确显示数据库的回迁项   使用Java的selenium Appium iOS自动化:所有具有可访问性ID的元素   java不正确的Linux可用空间   java Else条件在我的JSP中似乎不起作用   java云消息传递(GCM到FCM)