Changeset d8a2e31 in sasview for park_integration/AbstractFitEngine.py
- 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
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.