/[ascend]/trunk/models/johnpye/leastsq_fit.py
ViewVC logotype

Contents of /trunk/models/johnpye/leastsq_fit.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2617 - (show annotations) (download) (as text)
Fri May 11 19:52:18 2012 UTC (8 years, 8 months ago) by jpye
File MIME type: text/x-python
File size: 567 byte(s)
Least squares model currently solves with SOLVE command, but not via GUI...
1 # -*- coding: utf8 -*-
2 import extpy, sys
3
4 try:
5 from pylab import *
6 except:
7 pass
8
9 def leastsq_plot(self):
10 """Plot a least-squares fit, no added intermediate points though."""
11 import loading
12 loading.load_matplotlib(throw=True)
13
14 ioff()
15 figure()
16
17 n = self.n.getIntValue()
18
19 x = []
20 y = []
21 ye = []
22 for i in range(n):
23 x.append(float(self.x[i+1]))
24 y.append(float(self.y[i+1]))
25 ye.append(float(self.f[i+1].y))
26 plot(x,y,'bo')
27 plot(x,ye,'b-')
28
29 extpy.getbrowser().reporter.reportNote("Plotting completed")
30 ion()
31 show()
32
33 extpy.registermethod(leastsq_plot)
34

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