Changeset 4b3d25b in sasview for sansmodels/src


Ignore:
Timestamp:
Nov 1, 2010 4:24:58 PM (14 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:
96d19c6
Parents:
0164899a
Message:

new model and some bug fixes

Location:
sansmodels/src/sans/models
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/ReflModel.py

    r339ce67 r4b3d25b  
    4040         thick_inter0    = 1.0 [A] 
    4141         func_inter0     = 0.0  
    42          sld_sub0        = 2.07e-006 [1/A^(2)] 
     42         sld_bottom0     = 2.07e-006 [1/A^(2)] 
    4343         sld_medium      = 1e-006 [1/A^(2)] 
    4444         background      = 0.0  
     
    8383         func_inter9     = 0.0  
    8484         func_inter10    = 0.0  
    85          sldIM_flat1     = 0.0  
    86          sldIM_flat2     = 0.0  
    87          sldIM_flat3     = 0.0  
    88          sldIM_flat4     = 0.0  
    89          sldIM_flat5     = 0.0  
    90          sldIM_flat6     = 0.0  
    91          sldIM_flat7     = 0.0  
    92          sldIM_flat8     = 0.0  
    93          sldIM_flat9     = 0.0  
    94          sldIM_flat10    = 0.0  
    95          sldIM_sub0      = 0.0  
    96          sldIM_medium    = 0.0  
    9785 
    9886    """ 
     
    10896        self.name = "ReflModel" 
    10997        ## Model description 
    110         self.description ="""Form factor of mutishells normalized by the volume. Here each shell is described 
    111                 by an exponential function; 
    112                 I) 
    113                 For A_shell != 0, 
    114                 f(r) = B*exp(A_shell*(r-r_in)/thick_shell)+C 
    115                 where 
    116                 B=(sld_out-sld_in)/(exp(A_shell)-1) 
    117                 C=sld_in-B. 
    118                 Note that in the above case, 
    119                 the function becomes a linear function 
    120                 as A_shell --> 0+ or 0-. 
    121                 II) 
    122                 For the exact point of A_shell == 0, 
    123                 f(r) = sld_in ,i.e., it crosses over flat function 
    124                 Note that the 'sld_out' becaomes NULL in this case. 
    125                  
    126                 background:background, 
    127                 rad_core: radius of sphere(core) 
    128                 thick_shell#:the thickness of the shell# 
    129                 sld_core: the SLD of the sphere 
    130                 sld_solv: the SLD of the solvent 
    131                 sld_shell: the SLD of the shell# 
    132                 A_shell#: the coefficient in the exponential function""" 
     98        self.description ="""Calculate neutron reflectivity using the Parratt iterative formula 
     99                Parameters: 
     100                background:background 
     101                scale: scale factor 
     102                sld_bottom0: the SLD of the substrate 
     103                sld_medium: the SLD of the incident medium 
     104                or superstrate 
     105                sld_flatN: the SLD of the flat region of 
     106                the N'th layer 
     107                thick_flatN: the thickness of the flat 
     108                region of the N'th layer 
     109                func_interN: the function used to describe 
     110                the interface of the N'th layer 
     111                thick_interN: the thickness of the interface 
     112                of the N'th layer 
     113                Note: the layer number starts to increase 
     114                from the bottom (substrate) to the top.""" 
    133115        
    134116        ## Parameter details [units, min, max] 
     
    138120        self.details['thick_inter0'] = ['[A]', None, None] 
    139121        self.details['func_inter0'] = ['', None, None] 
    140         self.details['sld_sub0'] = ['[1/A^(2)]', None, None] 
     122        self.details['sld_bottom0'] = ['[1/A^(2)]', None, None] 
    141123        self.details['sld_medium'] = ['[1/A^(2)]', None, None] 
    142124        self.details['background'] = ['', None, None] 
     
    181163        self.details['func_inter9'] = ['', None, None] 
    182164        self.details['func_inter10'] = ['', None, None] 
    183         self.details['sldIM_flat1'] = ['', None, None] 
    184         self.details['sldIM_flat2'] = ['', None, None] 
    185         self.details['sldIM_flat3'] = ['', None, None] 
    186         self.details['sldIM_flat4'] = ['', None, None] 
    187         self.details['sldIM_flat5'] = ['', None, None] 
    188         self.details['sldIM_flat6'] = ['', None, None] 
    189         self.details['sldIM_flat7'] = ['', None, None] 
    190         self.details['sldIM_flat8'] = ['', None, None] 
    191         self.details['sldIM_flat9'] = ['', None, None] 
    192         self.details['sldIM_flat10'] = ['', None, None] 
    193         self.details['sldIM_sub0'] = ['', None, None] 
    194         self.details['sldIM_medium'] = ['', None, None] 
    195165 
    196166        ## fittable parameters 
  • sansmodels/src/sans/models/ReflectivityModel.py

    r8f20419d r4b3d25b  
    55from math import floor 
    66from scipy.special import erf 
    7 func_list = {'Erf':0, 'Linear':1, 'RParabolic':2, \ 
    8                      'LParabola':3, 'RCubic':4, 'LCubic':5} 
     7func_list = {'Erf':0, 'Linear':1} 
    98max_nshells = 10 
    109class ReflectivityModel(BaseComponent): 
     
    1615        BaseComponent.__init__(self) 
    1716        """ 
    18         :param multfactor: number of layers in the model, assumes 0<= n_shells <=10. 
     17        :param multfactor: number of layers in the model,  
     18        assumes 0<= n_shells <=10. 
    1919        """ 
    2020 
     
    173173        sub_range = floor(n_sub/2.0) 
    174174        z.append(0) 
    175         beta.append(self.params['sld_sub0'])  
     175        beta.append(self.params['sld_bottom0'])  
    176176        
    177177        z0 = 0 
     
    205205 
    206206                        if i == 1: 
    207                             sld_l = self.params['sld_sub0'] 
     207                            sld_l = self.params['sld_bottom0'] 
    208208                        else: 
    209209                            sld_l = self.params['sld_flat%s'% str(i-1)] 
     
    235235        beta.append(self.params['sld_medium'])  
    236236        z.insert(0,-z_ext) 
    237         beta.insert(0,self.params['sld_sub0'])  
     237        beta.insert(0,self.params['sld_bottom0'])  
    238238        z = [z0 - x for x in z] 
    239239        z.reverse() 
     
    294294        ## setParam to model  
    295295        if name=='sld_medium': 
    296             # the sld_*** model.params not in params must set to value of sld_solv 
     296            # the sld_*** model.params not in params must set  
     297            # to value of sld_solv 
    297298            for key in self.model.params.iterkeys(): 
    298299                if key not in self.params.keys()and key.split('_')[0] == 'sld': 
Note: See TracChangeset for help on using the changeset viewer.