place figures properly
fix several cython errors

This should be in a separate pyx file so we can compile a Python module.

Moved code out of IPython Notebook.
rename cython file