Changeset 4af20b4 in sasview for sansview/perspectives/fitting
- Timestamp:
- Feb 5, 2009 4:41:49 PM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 10c43a5
- Parents:
- e191da5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitting.py
r888e62c r4af20b4 264 264 265 265 266 def _single_fit_completed(self,result,pars,cpage,qmin,qmax,elapsed,ymin=None, ymax=None): 266 def _single_fit_completed(self,result,pars,cpage,qmin,qmax,elapsed, 267 ymin=None, ymax=None, xmin=None, xmax=None): 267 268 """ 268 269 Display fit result on one page of the notebook. … … 296 297 print "fitting result : pvec",result.pvec 297 298 print "fitting result : stderr",result.stderr 298 print " xmin xmax ymin , ymax",qmin, qmax,ymin, ymax299 print "qmin qmax xmin xmax ymin , ymax",qmin, qmax,xmin, xmax ,ymin, ymax 299 300 300 301 cpage.onsetValues(result.fitness, result.pvec,result.stderr) 301 self.plot_helper(currpage=cpage,qmin=qmin,qmax=qmax,ymin=ymin, ymax=ymax, title="Fitted model 2D ") 302 self.plot_helper(currpage=cpage,qmin=qmin,qmax=qmax, 303 ymin=ymin, ymax=ymax, 304 xmin=xmin, xmax=xmax,title="Fitted model 2D ") 302 305 except: 303 306 #raise … … 338 341 339 342 340 def _on_single_fit(self,id=None,qmin=None, qmax=None,ymin=None, ymax=None):343 def _on_single_fit(self,id=None,qmin=None, qmax=None,ymin=None, ymax=None,xmin=None,xmax=None): 341 344 """ 342 345 perform fit for the current page and return chisqr,out and cov … … 565 568 566 569 def plot_helper(self,currpage, fitModel=None, qmin=None,qmax=None, 567 ymin=None,ymax=None, title=None ):570 ymin=None,ymax=None, xmin=None, xmax=None,title=None ): 568 571 """ 569 572 Plot a theory given a model and data … … 591 594 qmin = min(data.x) 592 595 if qmax == None : 593 596 qmax = max(data.x) 594 597 try: 595 598 tempx = qmin … … 637 640 theory.y_bins= data.y_bins 638 641 tempy=[] 642 print "max x,y",max(data.xmax,data.xmin),max(data.ymax,data.ymin) 639 643 if qmin==None: 640 qmin= data.xmin644 qmin=0#data.xmin 641 645 if qmax==None: 642 qmax=data.xmax 646 qmax=math.sqrt(math.pow(max(math.fabs(data.xmax),math.fabs(data.xmin)),2)/ 647 +math.pow(max(math.fabs(data.ymax),math.fabs(data.ymin)),2)) 643 648 if ymin==None: 644 649 ymin=data.ymin 645 650 if ymax==None: 646 651 ymax=data.ymax 647 xmin=data.xmin 648 xmax=data.xmax 652 if xmin ==None: 653 xmin=data.xmin 654 if xmax==None: 655 xmax=data.xmax 649 656 #print " q range =", 650 657 theory.data = numpy.zeros((len(data.y_bins),len(data.x_bins))) 651 for i in range(len(data.y_bins)): 652 if data.y_bins[i]>= ymin and data.y_bins[i]<= ymax: 653 for j in range(len(data.x_bins)): 654 if data.x_bins[i]>= qmin and data.x_bins[i]<= qmax: 658 for j in range(len(data.y_bins)): 659 for i in range(len(data.x_bins)): 660 tempqij=math.sqrt((math.pow(data.y_bins[j],2)+math.pow(data.x_bins[i],2))) 661 if tempqij>= qmin: 662 if tempqij<= qmax: 655 663 theory.data[j][i]=model.runXY([data.y_bins[j],data.x_bins[i]]) 656 else: 657 Inf=1e+5000 658 Nan=Inf*0 659 theory.data[j][i]=Nan 664 else: 665 theory.data[j][i]=0 660 666 661 667 #print "fitting : plot_helper:", theory.image
Note: See TracChangeset
for help on using the changeset viewer.