Correct theta->psi in thickness calculation

Also update programs to work with Python 3 (should still work with
Python 2.7)