Skip to content

Commit

Permalink
add galsim drawing too
Browse files Browse the repository at this point in the history
  • Loading branch information
ismael-mendoza committed Oct 22, 2024
1 parent b72cb3d commit 4ced761
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bpd/draw.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import galsim
import jax_galsim as xgalsim

GSPARAMS = xgalsim.GSParams(minimum_fft_size=256, maximum_fft_size=256)
Expand Down Expand Up @@ -25,3 +26,26 @@ def draw_gaussian(
gal_conv = xgalsim.Convolve([gal, psf]).withGSParams(GSPARAMS)
image = gal_conv.drawImage(nx=slen, ny=slen, scale=pixel_scale, offset=(x, y))
return image.array


def draw_gaussian_galsim(
f: float,
hlr: float,
e1: float,
e2: float,
g1: float,
g2: float,
x: float,
y: float,
pixel_scale: float = 0.2,
slen: int = 53,
psf_hlr: float = 0.7,
):
gal = galsim.Gaussian(flux=f, half_light_radius=hlr)
gal = gal.shear(g1=e1, g2=e2)
gal = gal.shear(g1=g1, g2=g2)

psf = galsim.Gaussian(flux=1.0, half_light_radius=psf_hlr)
gal_conv = galsim.Convolve([gal, psf])
image = gal_conv.drawImage(nx=slen, ny=slen, scale=pixel_scale, offset=(x, y))
return image.array

0 comments on commit 4ced761

Please sign in to comment.