/[ascend]/trunk/models/kchittur/zplot.py
ViewVC logotype

Diff of /trunk/models/kchittur/zplot.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1727 by kchittur, Mon Jun 4 15:13:28 2007 UTC revision 1728 by kchittur, Wed Jan 16 01:01:07 2008 UTC
# Line 1  Line 1 
1  import extpy  import extpy
2    from pylab import *
3    from solverreporter import *
4    
5  try:  def pvplot(self):
     from pylab import *  
 except:  
     pass  
6    
7  from solverreporter import *      browser = extpy.getbrowser()
8        ioff()
9        figure()
10    #
11    # I have chosen several temperatures
12    #
13        for T in [190,210,230,250,270,290,310,330,350,370,400, 420]:
14            self.T.setRealValue(T)
15    #
16    # collect the data for plotting in two sets of arrays (one for X, one for Y)
17    # I have one set here - for P versus V at different T's  
18    #
19            XX1 = []
20            YY1 = []
21    #
22    # there has to be a space between "in" and "["
23    #
24    
25            for P in [8,9,10,15,20,25,30,40,50,60,70,80,100,120,140,150,170,190]:
26                self.P.setRealValueWithUnits(P,"bar")
27    #
28    # send the pair of values P, T to the solver
29    # and append the Volume and Pressure from the solver to the arrays
30                try:
31                    browser.sim.solve(browser.solver,SimpleSolverReporter(browser,message="T = %f, P = %f" % (T,P)))
32                    XX1.append(float(self.V))
33                    YY1.append(float(self.P))
34                except:
35                    browser.reporter.reportError('Failed to solve for P = %f' % P)
36                    continue
37    ## plot the data
38    
39            plot(XX1,YY1)
40    
41            hold(1)
42        
43    ##  legend()
44        ion()
45        show()
46    
47    extpy.registermethod(pvplot)
48    
49  def zplot(self):  def zplot(self):
50    

Legend:
Removed from v.1727  
changed lines
  Added in v.1728

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22