Changeset 4b3d25b in sasview for sansmodels/src/sans/models
- Timestamp:
- Nov 1, 2010 4:24:58 PM (14 years ago)
- 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
- Location:
- sansmodels/src/sans/models
- Files:
-
- 4 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/ReflModel.py
r339ce67 r4b3d25b 40 40 thick_inter0 = 1.0 [A] 41 41 func_inter0 = 0.0 42 sld_ sub0= 2.07e-006 [1/A^(2)]42 sld_bottom0 = 2.07e-006 [1/A^(2)] 43 43 sld_medium = 1e-006 [1/A^(2)] 44 44 background = 0.0 … … 83 83 func_inter9 = 0.0 84 84 func_inter10 = 0.0 85 sldIM_flat1 = 0.086 sldIM_flat2 = 0.087 sldIM_flat3 = 0.088 sldIM_flat4 = 0.089 sldIM_flat5 = 0.090 sldIM_flat6 = 0.091 sldIM_flat7 = 0.092 sldIM_flat8 = 0.093 sldIM_flat9 = 0.094 sldIM_flat10 = 0.095 sldIM_sub0 = 0.096 sldIM_medium = 0.097 85 98 86 """ … … 108 96 self.name = "ReflModel" 109 97 ## 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.""" 133 115 134 116 ## Parameter details [units, min, max] … … 138 120 self.details['thick_inter0'] = ['[A]', None, None] 139 121 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] 141 123 self.details['sld_medium'] = ['[1/A^(2)]', None, None] 142 124 self.details['background'] = ['', None, None] … … 181 163 self.details['func_inter9'] = ['', None, None] 182 164 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]195 165 196 166 ## fittable parameters -
sansmodels/src/sans/models/ReflectivityModel.py
r8f20419d r4b3d25b 5 5 from math import floor 6 6 from scipy.special import erf 7 func_list = {'Erf':0, 'Linear':1, 'RParabolic':2, \ 8 'LParabola':3, 'RCubic':4, 'LCubic':5} 7 func_list = {'Erf':0, 'Linear':1} 9 8 max_nshells = 10 10 9 class ReflectivityModel(BaseComponent): … … 16 15 BaseComponent.__init__(self) 17 16 """ 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. 19 19 """ 20 20 … … 173 173 sub_range = floor(n_sub/2.0) 174 174 z.append(0) 175 beta.append(self.params['sld_ sub0'])175 beta.append(self.params['sld_bottom0']) 176 176 177 177 z0 = 0 … … 205 205 206 206 if i == 1: 207 sld_l = self.params['sld_ sub0']207 sld_l = self.params['sld_bottom0'] 208 208 else: 209 209 sld_l = self.params['sld_flat%s'% str(i-1)] … … 235 235 beta.append(self.params['sld_medium']) 236 236 z.insert(0,-z_ext) 237 beta.insert(0,self.params['sld_ sub0'])237 beta.insert(0,self.params['sld_bottom0']) 238 238 z = [z0 - x for x in z] 239 239 z.reverse() … … 294 294 ## setParam to model 295 295 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 297 298 for key in self.model.params.iterkeys(): 298 299 if key not in self.params.keys()and key.split('_')[0] == 'sld':
Note: See TracChangeset
for help on using the changeset viewer.