refactored phosim.py script and script to make index files for astrometry.net