Features/adds option parsing

The only thing I'm not sure about is the conditional import of the matplotlib in the main function.
Also I've used argparse in stead of optparse (which is used elsewhere) since this is [deprecated](http://docs.python.org/2/library/optparse.html#module-optparse).