Imfit (http://www.mpe.mpg.de/~erwin/code/imfit/) is an open-source C++ program for fitting astronomical images (primarily of galaxies) in FITS format. It is fast, flexible, and designed to be easily extended with new functions for model image components.
Examples of Use:
Fitting an image:
$ imfit someimage.fits --config model_description.txt
Fitting a subsection of the image + convolving the model with a Point-Spread-Function image, using Differential Evolution as the solver:
$ imfit someimage.fits[500:750,600:800] --config model_description.txt --psf psf.fits --de
Markov Chain Monte Carlo (MCMC) analysis of the same image + model:
$ imfit-mcmc someimage.fits[500:750,600:800] --config model_description.txt --psf psf.fits
Pre-compiled binaries for Linux and macOS (a.k.a. Mac OS X), along with documentation and example files, can be found at the main web page, as can a condensed source-code distribution suitable for local compilations and for making your own modifications. The most recent full source-code release can be found here.
(Note on pre-compiled binaries: these are compiled as Intel-native binaries. If you have an Apple-Silicon-based Mac [a.k.a. M1 or M2], they will run under the Rosetta 2 emulation system.)
DOI for current release (v1.9.0), archived at Zenodo:
Astronomy Source Code Library entry:
General online documentation is here.
The main manual in PDF format: imfit_howto.pdf
A basic tutorial is also available.
Finally, the paper describing Imfit can be found here: Erwin 2015.
There is a Python package called PyImfit, which wraps Imfit as a library and allows you to construct model images, do fits, use Imfit models in MCMC analyses, etc., within a Python session or script. (documentation for PyImfit)
This repository hosts the complete codebase, including regression and unit tests, miscellaneous extra tests and notes, and assorted (nonessential) auxiliary programs. If all you want to do is use Imfit to model images, it might be simpler to grab the precompiled versions (or the basic source-code tarball) from the main Imfit site.
But if you're more comfortable forking things on Github, now you can! (You can also download the latest official source-code release from this site, here.)
Feel free to open an issue if you find a bug or want to suggest a feature -- or just email me directly [erwin at sigmaxi.net].
Building Imfit requires the following libraries:
- FFTW (version 3)
- CFITSIO (version 3)
- GSL (GNU Scientific Library, version 2.0 or later)
- NLopt -- optional, but strongly recommended
Imfit uses SCons as the build tool, and should build under any version of GCC from 4.8.1 onward, as well as any C++-11-aware version of Clang/LLVM that includes OpenMP support.
See the "Getting and Installing Imfit" chapter of the documentation -- imfit_howto.pdf -- for more details.
Imfit is licensed under version 3 of the GNU Public License.