I maintain several open-source programs, mostly revolving around science or maths. Hopefully some of this will be useful to other people. See also my repository on github.

Monte Carlo integration library for Python
Google maps in the IPython notebook


Scikit-Monaco is a Monte Carlo integration library for Python.

A code snippet is worth a thousand words. Let's integrate \(\sqrt{x^2 + y^2 + z^2}\) in the unit cube:

>>> from skmonaco import mcquad
>>> from math import sqrt
>>> result, error = mcquad(
...     lambda xs: sqrt(xs[0]**2+xs[1]**2+xs[2]**2),
...     npoints=1e6, xl=[0.,0.,0.], xu=[1.,1.,1.])
>>> print "{} +/- {}".format(result,error)
0.960695982212 +/- 0.000277843266684

Monte Carlo integration is particularly suited to the calculation of high dimensional integrals. Scikit-Monaco is written in Cython, aiming to offer quasi C-like speeds with the flexibility of Python. The integration is automatically distributed over several processes to take advantage of multi-core processors.

The easiest way to download and install Scikit-Monaco is with easy-install,

 $ easy_install scikit-monaco 
If you do not have root access, use the --prefix=/path/to/directory option to install scikit-monaco in a directory that you have access to, and add the line
export PYTHONPATH=$PYTHONPATH:path/to/directory
to your .bashrc file.


Google maps in IPython notebooks

You have some latitude and longitude data in a Python list or a numpy array. You want to see where that data is. This plugin for the IPython notebook makes that easy.