Exemplo n.º 1
0
def pickVect():
	"pickVect() - pick (X,Y) pair vector out of ascii column data array to be fitted"
	if FIT['ncol'] <= 0: 
		message(FIT['root'],text='Error:  No data found !!!\n\nFirst Load Data Array in from an Ascii file\n\n')
		return
	cols = FIT['cols']
	xcol = FIT['xcol']
	ycol = FIT['ycol']
	ix = xcol.get()
	iy = ycol.get()
	if ix >= FIT['ncol']: ix= -1
	if iy >= FIT['ncol']: ix= FIT['ncol'] - 1
	if iy < ix: iy = ix+1
	if ix < 0: 
		x = range(1,len(cols[0])+1)
	else:
		x = cols[ix]
	y = cols[iy]
	data = []
	fo = open('xy.txt','w')
	for i in range(len(x)):
		data.append((x[i],y[i]))
		fo.write('%18.7f %18.7f \n' % (x[i],y[i]) )
	fo.close()	
	
	title='Least Square Fit: ix='+str(ix)+' ,iy='+str(iy)
	FIT['title'] = title
	xdisplayfile('xy.txt',title='xy.txt: '+title)
	fit(data,title=title)
Exemplo n.º 2
0
    def drawrowsset(self):
	'drawrowsset(self) - accept row slices and draw 3D row lines'
	from plot2d import parseint
	st = self.RSW[0].get()
	try:
	    ll = parseint(st)
	except:
	    message(self.RSFrame,'Error in\n\nEnter Row # list Field')
	    return 
	try:
	    self.linewidth = self.RSW[1].get()
	except:
	    message(self.RSFrame,'Error in\n\nEnter Line Width Field')
	    return
	self.drawrows(ll)
Exemplo n.º 3
0
 def drawrowsset(self):
     'drawrowsset(self) - accept row slices and draw 3D row lines'
     from plot2d import parseint
     st = self.RSW[0].get()
     try:
         ll = parseint(st)
     except:
         message(self.RSFrame, 'Error in\n\nEnter Row # list Field')
         return
     try:
         self.linewidth = self.RSW[1].get()
     except:
         message(self.RSFrame, 'Error in\n\nEnter Line Width Field')
         return
     self.drawrows(ll)
Exemplo n.º 4
0
    def apply(self):
	"apply(self) - accept fit id and coeffs and pass data to fit calculation"
	from plot2d import parsefloat,parseint
	id = string.atoi(self.parms[0].get())
	ll = self.parms[1].get()
	print 'ID # =', id
	print 'parms=', ll 
	parms = parsefloat(ll)
	list = functions.keys()
	fn = list[id]
	f= functions[list[id]]
	steps = string.atoi(self.parms[2].get()) 
	self.legd = self.legdVar.get()
	ret = testfit(self,data=self.data,fn=fn,parms=parms,legd=self.legd,steps=steps)
#	print 'ret=',ret
	if ret == None:
		message(self.fm,text='Error: Least square data fitting failed with function\n\n'+f['Exp'],title='Fitting Info')
Exemplo n.º 5
0
    def drawstepsset(self):
	'drawstepsset(self) - accept and draw step slices selected in 3D coordinates'
	from plot2d import parseint
	st = self.SSW[0].get()
	try:
	    ll = parseint(st)
	except:
	    message(self.SSFrame,'Error in\nEnter Step # list Field')
	    return 
	try:
	    self.linewidth = self.SSW[1].get()
	except:
	    message(self.SSFrame,'Error in\nEnter Line Width Field')
	    return
	self.stepline = self.SSW[2].get()
	if self.stepline: 
	    self.drawstepSline(ll)
	else:
	    self.linewidth = self.SSW[1].get()
	    self.drawsteps(ll)
Exemplo n.º 6
0
 def drawstepsset(self):
     'drawstepsset(self) - accept and draw step slices selected in 3D coordinates'
     from plot2d import parseint
     st = self.SSW[0].get()
     try:
         ll = parseint(st)
     except:
         message(self.SSFrame, 'Error in\nEnter Step # list Field')
         return
     try:
         self.linewidth = self.SSW[1].get()
     except:
         message(self.SSFrame, 'Error in\nEnter Line Width Field')
         return
     self.stepline = self.SSW[2].get()
     if self.stepline:
         self.drawstepSline(ll)
     else:
         self.linewidth = self.SSW[1].get()
         self.drawsteps(ll)
Exemplo n.º 7
0
    def displayFile(self):
	'displayFile(self) - display content of Ascii file loaded in'
	if os.path.isfile(self.fname): xdisplayfile(self.fname)
	else: 
		message(self.interior(),text='Error: \n\n'+self.fname+'\nFile not found!')
Exemplo n.º 8
0
def fithelp():
	"fithelp() - help info about fit.py"
	info = 'If the fitting failed with real X vector values,\n user can try to fit with X vector index values, i.e.\n set X Vector Column Seq # to -1 to use X index vector'
	message(FIT['root'],text=info,title='Fit - Help Info')
Exemplo n.º 9
0
 def displayFile(self):
     'displayFile(self) - display content of Ascii file loaded in'
     if os.path.isfile(self.fname): xdisplayfile(self.fname)
     else:
         message(self.interior(),
                 text='Error: \n\n' + self.fname + '\nFile not found!')