clean indentation

make it 4 spaces
remove unused function

Update script to save directly to file.
separate code to include in TeX file

This is long enough to put in its own file.
remove print statements
update plots
small figure placement adjustments