Skip to main content
 首页 » 编程设计

python之用 galsim 插值 PSF 参数

2025年05月04日11mengfanrong

我希望我可以使用 Galsim测试 PSF 插值的各种方法。我想生成一个包含星系的图像,在不同点对 PSF 进行采样,然后将 PSF 插值到星系位置。这些示例演示了如何在特定位置生成 PSF - 是否可以跨图像生成 PSF 并在不同点对其进行采样? Great03 galsim 网页 promise “具有空间相关性的真实噪声”,这听起来很有希望!

请您参考如下方法:

请看demo10在 GalSim 示例目录中。该示例包括随位置变化的 PSF。

基本思想是 PSF 模型的参数是 (x,y) 的函数,然后您将在您的星系所在位置构建 PSF 模型。例如(来自 demo10.py):

pos = b.trueCenter() - im_center 
pos = galsim.PositionD(pos.x * pixel_scale , pos.y * pixel_scale) 
# The image comes out as about 211 arcsec across, so we define our variable 
# parameters in terms of (r/100 arcsec), so roughly the scale size of the image. 
r = math.sqrt(pos.x**2 + pos.y**2) / 100 
psf_fwhm = 0.9 + 0.5 * r**2   # arcsec 
psf_e = 0.4 * r**1.5 
psf_beta = (math.atan2(pos.y,pos.x) + math.pi/2) * galsim.radians 
 
# Define the PSF profile 
psf = galsim.Gaussian(fwhm=psf_fwhm) 
psf.applyShear(e=psf_e, beta=psf_beta) 

你也可以用配置文件的方法做同样的事情。以下是 demo10.yaml 的相关部分:

psf :  
    type : Gaussian 
    fwhm :      
        type : Eval 
        str : '0.9 + 0.5 * (sky_pos.x**2 + sky_pos.y**2) / 100**2' 
    ellip: 
        type : EBeta 
        e :  
            type : Eval 
            fr : { type : Eval , str : '(sky_pos.x**2 + sky_pos.y**2)**0.5' }  
            str : '0.4 * (r/100)**1.5' 
        beta: 
            type : Eval 
            str : '(math.atan2(sky_pos.y,sky_pos.x) + math.pi/2.) * galsim.radians'  

用于 Great3 挑战的变量 PSF 基本上做到了这一点,但使用了一个复杂得多的 PSF 模型。