Changeset 0e51519 in sasview for park_integration/AbstractFitEngine.py
- Timestamp:
- Oct 17, 2008 4:22:59 PM (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:
- 49815a2
- Parents:
- 539b1d6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
rf8ce013 r0e51519 183 183 184 184 185 def setFitRange(self, mini=None,maxi=None):185 def setFitRange(self,qmin=None,qmax=None,ymin=None,ymax=None,): 186 186 """ to set the fit range""" 187 self.qmin= mini188 self.qmax= maxi187 self.qmin=qmin 188 self.qmax=qmax 189 189 190 190 … … 230 230 self.y_bins= sans_data2d.y_bins 231 231 232 self.qmin= None 233 self.qmax= None 234 235 236 def setFitRange(self,mini=None,maxi=None): 232 self.xmin= self.data.xmin 233 self.xmax= self.data.xmax 234 self.ymin= self.data.ymin 235 self.ymax= self.data.ymax 236 237 238 def setFitRange(self,qmin=None,qmax=None,ymin=None,ymax=None): 237 239 """ to set the fit range""" 238 self.qmin= mini 239 self.qmax= maxi 240 240 self.xmin= qmin 241 self.xmax= qmax 242 self.ymin= ymin 243 self.ymax= ymax 241 244 242 245 def getFitRange(self): … … 244 247 @return the range of data.x to fit 245 248 """ 246 return self. qmin, self.qmax249 return self.xmin, self.xmax,self.ymin, self.ymax 247 250 248 251 … … 252 255 """ 253 256 res=[] 254 if self.qmin==None and self.qmax==None: 255 for i in range(len(self.x_bins)): 256 res.append( (self.image[i][i]- fn([self.x_bins[i],self.y_bins[i]]))\ 257 /self.err_image[i][i] ) 258 return numpy.array(res) 259 else: 260 #idx = (x>=self.qmin) & (x <= self.qmax) 261 #fx = numpy.asarray([fn(item)for item in x[idx ]]) 262 #return (y[idx] - fx)/dy[idx] 263 for i in range(len(self.x_bins)): 264 res.append( (self.image[i][i]- fn([self.x_bins[i],self.y_bins[i]]))\ 265 /self.err_image[i][i] ) 266 return numpy.array(res) 257 if self.xmin==None: 258 self.xmin= self.data.xmin 259 if self.xmax==None: 260 self.xmax= self.data.xmax 261 if self.ymin==None: 262 self.ymin= self.data.ymin 263 if self.ymax==None: 264 self.ymax= self.data.ymax 265 266 for i in range(len(self.y_bins)): 267 #if self.y_bins[i]>= self.ymin and self.y_bins[i]<= self.ymax: 268 for j in range(len(self.x_bins)): 269 #if self.x_bins[j]>= self.xmin and self.x_bins[j]<= self.xmax: 270 res.append( (self.image[j][i]- fn([self.x_bins[j],self.y_bins[i]]))\ 271 /self.err_image[j][i] ) 272 273 return numpy.array(res) 274 275 267 276 def residuals_deriv(self, model, pars=[]): 268 277 """ … … 388 397 raise ValueError, "park_integration:missing parameters" 389 398 390 def set_data(self,data,Uid,qmin=None,qmax=None ):399 def set_data(self,data,Uid,qmin=None,qmax=None,ymin=None,ymax=None): 391 400 """ Receives plottable, creates a list of data to fit,set data 392 401 in a FitArrange object and adds that object in a dictionary … … 399 408 else: 400 409 fitdata=FitData1D(data) 401 if qmin !=None and qmax !=None:402 fitdata.setFitRange(mini=qmin,maxi=qmax)410 411 fitdata.setFitRange(qmin=qmin,qmax=qmax, ymin=ymin,ymax=ymax) 403 412 #A fitArrange is already created but contains model only at Uid 404 413 if self.fitArrangeDict.has_key(Uid):
Note: See TracChangeset
for help on using the changeset viewer.