The *BlurFit* system models laboratory measurements of blur
images obtained with a focal plane imaging array using a series of
Zernike polynomials to represent the wavefront distortion in the exit
pupil of an optical system. This is a difficult analysis to perform
correctly and the use of functional programming together with
libraries written to handle multidimensional arrays and vectorized
arithmetic has proven to be effective in framing the problem correctly
and succinctly. The modeling uses a variant of the Levenberg-Marquardt
minimization procedure, combined with monitoring of the Eigenvalue
spectrum of the local curvature matrix to overcome near degeneracies
in the model specification.

*BlurFit* exploits functional programming in two
ways. First, the use of a functional technique limits the spread of
nasty side effects that are so prevalent in a Fortran-like language
that use large COMMON blocks to share data. Second, the elegant data
structures available in an ML language makes the process of data entry
and reporting much easier. Modelers can incorporate new fitting terms
by simply adding equations for their terms to an input specification,
no code changes are necessary. The vectorized math routines are
predominantly imperative for speed of execution, but this is kept
beneath the surface in a well modularized library. External glue
routines were written in C to incorporate a high-performance 2-D FFT
routine, and for numerous Math Recipes routines for matrix inversion
and Eigen-analysis. Visualization of the fitting process is provided
by means of an RPC connection to RSI/IDL. The speed of the system is
roughly 70% of an equivalent written entirely in C, and twice as fast
as one written in RSI/IDL, but the code is inestimably more
maintainable in its functional form.

Also see the homepage: http://www.azstarnet.com/~dmcclain/homepage.htm

**Developer**: David McClain, Sr. Scientist, Raytheon Systems Co.**Contact**:- D.McClain

Raytheon Missile Systems Co.

PO Box 11337, MS 807-M7

Tucson, AZ 85734-1337

USA

Phone: +1 520-794-2099

Email: dmcclain@azstarnet.com

- D.McClain
**Number of sites:**2+**Number of users:**about 5**In use:**since 1/99**Language:**OCAML**Compilers:**ocamlopt**Line count:**about 600 + libraries (total 5K w/comments).**Availability:**For Windows/NT contact D.McClain