Table Of Contents

Previous topic


Next topic


This Page

Fitting data with Python

Fitting models to data is one of the key steps in scientific work. Some examples are:

  • fitting some spectrum/spectral line
  • fitting 2D light distribution of a galaxy
  • fitting orbits of exoplanets
  • estimating the galaxy luminosity function from data

Numpy and Scipy provide readily usable tools to fit models to data. Moreover, Python is an excellent environment to develop your own fitting routines for more advanced problems.

Goals of this session

  • How to use implemented routines: leastsq and curve_fit.
  • Astrophysical example: Salpeter mass function.
  • MCMC using emcee the MCMC Hammer


Authors:Eli Bressert, Rene Andrea & Neil Crighton
Copyright:2012, Eli Bressert, Rene Andrae & Neil Crighton
Copyright: Smithsonian Astrophysical Observatory under terms of CC Attribution 3.0 Creative Commons