Changeset a1b2471 in sasview for sansmodels/src/sans/models/SphereExpShellModel.py
- Timestamp:
- Sep 21, 2010 5:44:24 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:
- db08737
- Parents:
- 60c320b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/SphereExpShellModel.py
re096270 ra1b2471 42 42 for item in self.model.orientation_params: 43 43 self.orientation_params.append(item) 44 44 self.getProfile() 45 45 def _clone(self, obj): 46 46 """ … … 133 133 self.model.setParam(key, value) 134 134 except: pass 135 136 135 def getProfile(self): 136 """ 137 Get SLD profile 138 139 : return: (r, beta) where r is a list of radius of the transition points 140 beta is a list of the corresponding SLD values 141 : Note: This works only for func_shell# = 2. 142 """ 143 # max_pts for each shells 144 max_pts = 10 145 r = [] 146 beta = [] 147 # for core at r=0 148 r.append(0) 149 beta.append(self.params['sld_core']) 150 # for core at r=rad_core 151 r.append(self.params['rad_core']) 152 beta.append(self.params['sld_core']) 153 154 # for shells 155 for n in range(1,self.n_shells+1): 156 # Left side of each shells 157 r0 = r[len(r)-1] 158 r.append(r0) 159 exec "beta.append(self.params['sld_in_shell%s'% str(n)])" 160 161 exec "A = self.params['A_shell%s'% str(n)]" 162 if A ==0: 163 # Right side of each shells 164 exec "r0 += self.params['thick_shell%s'% str(n)]" 165 r.append(r0) 166 exec "beta.append(self.params['sld_in_shell%s'% str(n)])" 167 else: 168 from math import exp 169 rn = r0 170 for n_sub in range(0,max_pts): 171 # Right side of each sub_shells 172 exec "rn += self.params['thick_shell%s'% str(n)]/10.0" 173 r.append(rn) 174 exec "slope = (self.params['sld_out_shell%s'% str(n)] \ 175 -self.params['sld_in_shell%s'% str(n)]) \ 176 /(exp(self.params['A_shell%s'% str(n)])-1)" 177 exec "const = (self.params['sld_in_shell%s'% str(n)]-slope)" 178 exec "beta_n = slope*exp((self.params['A_shell%s'% str(n)]*(rn-r0) \ 179 /self.params['thick_shell%s'% str(n)])) + const" 180 beta.append(beta_n) 181 182 # for solvent 183 r0 = r[len(r)-1] 184 r.append(r0) 185 beta.append(self.params['sld_solv']) 186 r_solv = 5*r0/4 187 r.append(r_solv) 188 beta.append(self.params['sld_solv']) 189 190 return r, beta 191 137 192 def setParam(self, name, value): 138 193 """
Note: See TracChangeset
for help on using the changeset viewer.