geo = GeoCalculator(Tsec) geo.Solve() print geo.Area() p = geo.Centroid() alfa = geo.tan_alfa() print p print "a=" + str(alfa) app = PlotApp() Path = DrawGeometry(Tsec) Path.Draw() #newIsec = Isec.moveCoor(-p[0], -p[1]) #origin = Point(0,0) #newIsec = Isec.rotate(pi/4, p) #newIsec = Isec.transform(-p[0],-p[1],-alfa, origin) #geo1 = GeoCalculator(newIsec) #geo1.Solve() #print geo1.Area() #print geo1.Centroid() for i in Path._paths: m,n=zip(*i) app.oplot(m,n,title='Example PlotApp', label='a', ylabel=r'$k^2\chi(k) $', xlabel=r'$ k \ (\AA^{-1}) $') app.write_message('Try Help->Quick Reference') app.run()
#!/usr/bin/env python # simple wxmplot example from numpy import linspace, sin, cos, random from wxmplot import PlotApp app = PlotApp() x = linspace(0.0, 10.0, 101) y = 5*sin(4*x)/(x+6) z = cos(0.7*(x+0.3)) + random.normal(size=len(x), scale=0.2) app.plot(x, y, title='WXMPlot Demo', label='decaying sine', ylabel=r'$\chi(x)$', xlabel='$x \ (\AA)$') app.oplot(x, z, label='noisy cosine', marker='+') app.write_message('Try Help->Quick Reference') app.run()
#!/usr/bin/env python # simple wxmplot example from numpy import linspace, sin, cos, random from wxmplot import PlotApp app = PlotApp() random.seed(1) x = linspace(0.0, 15.0, 151) y = 5*sin(4*x)/(x*x+6) z = cos(0.7*(x+0.3)) + random.normal(size=len(x), scale=0.11) app.plot(x, y, title='WXMPlot example', label='decaying sine', ylabel=r'$\phi(x)$', xlabel=r'$x \> \rm (\AA)$') app.oplot(x, z, label='noisy cosine', marker='+', show_legend=True) app.write_message('Try Help->Quick Reference') app.run()
#!/usr/bin/env python # simple wxmplot example from numpy import linspace, sin, cos, random from wxmplot import PlotApp app = PlotApp() random.seed(1) x = linspace(0.0, 15.0, 151) y = 5 * sin(4 * x) / (x * x + 6) z = cos(0.7 * (x + 0.3)) + random.normal(size=len(x), scale=0.11) app.plot(x, y, title='WXMPlot example', label='decaying sine', ylabel=r'$\phi(x)$', xlabel=r'$x \> \rm (\AA)$') app.oplot(x, z, label='noisy cosine', marker='+', show_legend=True) app.write_message('Try Help->Quick Reference') app.run()
#!/usr/bin/python # # compare, for reference: # http://www.mps.mpg.de/dislin/exa_curv.html # http://www.mps.mpg.de/dislin/exa_python.html#section_1 from wxmplot import PlotApp import numpy as np x = 3.6*np.arange(101) y1 = np.cos(np.pi*x/180) y2 = np.sin(np.pi*x/180) app = PlotApp() app.plot(x, y1, color='red', xlabel='x', ylabel='y', title='DISLIN Comparison\nsin(x) and cos(x)', xmin=0, xmax=360.0) app.oplot(x, y2, color='green3', marker='+') app.run()
from wxmplot import PlotApp from numpy import arange, sin, cos, exp, pi xx = arange(0.0,12.0,0.1) y1 = 1*sin(2*pi*xx/3.0) y2 = 4*cos(2*pi*(xx-1)/5.0)/(6+xx) y3 = -pi + 2*(xx/10. + exp(-(xx-3)/5.0)) p = PlotApp() p.plot(xx, y1, color='blue', style='dashed', title='Example PlotApp', label='a', ylabel=r'$k^2\chi(k) $', xlabel=r'$ k \ (\AA^{-1}) $' ) p.oplot(xx, y2, marker='+', linewidth=0, label =r'$ x_1 $') p.oplot(xx, y3, style='solid', label ='x_2') p.write_message('Try Help->Quick Reference') p.run()