Changeset 4c718654 in sasview for park_integration/ScipyFitting.py
- Timestamp:
- Jul 11, 2008 10:34:14 AM (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:
- d4b0687
- Parents:
- 03a20aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/ScipyFitting.py
r4dd63eb r4c718654 7 7 from Loader import Load 8 8 from scipy import optimize 9 9 from AbstractFitEngine import FitEngine, Parameter 10 10 11 11 class FitArrange: … … 56 56 self.dList=[] 57 57 58 class ScipyFit :58 class ScipyFit(FitEngine): 59 59 """ 60 60 ScipyFit performs the Fit.This class can be used as follow: … … 123 123 return chisqr, out, cov 124 124 125 def _concatenateData(self, listdata=[]):126 """127 _concatenateData method concatenates each fields of all data contains ins listdata.128 @param listdata: list of data129 130 @return xtemp, ytemp,dytemp: x,y,dy respectively of data all combined131 if xi,yi,dyi of two or more data are the same the second appearance of xi,yi,132 dyi is ignored in the concatenation.133 134 @raise: if listdata is empty will return None135 @raise: if data in listdata don't contain dy field ,will create an error136 during fitting137 """138 if listdata==[]:139 raise ValueError, " data list missing"140 else:141 xtemp=[]142 ytemp=[]143 dytemp=[]144 145 for data in listdata:146 for i in range(len(data.x)):147 if not data.x[i] in xtemp:148 xtemp.append(data.x[i])149 150 if not data.y[i] in ytemp:151 ytemp.append(data.y[i])152 if data.dy and len(data.dy)>0:153 if not data.dy[i] in dytemp:154 dytemp.append(data.dy[i])155 else:156 raise ValueError,"dy is missing will not be able to fit later on"157 return xtemp, ytemp,dytemp158 159 125 def set_model(self,model,name,Uid,pars={}): 160 126 """ … … 222 188 if self.fitArrangeList.has_key(Uid): 223 189 del self.fitArrangeList[Uid] 224 225 226 class Parameter: 227 """ 228 Class to handle model parameters 229 """ 230 def __init__(self, model, name, value=None): 231 self.model = model 232 self.name = name 233 if not value==None: 234 self.model.setParam(self.name, value) 235 236 def set(self, value): 237 """ 238 Set the value of the parameter 239 """ 240 self.model.setParam(self.name, value) 241 242 def __call__(self): 243 """ 244 Return the current value of the parameter 245 """ 246 return self.model.getParam(self.name) 247 190 248 191 def fitHelper(model, pars, x, y, err_y ,qmin=None, qmax=None): 249 192 """
Note: See TracChangeset
for help on using the changeset viewer.