Changeset e94d1d3 in sasview
- Timestamp:
- May 22, 2008 10:36:29 AM (17 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:
- eb06cbe
- Parents:
- 73bbe35
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/test/FittingModule.py
r73bbe35 re94d1d3 47 47 def __init__(self,data=[]): 48 48 #self.model is a list of all models to fit 49 self.model={}49 #self.model={} 50 50 self.fitArrangeList={} 51 51 #the list of all data to fit … … 68 68 Do the fit 69 69 """ 70 # Do the fit with more than one data set and one model 71 xtemp=[] 72 ytemp=[] 73 dytemp=[] 74 75 #for item in self.self.fitArrangeList.: 70 #for item in self.fitArrangeList.: 76 71 77 72 fitproblem=self.fitArrangeList.values()[0] … … 80 75 listdata= fitproblem.get_data() 81 76 self.set_param(model, pars) 82 print "this is self.parameters",self.parameters 83 for data in listdata: 84 for i in range(len(data.x)): 85 if not data.x[i] in xtemp: 86 xtemp.append(data.x[i]) 87 88 if not data.y[i] in ytemp: 89 ytemp.append(data.y[i]) 90 91 if not data.dy[i] in dytemp: 92 dytemp.append(data.dy[i]) 93 if qmin==None: 94 qmin= min(xtemp) 95 if qmax==None: 96 qmax= max(xtemp) 97 chisqr, out, cov = fitHelper(model,self.parameters, xtemp,ytemp, dytemp ,qmin,qmax) 98 return chisqr, out, cov 77 if listdata==[]: 78 raise ValueError, " data list missing" 79 else: 80 # Do the fit with more than one data set and one model 81 xtemp=[] 82 ytemp=[] 83 dytemp=[] 84 85 86 for data in listdata: 87 for i in range(len(data.x)): 88 if not data.x[i] in xtemp: 89 xtemp.append(data.x[i]) 90 91 if not data.y[i] in ytemp: 92 ytemp.append(data.y[i]) 93 94 if not data.dy[i] in dytemp: 95 dytemp.append(data.dy[i]) 96 if qmin==None: 97 qmin= min(xtemp) 98 if qmax==None: 99 qmax= max(xtemp) 100 chisqr, out, cov = fitHelper(model,self.parameters, xtemp,ytemp, dytemp ,qmin,qmax) 101 return chisqr, out, cov 99 102 100 103 def set_model(self,model,Uid): … … 122 125 """ Recieve a dictionary of parameter and save it """ 123 126 self.parameters=[] 124 #for key ,value in pars: 125 for key, value in pars.iteritems(): 126 print "this is the key",key 127 print "this is the value",value 128 param = Parameter(model, key, value) 129 self.parameters.append(param) 130 127 if model==None: 128 raise ValueError, "Cannot set parameters for empty model" 129 else: 130 #for key ,value in pars: 131 for key, value in pars.iteritems(): 132 print "this is the key",key 133 print "this is the value",value 134 param = Parameter(model, key, value) 135 self.parameters.append(param) 136 131 137 def add_contraint(self, contraint): 132 138 """ User specify contraint to fit """ … … 226 232 from sans.guitools.LineModel import LineModel 227 233 model = LineModel() 228 Fit.set_model(model,1 234 Fit.set_model(model,1) 229 235 Fit.set_data(data1,1) 230 236 #default_A = model.getParam('A')
Note: See TracChangeset
for help on using the changeset viewer.