Ignore:
Timestamp:
Jul 26, 2015 2:44:06 PM (9 years ago)
Author:
butler
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:
1f5f206
Parents:
c95a1a5
Message:

Fix sphinx compile issues (and a bunch of pyling white spaces) in
CoreMultiShellModel?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/models/CoreMultiShellModel.py

    rac7be54 re0c16ce  
    5353        ## parameters with orientation: can be removed since there is no orientational params 
    5454        self._set_orientation_params() 
    55                  
    56          
     55 
    5756    def _clone(self, obj): 
    5857        """ 
     
    6766 
    6867        return obj 
    69      
    70      
     68 
    7169    def _set_dispersion(self): 
    7270        """ 
    7371        model dispersions 
    7472        Polydispersion should not be applied to s_model 
    75         """  
    76         ##set dispersion from model  
     73        """ 
     74        ##set dispersion from model 
    7775        for name , value in self.model.dispersion.iteritems():       
    7876            nshell = 0 
     
    8280                    if name.split('_')[-1] == 'shell%s' % str(nshell): 
    8381                        self.dispersion[name] = value 
    84                     else:  
     82                    else: 
    8583                        continue 
    8684            else: 
    8785                self.dispersion[name] = value 
    88                  
     86 
    8987    def _set_orientation_params(self): 
    9088        """ 
    9189        model orientation and magnetic parameters, same params for this model 
    92         """  
     90        """ 
    9391        ##set dispersion from model  
    9492        for param in self.model.orientation_params:      
     
    104102                    self.orientation_params.append(param) 
    105103                    self.magnetic_params.append(param) 
    106                     continue                            
     104                    continue 
    107105 
    108106    def _set_params(self): 
    109107        """ 
    110108        Concatenate the parameters of the model to create 
    111         this model parameters  
     109        this model parameters 
    112110        """ 
    113111        # rearrange the parameters for the given # of shells 
     
    128126            else: 
    129127                self.params[name]= value 
    130              
     128 
    131129        # set constrained values for the original model params 
    132         self._set_xtra_model_param()        
    133    
     130        self._set_xtra_model_param() 
     131 
    134132    def _set_details(self): 
    135133        """ 
    136134        Concatenate details of the original model to create 
    137         this model details  
     135        this model details 
    138136        """ 
    139137        for name ,detail in self.model.details.iteritems(): 
    140138            if name in self.params.iterkeys(): 
    141139                self.details[name]= detail 
    142              
    143      
     140 
     141 
    144142    def _set_xtra_model_param(self): 
    145143        """ 
     
    163161                                self.model.setParam(key, 0.0) 
    164162                        except: pass 
    165                       
     163 
    166164 
    167165    def getProfile(self): 
    168166        """ 
    169         Get SLD profile  
    170          
    171         : return: (r, beta) where r is a list of radius of the transition points 
    172             beta is a list of the corresponding SLD values 
    173         : Note: This works only for func_shell num = 2. 
     167        Get SLD profile 
     168        **Note:** This works only for func_shell num = 2. 
     169 
     170        :return: (r, beta) where r is a list of radius of the transition points\ 
     171         and beta is a list of the corresponding SLD values. 
    174172        """ 
    175173        r = [] 
     
    181179        r.append(self.params['rad_core0']) 
    182180        beta.append(self.params['sld_core0']) 
    183          
     181 
    184182        # for shells 
    185183        for n in range(1, self.n_shells+1): 
    186184            # Left side of each shells 
    187             r0 = r[len(r)-1]             
     185            r0 = r[len(r)-1] 
    188186            r.append(r0) 
    189187            exec "beta.append(self.params['sld_shell%s'% str(n)])" 
     
    193191            r.append(r0) 
    194192            exec "beta.append(self.params['sld_shell%s'% str(n)])" 
    195              
     193 
    196194        # for solvent 
    197195        r0 = r[len(r)-1]             
     
    201199        r.append(r_solv) 
    202200        beta.append(self.params['sld_solv']) 
    203          
     201 
    204202        return r, beta 
    205203 
    206204    def setParam(self, name, value): 
    207         """  
     205        """ 
    208206        Set the value of a model parameter 
    209      
    210         : param name: name of the parameter 
    211         : param value: value of the parameter 
     207 
     208        :param name: name of the parameter 
     209        :param value: value of the parameter 
    212210        """ 
    213211        # set param to new model 
    214212        self._setParamHelper( name, value) 
    215         ## setParam to model  
     213        ## setParam to model 
    216214        if name == 'sld_solv': 
    217215            # the sld_*** model.params not in params must set to value of sld_solv 
     
    243241                self.params[item] = value 
    244242                return 
    245          
    246243        #raise ValueError, "Model does not contain parameter %s" % name 
    247               
    248     
     244 
     245 
    249246    def _set_fixed_params(self): 
    250247        """ 
     
    252249        """ 
    253250        for item in self.model.fixed: 
    254             if item.split('.')[0] in self.params.keys():  
     251            if item.split('.')[0] in self.params.keys(): 
    255252                self.fixed.append(item) 
    256253 
    257254        self.fixed.sort() 
    258                  
     255 
    259256    def run(self, x = 0.0): 
    260         """  
     257        """ 
    261258        Evaluate the model 
    262          
    263         : param x: input q-value (float or [float, float] as [r, theta]) 
    264         : return: (DAB value) 
     259 
     260        :param x: input q-value (float or [float, float] as [r, theta]) 
     261        :return: (DAB value) 
    265262        """ 
    266263        # set effective radius and scaling factor before run 
     
    269266 
    270267    def runXY(self, x = 0.0): 
    271         """  
     268        """ 
    272269        Evaluate the model 
    273          
    274         : param x: input q-value (float or [float, float] as [qx, qy]) 
    275         : return: DAB value 
     270 
     271        :param x: input q-value (float or [float, float] as [qx, qy]) 
     272        :return: DAB value 
    276273        """   
    277274        # set effective radius and scaling factor before run 
    278275 
    279276        return self.model.runXY(x) 
    280      
     277 
    281278    ## Now (May27,10) directly uses the model eval function  
    282279    ## instead of the for-loop in Base Component. 
    283280    def evalDistribution(self, x = []): 
    284         """  
     281        """ 
    285282        Evaluate the model in cartesian coordinates 
    286          
    287         : param x: input q[], or [qx[], qy[]] 
    288         : return: scattering function P(q[]) 
     283 
     284        :param x: input q[], or [qx[], qy[]] 
     285        :return: scattering function P(q[]) 
    289286        """ 
    290287        # set effective radius and scaling factor before run 
    291288        return self.model.evalDistribution(x) 
    292      
     289 
    293290    def calculate_ER(self): 
    294         """  
     291        """ 
    295292        Calculate the effective radius for P(q)*S(q) 
    296          
     293 
    297294        :return: the value of the effective radius 
    298          
    299         """        
     295        """ 
    300296        return self.model.calculate_ER()  
    301      
     297 
    302298    def calculate_VR(self): 
    303         """  
     299        """ 
    304300        Calculate the volf ratio for P(q)*S(q) 
    305          
     301 
    306302        :return: the value of the volf ratio 
    307          
    308         """        
     303        """ 
    309304        return self.model.calculate_VR() 
    310      
     305 
    311306    def set_dispersion(self, parameter, dispersion): 
    312307        """ 
    313308        Set the dispersion object for a model parameter 
    314          
    315         : param parameter: name of the parameter [string] 
    316         :dispersion: dispersion object of type DispersionModel 
     309 
     310        :param parameter: name of the parameter [string] 
     311        :param dispersion: dispersion object of type DispersionModel 
    317312        """ 
    318313        value = None 
     
    323318            return value 
    324319        except: 
    325             raise  
     320            raise 
Note: See TracChangeset for help on using the changeset viewer.