demo9 in Galsim illustrates this: - https://github.com/GalSim-developers/GalSim/blob/releases/2.4/examples/demo9.py