Code to write output and analyze as numpy array.