Changeset 189be4e in sasview for park_integration


Ignore:
Timestamp:
Jun 11, 2010 2:53:14 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:
1759c8e
Parents:
d0d7704
Message:

fixed fitting error on theory curve

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/AbstractFitEngine.py

    rc6d3301 r189be4e  
    162162             
    163163        """ 
    164          
    165164        self.smearer = smearer 
    166         if dy ==None or dy==[]: 
    167             self.dy= numpy.zeros(len(self.y))   
     165         
     166        # Check error bar; if no error bar found, set it constant(=1) 
     167        # TODO: Should provide an option for users to set it like percent, constant, or dy data 
     168        if dy ==None or dy==[] or dy.all()==0: 
     169            self.dy= numpy.ones(len(y))   
    168170        else: 
    169             self.dy= numpy.asarray(dy) 
    170       
    171         # For fitting purposes, replace zero errors by 1 if all of them are zero 
    172         #TODO: check validity for the rare case where only 
    173         # all points have zero errors  
    174         if self.dy.all()==0: self.dy = 1 
    175          
     171            self.dy= numpy.asarray(dy).copy() 
     172 
    176173        ## Min Q-value 
    177174        #Skip the Q=0 point, especially when y(q=0)=None at x[0]. 
     
    195192        """ to set the fit range""" 
    196193        # Skip Q=0 point, (especially for y(q=0)=None at x[0]). 
    197         #ToDo: Fix this. 
     194        # ToDo: Find better way to do it. 
    198195        if qmin==0.0 and not numpy.isfinite(self.y[qmin]): 
    199196            self.qmin = min(self.x[self.x!=0]) 
     
    248245        if self.smearer is not None: 
    249246            fx = self.smearer(fx, self._first_unsmeared_bin, self._last_unsmeared_bin) 
    250         
     247 
    251248        ## Sanity check 
    252249        if numpy.size(self.dy)!= numpy.size(fx): 
Note: See TracChangeset for help on using the changeset viewer.