Changeset 4c718654 in sasview for park_integration
- 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
- Location:
- park_integration
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/Fitting.py
r4dd63eb r4c718654 66 66 """remove fitarrange in Uid""" 67 67 self._engine.remove_Fit_Problem(Uid) 68 68 69 -
park_integration/ParkFitting.py
r4dd63eb r4c718654 14 14 from sans.guitools.plottables import Data1D 15 15 from Loader import Load 16 from AbstractFitEngine import FitEngine, Parameter 16 17 17 18 class SansParameter(park.Parameter): … … 152 153 153 154 154 class ParkFit :155 class ParkFit(FitEngine): 155 156 """ 156 157 ParkFit performs the Fit.This class can be used as follow: … … 308 309 del self.fitArrangeList[Uid] 309 310 310 def _concatenateData(self, listdata=[]): 311 """ 312 _concatenateData method concatenates each fields of all data contains ins listdata. 313 @param listdata: list of data 314 315 @return xtemp, ytemp,dytemp: x,y,dy respectively of data all combined 316 if xi,yi,dyi of two or more data are the same the second appearance of xi,yi, 317 dyi is ignored in the concatenation. 318 319 @raise: if listdata is empty will return None 320 @raise: if data in listdata don't contain dy field ,will create an error 321 during fitting 322 """ 323 if listdata==[]: 324 raise ValueError, " data list missing" 325 else: 326 xtemp=[] 327 ytemp=[] 328 dytemp=[] 329 dx=None 330 for data in listdata: 331 for i in range(len(data.x)): 332 if not data.x[i] in xtemp: 333 xtemp.append(data.x[i]) 334 335 if not data.y[i] in ytemp: 336 ytemp.append(data.y[i]) 337 if data.dy and len(data.dy)>0: 338 if not data.dy[i] in dytemp: 339 dytemp.append(data.dy[i]) 340 else: 341 raise ValueError,"dy is missing will not be able to fit later on" 342 return xtemp, ytemp,dytemp,dx 343 344 345 class Parameter: 346 """ 347 Class to handle model parameters 348 """ 349 def __init__(self, model, name, value=None): 350 self.model = model 351 self.name = name 352 if not value==None: 353 self.model.setParam(self.name, value) 354 355 def set(self, value): 356 """ 357 Set the value of the parameter 358 """ 359 self.model.setParam(self.name, value) 360 361 def __call__(self): 362 """ 363 Return the current value of the parameter 364 """ 365 return self.model.getParam(self.name) 366 367 368 369 311 370 312 371 313 -
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.