Ignore:
Timestamp:
Apr 14, 2010 12:47:55 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
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:
19403da
Parents:
6318298
Message:

fixed 2D fit problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/AbstractFitEngine.py

    r90c9cdf r36bc34e  
    283283        ## new error image for fitting purpose 
    284284        if self.err_data== None or self.err_data ==[]: 
    285             self.res_err_data= numpy.zeros(len(self.data)) 
     285            self.res_err_data= numpy.ones(len(self.data)) 
    286286        else: 
    287287            self.res_err_data = copy.deepcopy(self.err_data) 
    288         self.res_err_data[self.res_err_data==0]=numpy.sqrt(self.data[self.res_err_data==0]) 
     288        self.res_err_data[self.res_err_data==0]=1 
    289289         
    290290        self.radius= numpy.sqrt(self.qx_data**2 + self.qy_data**2) 
     
    292292        # Note: mask = True: for MASK while mask = False for NOT to mask 
    293293        self.index_model = ((self.qmin <= self.radius)&(self.radius<= self.qmax)) 
    294         self.mask = (self.index_model) & (self.mask) 
     294        self.index_model = (self.index_model) & (self.mask) 
     295        self.index_model = (self.index_model) & (numpy.isfinite(self.data)) 
    295296            
    296297    def setFitRange(self,qmin=None,qmax=None): 
     
    304305        self.radius= numpy.sqrt(self.qx_data**2 + self.qy_data**2) 
    305306        self.index_model = ((self.qmin <= self.radius)&(self.radius<= self.qmax)) 
    306         self.mask = (self.index_model) &(self.mask) 
    307          
     307        self.index_model = (self.index_model) &(self.mask) 
     308        self.index_model = (self.index_model) & (numpy.isfinite(self.data)) 
    308309         
    309310    def getFitRange(self): 
     
    318319        """         
    319320        # use only the data point within ROI range 
    320         res=(self.data[self.mask] - fn([self.qx_data[self.mask], 
    321                              self.qy_data[self.mask]]))/self.res_err_data[self.mask] 
     321        res=(self.data[self.index_model] - fn([self.qx_data[self.index_model], 
     322                             self.qy_data[self.index_model]]))/self.res_err_data[self.index_model] 
    322323        return res 
    323324         
Note: See TracChangeset for help on using the changeset viewer.