djbard
djbard

Reputation: 23

Interpolating PSF parameters with galsim

I'm hoping I can use Galsim to test various methods of PSF interpolation. I want to generate an image with galaxies, sample the PSF at various points and interpolate the PSF to the galaxy locations. The examples demonstrate how to generate a PSF at a specific location - is it possible to generate a PSF across an image and sample it at different points? The Great03 galsim webpage promises 'Realistic noise with spatial correlations', which sounds promising!

Upvotes: 2

Views: 253

Answers (1)

Mike Jarvis
Mike Jarvis

Reputation: 919

Please take a look at demo10 in the GalSim examples directory. That example includes a PSF that varies with position.

The basic idea is that the parameters of the PSF model would be functions of (x,y), and then you would build the PSF model at the location of your galaxy. For example (from 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)

You can also do the same thing with the configuration file method. Here is the relevant part of 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' 

The variable PSF used for the Great3 challenge did basically this, but with a much more complicated PSF model.

Upvotes: 1

Related Questions