# Pupil function

The pupil function or aperture function describes how a light wave is affected upon transmission through an optical imaging system such as a camera, microscope, or the human eye. More specifically, it is a complex function of the position in the pupil or aperture (often an iris) that indicates the relative change in amplitude and phase of the light wave. Sometimes this function is referred to as the generalized pupil function, in which case pupil function only indicates whether light is transmitted or not. Imperfections in the optics typically have a direct effect on the pupil function, it is therefore an important tool to study optical imaging systems and their performance.

## Relationship with other functions in optics

The complex pupil function $\mathrm {P} (u,v)$ can be written in polar coordinates using two real functions:
    $\mathrm {P} (u,v)=\mathrm {A} (u,v)\cdot \mathrm {exp} (i\,\mathrm {\Theta } (u,v))$,
where $\mathrm {\Theta } (u,v)$ is the phase change (in radians) introduced by the optics, or the surrounding medium. It captures all optical aberrations that occur between the image plane and the focal plane in the scene or sample. The light may also be attenuated differently at different positions $(u,v)$ in the pupil, sometimes deliberately for the purpose of apodization. Such change in amplitude of the light wave is described by the factor $\mathrm {A} (u,v)$.
The pupil function is also directly related to the point spread function by its Fourier transform. As such, the effect of aberrations on the point spread function can be described mathematically using the concept of the pupil function.
Since the (incoherent) point spread function is also related to the optical transfer function via a Fourier transform, a direct relationship exists between the pupil function and the optical transfer function. In the case of an incoherent optical imaging system, the optical transfer function is the auto correlation of the pupil function.

## Examples
### In focus

In a homogeneous medium, a point source emits light with spherical wave fronts. A lens that is focused onto the point source will have optics that change the spherical wave front into a planar wave before it passes through the pupil or aperture stop. Often, additional lens element refocus the light onto a sensor or photographic film, by converting the planar wave front to a spherical wave front, centered onto the image plane. The pupil function of such an ideal system is equal to one at every point within the pupil, and zero out with it. In case of a circular pupil, this can be written mathematically as:
    $\mathrm {P} (u,v)=1,\forall u,v:{\sqrt {u^{2}+v^{2}}}\leq R$
    $\mathrm {P} (u,v)=0,\forall u,v:{\sqrt {u^{2}+v^{2}}}>R,$
where $R$ is the pupil radius.

### Out of focus

When the point source is out of focus, the spherical wave will not be completely made planar by the optics, but will have an approximately parabolic wave front: $k(u^{2}+v^{2})$. Such a variation in optical path length corresponds to a radial variation in the complex argument of the pupil function:
    $\mathrm {P} (u,v)=\mathrm {exp} (i\,k(u^{2}+v^{2})),\forall u,v:{\sqrt {u^{2}+v^{2}}}\leq R$
    $\mathrm {P} (u,v)=0,$ otherwise.
It is thus possible to deduce the point-spread function of the out of focus point source as the Fourier transform of the pupil function.

### Aberrated Optics

The spherical wave could also be deformed by imperfect optics to an approximately cylindrical wave front: $ku^{2}$.
    $\mathrm {P} (u,v)=\mathrm {exp} (i\,ku^{2}),\forall u,v:{\sqrt {u^{2}+v^{2}}}\leq R$
    $\mathrm {P} (u,v)=0,$ otherwise.
Such a variation in optical path length will create an image that is blurred only in one dimension as is typical of systems with astigmatism.