I have written a little script to batch plot some data. This script cannot run without a window displaying the newly created plot opening. It stops running till the window is manually closed, then the script continues to run. So my question is as follows:
Is there a way automatically close an output window from within a python script?
Here is the script
import pynbody
import numpy as np
import pynbody.plot.sph as sph
f = open('files.txt', 'r')
for line in f:
line = line[0:-1]
s = pynbody.load(line)
sph.image(s.gas,qty="temp",width=16, filename=line[0:-6]+line[-5:len(line)], units='K', cmap="YlOrRd", ret_im=False , approximate_fast=False)
#At the end of the loop I would like to close the output window so the script
#will continue to run
The pynbody.plot.sph package seems as it should be able to turn the output window on and off within the sph.image function call but I have exhausted all the possibilities and am now resorting to this to get the script running.
os.kill()