Changeset d5b488b in sasview
- Timestamp:
- Apr 29, 2009 8:00:22 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:
- d37ba31
- Parents:
- 3c939e5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
r6963aa3 rd5b488b 257 257 dy= copy.deepcopy(self.dy) 258 258 dy= numpy.asarray(dy) 259 259 260 dy[dy==0]=1 260 idx = (x>=self.qmin) & (x <= self.qmax)261 #idx = (x>=self.qmin) & (x <= self.qmax) 261 262 262 263 # Compute theory data f(x) 263 fx = numpy.zeros(len(x)) 264 fx[idx] = numpy.asarray([fn(v) for v in x[idx]]) 265 266 # Smear theory data 267 264 #fx = numpy.zeros(len(x)) 265 tempy=[] 266 tempfx=[] 267 tempdy=[] 268 #fx[idx] = numpy.asarray([fn(v) for v in x[idx]]) 269 for i_x in range(len(x)): 270 try: 271 if self.qmin <=x[i_x] and x[i_x]<=self.qmax: 272 value= fn(x[i_x]) 273 tempfx.append( value) 274 tempy.append(y[i_x]) 275 tempdy.append(dy[i_x]) 276 except: 277 ## skip error for model.run(x) 278 pass 279 280 ## Smear theory data 268 281 if self.smearer is not None: 269 fx = self.smearer(fx) 270 271 # Sanity check 272 if numpy.size(dy) < numpy.size(x): 282 tempfx = self.smearer(tempfx) 283 newy= numpy.asarray(tempy) 284 newfx= numpy.asarray(tempfx) 285 newdy= numpy.asarray(tempdy) 286 287 288 ## Sanity check 289 if numpy.size(newdy)!= numpy.size(newfx): 273 290 raise RuntimeError, "FitData1D: invalid error array" 274 return (y[idx] - fx[idx])/dy[idx] 291 #return (y[idx] - fx[idx])/dy[idx] 292 293 return (newy- newfx)/newdy 275 294 276 295 … … 395 414 self.model.setParams(self.paramlist,params) 396 415 self.res= self.data.residuals(self.model.eval) 397 #if self.curr_thread != None : 398 # try: 399 # self.curr_thread.isquit() 400 # except: 401 # raise FitAbort,"stop leastsqr optimizer" 416 if self.curr_thread != None : 417 try: 418 self.curr_thread.isquit() 419 except: 420 raise FitAbort,"stop leastsqr optimizer" 421 402 422 return self.res 403 423
Note: See TracChangeset
for help on using the changeset viewer.