def comatic(c2=.01, h=1.0, maxrho=4.0, maxtheta=2*np.math.pi, npoints=500.0, movie=False): if movie==False: arho = [x*maxrho/npoints for x in list(np.arange(npoints))] lx = [] ly = [] for rho in arho: atheta = [x*maxtheta/(npoints) for x in list(np.arange(npoints))] for theta in atheta: lx.append(h+dx(c2=c2, h=h, theta=theta, rho=rho)) ly.append(dy(c2=c2, h=h, theta=theta, rho=rho)) print "plotting..." # Create a figure with size 6 x 6 inches. fig = Figure(figsize=(6,6)) # Create a canvas and add the figure to it. canvas = FigureCanvas(fig) # Create a subplot. ax = fig.add_subplot(111) # Set the title. ax.set_title('Comatic Aberation Scatter Plot',fontsize=14) # Set the X Axis label. ax.set_xlabel('y[cm]',fontsize=12) # Set the Y Axis label. ax.set_ylabel('x[cm]',fontsize=12) # Display Grid. ax.grid(True,linestyle='-',color='0.75') # Generate the Scatter Plot. ax.scatter(ly,lx,s=.05,color='tomato'); # Save the generated Scatter Plot to a PNG file. canvas.print_figure('ComaticAberationScatterPlot',dpi=500) if movie==True: arho = [x*maxrho/npoints for x in list(np.arange(npoints))] for rho in arho: lx = [] ly = [] atheta = [x*maxtheta/(npoints) for x in list(np.arange(npoints))] for theta in atheta: lx.append(dx(c2=c2, h=h, theta=theta, rho=rho)) ly.append(h + dy(c2=c2, h=h, theta=theta, rho=rho)) print "plotting..." +str(rho) # Create a figure with size 6 x 6 inches. fig = Figure(figsize=(6,6)) # Create a canvas and add the figure to it. canvas = FigureCanvas(fig) # Create a subplot. ax = fig.add_subplot(111) # Set the title. ax.set_title('Comatic Aberation Scatter Plot',fontsize=14) # Set the X Axis label. ax.set_xlabel('y[cm]',fontsize=12) # Set the Y Axis label. ax.set_ylabel('x[cm]',fontsize=12) # Display Grid. ax.grid(True,linestyle='-',color='0.75') # Generate the Scatter Plot. ax.scatter(ly,lx,s=.05,color='tomato'); fig.ylim((.9,1.6)) fig.xlim((-.2,.2)) # Save the generated Scatter Plot to a PNG file. drho = rho/maxrho strguy = "%.04f" %drho strguy = strguy[2:] print 'ComaticAberationScatterPlot'+strguy canvas.print_figure('ComaticAberationScatterPlot'+strguy,dpi=500) return True