Changeset f168d02 in sasview for pr_inversion/invertor.py


Ignore:
Timestamp:
Jul 1, 2008 2:56:32 PM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
2a92852
Parents:
a17ffdf
Message:

Added slit smearing (still slow)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pr_inversion/invertor.py

    re96a852 rf168d02  
    7373    suggested_alpha = 0 
    7474    ## Last number of base functions used 
    75     nfunc = 0 
     75    nfunc = 10 
    7676    ## Last output values 
    7777    out = None 
     
    191191        invertor.err = self.err 
    192192        invertor.has_bck = self.has_bck 
     193        invertor.slit_height = self.slit_height 
     194        invertor.slit_width  = self.slit_width 
    193195         
    194196        return invertor 
     
    391393         
    392394        # Construct the a matrix and b vector that represent the problem 
     395        t_0 = time.time() 
    393396        self._get_matrix(nfunc, nq, a, b) 
     397        #print "elasped: ", time.time()-t_0 
    394398              
    395399        # Perform the inversion (least square fit) 
     
    531535        from num_term import Num_terms 
    532536        estimator = Num_terms(self.clone()) 
    533          
    534         return estimator.num_terms(isquit_func) 
     537        try: 
     538            return estimator.num_terms(isquit_func) 
     539        except: 
     540            # If we fail, estimate alpha and return the default 
     541            # number of terms  
     542            best_alpha, message, elapsed =self.estimate_alpha(self.nfunc) 
     543            return self.nfunc, best_alpha, "Could not estimate number of terms" 
    535544                     
    536545    def estimate_alpha(self, nfunc): 
     
    572581            # just return the estimate 
    573582            if npeaks>1: 
    574                 message = "Your P(r) is not smooth, please check your inversion parameters" 
     583                #message = "Your P(r) is not smooth, please check your inversion parameters" 
     584                message = None 
    575585                return pr.suggested_alpha, message, elapsed 
    576586            else: 
Note: See TracChangeset for help on using the changeset viewer.