Tag: science

Using a Makefile for science!

The declarative style of a Makefile (or substitute your own language-of-choice’s implementation of *akefiles) lends itself well to scientific processes, where a reproducible method is crucial. I recently found this out when analysing some data, which consisted of the following: compile the source code of the programs I was using use these programs on the same data plot some summary plots show the plots With the declarative style of Makefiles I could rely on the latest results no matter what changed in the analysis path, for example the plot scripts used in step 3.

Function fitting with lmfit

Scipy contains functions for fitting equations with Python, in its scipy.optimize module. The two main ones I’ve used in the past are leastsq and curve_fit, which in itself is a convenience wrapper around leastsq. curve_fit For this operation you require three (four) things: a function to fit of form f(x, *params) x data y data Optionally error data You can also supply an initial guess with the p0 argument.