PSFCraft

Python library for Point Spread Function (PSF) simulation of Newtonian telescopes

PSFCraft lets you generate physically accurate PSFs in a few lines of Python — with full control over aperture geometry, wavefront aberrations (Zernike polynomials), pixel scale, field of view, and broadband spectral weighting. It is built on top of POPPY and is designed for astronomers, optical engineers, and anyone building ML datasets from simulated telescope images.

Zernike PSF line


TL;DR

import psfcraft

tel = psfcraft.NewtonianTelescope(version="1_3")
tel.pixelscale = 0.1   # arcsec/pixel
psf = tel.calc_psf(monochromatic=1e-6, fov_pixels=64)
psfcraft.display_psf(psf)

Motivation

Simulating a realistic telescope PSF requires modelling many interacting effects: aperture shape and spider struts, Zernike wavefront errors, diffraction, and spectral weighting for broadband sources. PSFCraft wraps the rigorous Fourier-optics engine of POPPY and packages it into a clean, high-level API tailored to Newtonian/Cassegrain-style telescope geometries (originally developed for the Euclid space mission).


Features

  • Ready-made telescope models — preconfigured Newtonian apertures (circular, with 3/4/5-arm spider variants, adjustable secondary obstruction)
  • Zernike wavefront error injection — pass a coefficient vector (Noll indexing, in metres RMS) to simulate any combination of tip, tilt, defocus, astigmatism, coma, trefoil, …
  • Monochromatic and polychromatic PSFs — flat wavelength or flux-weighted black-body spectrum across Y / J / H photometric bands
  • Image quality metrics — Encircled Energy (EE) curves, EE50/EE80 radii, FWHM
  • Batch generation — WFE budget design + randomised dataset generation for ML pipelines
  • FITS output — standard astropy.io.fits HDUList, ready for downstream analysis
  • Interactive WebUI — single-file, no-dependency browser tool for real-time PSF exploration