def plot_grid(self, grid, var=0): """make a plot of the grid.""" try: import matplotlib except Exception: return else: import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec gs1 = gridspec.GridSpec(2, 1, height_ratios=[5,1]) gs1.update(wspace=0, hspace=0) # set the spacing between axes. ax = plt.subplot(gs1[0]) data = [] for i in range(self.ng): data.append(grid[(i,var)]) ftnvalues = [(i+1)/len(data)for i in range(len(data)) if i < len(data)] ax.plot(data, ftnvalues, label="ftn26") ax.legend() plt.title('grid') ax.set_ylim([0,1]) plt.axis('on') i=0 while os.path.exists("matplotlib%s.png" % i): i+=1 plt.savefig("matplotlib%s.png" % i) misc.sprint("file save in matplotlib%s.png" % i)
def plot_grid(self, grid, var=0): """make a plot of the grid.""" try: import matplotlib except Exception: return else: import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec gs1 = gridspec.GridSpec(2, 1, height_ratios=[5, 1]) gs1.update(wspace=0, hspace=0) # set the spacing between axes. ax = plt.subplot(gs1[0]) data = [] for i in range(self.ng): data.append(grid[(i, var)]) ftnvalues = [(i + 1) / len(data) for i in range(len(data)) if i < len(data)] ax.plot(data, ftnvalues, label="ftn26") ax.legend() plt.title('grid') ax.set_ylim([0, 1]) plt.axis('on') i = 0 while os.path.exists("matplotlib%s.png" % i): i += 1 plt.savefig("matplotlib%s.png" % i) misc.sprint("file save in matplotlib%s.png" % i)
def generate_output_file(self): if not self.good_elements: misc.sprint("No helicity", self.input_file) self.write_zero_matrix_element() return atexit.register(self.clean_up) self.read_orig() self.read_template() atexit.unregister(self.clean_up)