Optics Module usage - GalSim-developers/GalSim GitHub Wiki

The GalSim optics module is a collection of simple Python commands for generating images of simple, generic PSFs such as come from Telescope optics, modelled with low order aberrations.

Input aberration coefficients are assumed to be supplied in units of wavelength, and correspond to the definitions given here: http://en.wikipedia.org/wiki/Optical_aberration#Zernike_model_of_aberrations

Example

From within the GalSim base directory (currently), open up a Python interpreter and the commands

import pyfits

import galsim.optics

import numpy as np

followed by

psf = galsim.optics.psf(shape=(512, 512), defocus=-0.3, coma1=-0.15, astig2=0.1, spher=0.01, kmax = np.pi / 16.)

mtf = galsim.optics.mtf(shape=(512, 512), defocus=-0.3, coma1=-0.15, astig2=0.1, spher=0.01, kmax = np.pi / 16.)

pyfits.writeto('psf.fits', psf)

pyfits.writeto('mtf_real.fits', mtf.real)

pyfits.writeto('mtf_imag.fits', mtf.imag)

should leave you with some FITS images of the PSF and MTF (the FT of the PSF) in your starting directory!