Changeset d8a2e31 in sasview
- Timestamp:
- Aug 5, 2009 5:41:58 PM (15 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:
- 60c1943
- Parents:
- f88624d
- Location:
- park_integration
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
r72c7d31 rd8a2e31 112 112 @param x: the x value used to compute a function 113 113 """ 114 return self.model.runXY(x) 114 try: 115 return self.model.evalDistribution(x) 116 except: 117 return self.model.runXY(x) 115 118 116 119 … … 340 343 self.image = sans_data2d.data 341 344 self.err_image = sans_data2d.err_data 342 self.x_bins= sans_data2d.x_bins 343 self.y_bins= sans_data2d.y_bins 345 self.x_bins_array= numpy.reshape(sans_data2d.x_bins, 346 [1,len(sans_data2d.x_bins)]) 347 self.y_bins_array = numpy.reshape(sans_data2d.y_bins, 348 [len(sans_data2d.y_bins),1]) 349 350 351 self.x_bins = sans_data2d.x_bins 352 self.y_bins = sans_data2d.y_bins 344 353 345 354 x = max(self.data.xmin, self.data.xmax) … … 355 364 self.res_err_image = copy.deepcopy(self.err_image) 356 365 self.res_err_image[self.err_image==0]=1 366 367 self.radius= numpy.sqrt(self.x_bins_array**2 + self.y_bins_array**2) 368 self.index_model = (self.qmin <= self.radius)&(self.radius<= self.qmax) 357 369 358 370 … … 373 385 return self.qmin, self.qmax 374 386 375 376 def residuals(self, fn): 387 def residuals(self, fn): 388 try: 389 res=self.index_model*(self.image - fn([self.y_bins_array, 390 self.x_bins_array]))/self.res_err_image 391 return res.ravel() 392 except: 393 print "Using old residual method" 394 return self.old_residuals( fn) 395 396 397 def old_residuals(self, fn): 377 398 """ @param fn: function that return model value 378 399 @return residuals -
park_integration/Fitting.py
ra6a7e8a rd8a2e31 4 4 a park fit or a scipy fit. 5 5 """ 6 #from sans.guitools.plottables import Data1D 7 #from danse.common.plottools.plottables import Data1D 8 #from Loader import Load 6 9 7 from scipy import optimize 10 8 from ScipyFitting import ScipyFit … … 56 54 return self._engine.fit(handler, curr_thread= curr_thread) 57 55 except: 58 #Let fit_thread handle the fit error59 56 raise 57 60 58 61 59 def set_model(self,model,Uid,pars=[]): -
park_integration/ParkFitting.py
r4bd557d rd8a2e31 87 87 self.problem = park.Assembly(mylist) 88 88 89 def fit(self, *args, **kw): 90 return profile(self._fit, *args, **kw) 89 91 90 def fit(self,handler=None, curr_thread= None):92 def _fit(self,handler=None, curr_thread= None): 91 93 """ 92 94 Performs fit with park.fit module.It can perform fit with one model … … 125 127 126 128 127 129 128 130 129 131 -
park_integration/ScipyFitting.py
r342d9197 rd8a2e31 58 58 self.fitArrangeDict={} 59 59 self.paramList=[] 60 #def fit(self, *args, **kw):61 #return profile(self._fit, *args, **kw)60 def fit(self, *args, **kw): 61 return profile(self._fit, *args, **kw) 62 62 63 def fit(self ,handler=None,curr_thread= None):63 def _fit(self ,handler=None,curr_thread= None): 64 64 65 65 fitproblem=[] … … 108 108 raise 109 109 110 111 110 112 def profile(fn, *args, **kw): 111 113 import cProfile, pstats, os -
park_integration/setup.py
r78c5378 rd8a2e31 3 3 """ 4 4 5 import sys 6 import os 7 if len(sys.argv) == 1: 8 sys.argv.append('install') 5 9 6 10 # Then build and install the modules
Note: See TracChangeset
for help on using the changeset viewer.