自动强引力透镜模型
autolens的Python项目详细描述
pyautolens
当两个或两个以上的星系完全沿着我们的视线排列时,背景星系就会出现多次。这被称为强引力透镜,&;pyautolens使模拟强引力透镜变得简单,就像这个:
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环境进行安装,因为这样可以在安装pymultinest时避免许多兼容性问题。
首先,安装conda
创建conda环境: 激活conda环境: 安装多嵌套: 安装自动镜头: 克隆autolens workspace&set workspace环境变量: 将pythonpath设置为包含autolens_工作区目录: 您可以通过在autolens_工作区中运行示例pipeline runner来测试所有工作是否正常 也可以通过PIP进行安装,但是在安装pymultinest时会遇到一些报告的问题,这些问题会使安装变得困难,请参阅文件install.notes功能
如何操作
工作空间
依赖性
使用conda安装
conda create -n autolens python=3.7 anaconda
conda activate autolens
conda install -c conda-forge multinest
pip install autolens
cd /path/where/you/want/autolens_workspace
git clone https://github.com/Jammy2211/autolens_workspace
export WORKSPACE=/path/to/autolens_workspace/
export PYTHONPATH=/path/to/autolens_workspace/
python3 /path/to/autolens_workspace/runners/simple/runner__lens_sie__source_inversion.py
使用PIP安装
$ 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图像数据加载。