Changeset 1702180 in sasview for Invariant


Ignore:
Timestamp:
Jan 22, 2010 12:57:57 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
bb0b12c
Parents:
1a2dc10
Message:

add comment for 2 methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Invariant/invariant.py

    r91db958 r1702180  
    3737            dy = data.dy 
    3838        else: 
    39             dy = numpy.array([math.sqrt(math.fabs(j)) for j in data.y]) 
     39            #dy = numpy.array([math.sqrt(math.fabs(j)) for j in data.y]) 
     40            dy = numpy.array([1 for j in data.y]) 
    4041        # Transform smear info  
    4142        dxl_out = None 
     
    266267 
    267268         # Uncertainty 
    268         if type(self.data.dy)==numpy.ndarray and len(self.data.dy)==len(self.data.x): 
     269        if type(self.data.dy)==numpy.ndarray and len(self.data.dy)==len(self.data.x)and self.data.dy[0] != 0: 
    269270            sigma = self.data.dy 
    270271        else: 
     
    346347            raise ValueError,"Data must be of type DataLoader.Data1D" 
    347348        new_data = (self._scale * data) - self._background    
     349        new_data.dy[new_data.dy==0] = 1 
    348350        new_data.dxl = data.dxl 
    349351        new_data.dxw = data.dxw  
     
    730732    def get_extra_data_low(self, npts_in=None, q_start=Q_MINIMUM, nsteps=INTEGRATION_NSTEPS): 
    731733        """ 
    732             This method creates a new data set from the invariant calculator. 
    733              
    734             It will use the extrapolation parameters kept as private data members. 
    735              
    736             self._low_extrapolation_npts is the number of data points to use in to fit. 
    737             self._low_extrapolation_function will be used as the fit function. 
    738              
    739              
    740              
    741             It takes npts first points of data, fits them with a given model 
    742             then uses the new parameters resulting from the fit to create a new data set. 
    743              
    744             The new data first point is Q_MINIMUM. 
    745              
    746             The last point of the new data is the first point of the original data. 
    747             the number of q points of this data is INTEGRATION_NSTEPS. 
    748              
    749             @return: a new data of type Data1D 
     734           This method generates 2 data sets , the first is a data created during  
     735           low extrapolation . its y is generated from x in [ Q_MINIMUM - the minimum of 
     736           data.x] and the outputs of the extrapolator . 
     737            (data is the data used to compute invariant)  
     738           the second is also data produced during the fit but the x range considered 
     739           is within the reel range of data x. 
     740           x uses is in [minimum of data.x up to npts_in points] 
     741           @param npts_in: the number of first points of data to consider  for computing 
     742           y's coming out of the fit. 
     743           @param q_start: is the minimum value to uses for extrapolated data 
     744           @param npts: the number of point used to create extrapolated data  
     745            
    750746        """ 
    751747        #Create a data from result of the fit for a range outside of the data 
     
    794790    def get_extra_data_high(self, npts_in=None, q_end=Q_MAXIMUM, nsteps=INTEGRATION_NSTEPS ): 
    795791        """ 
    796             This method creates a new data from the invariant calculator. 
    797              
    798             It takes npts last points of data, fits them with a given model 
    799             (for this function only power_law will be use), then uses 
    800             the new parameters resulting from the fit to create a new data set. 
    801             The first point is the last point of data. 
    802             The last point of the new data is Q_MAXIMUM. 
    803             The number of q points of this data is INTEGRATION_NSTEPS. 
    804  
    805              
    806             @return: a new data of type Data1D 
     792           This method generates 2 data sets , the first is a data created during  
     793           low extrapolation . its y is generated from x in [ the maximum of 
     794           data.x to  Q_MAXIMUM] and the outputs of the extrapolator . 
     795            (data is the data used to compute invariant)  
     796           the second is also data produced during the fit but the x range considered 
     797           is within the reel range of data x. 
     798           x uses is from maximum of data.x up to npts_in points before data.x maximum. 
     799           @param npts_in: the number of first points of data to consider  for computing 
     800           y's coming out of the fit. 
     801           @param q_end: is the maximum value to uses for extrapolated data 
     802           @param npts: the number of point used to create extrapolated data  
     803            
    807804        """ 
    808805        #Create a data from result of the fit for a range outside of the data 
Note: See TracChangeset for help on using the changeset viewer.