Refactor

Remove some latex temp files, move photometry code into library. Fix
some python 2/3 errors