Changeset 339ce67 in sasview for sansmodels/src/sans/models
- Timestamp:
- Oct 12, 2010 6:22:08 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:
- 20f00bed
- Parents:
- aaad3098
- Location:
- sansmodels/src/sans/models
- Files:
-
- 11 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/CoreFourShellModel.py
r35aface r339ce67 37 37 List of default parameters: 38 38 scale = 1.0 39 rad_core 40 sld_core 39 rad_core0 = 60.0 [A] 40 sld_core0 = 6.4e-006 [1/A^(2)] 41 41 thick_shell1 = 10.0 [A] 42 42 sld_shell1 = 1e-006 [1/A^(2)] … … 64 64 self.description =""" Calculates the scattering intensity from a core-4 shell structure. 65 65 scale = scale factor * volume fraction 66 rad_core : the radius of the core67 sld_core : the SLD of the core66 rad_core0: the radius of the core 67 sld_core0: the SLD of the core 68 68 thick_shelli: the thickness of the i'th shell from the core 69 69 sld_shelli: the SLD of the i'th shell from the core … … 74 74 self.details = {} 75 75 self.details['scale'] = ['', None, None] 76 self.details['rad_core '] = ['[A]', None, None]77 self.details['sld_core '] = ['[1/A^(2)]', None, None]76 self.details['rad_core0'] = ['[A]', None, None] 77 self.details['sld_core0'] = ['[1/A^(2)]', None, None] 78 78 self.details['thick_shell1'] = ['[A]', None, None] 79 79 self.details['sld_shell1'] = ['[1/A^(2)]', None, None] … … 88 88 89 89 ## fittable parameters 90 self.fixed=['thick_shell4.width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'rad_core .width']90 self.fixed=['thick_shell4.width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'rad_core0.width'] 91 91 92 92 ## non-fittable parameters -
sansmodels/src/sans/models/CoreMultiShellModel.py
r35aface r339ce67 3 3 from sans.models.CoreFourShellModel import CoreFourShellModel 4 4 import copy 5 max_nshells = 45 max_nshells = 5 6 6 class CoreMultiShellModel(BaseComponent): 7 7 """ … … 42 42 self._set_fixed_params() 43 43 44 ## functional multiplicity of the model 45 self.multiplicity = 5 44 ## functional multiplicity info of the model 45 # [int(maximum no. of functionality),"str(Titl), 46 # [str(name of function0),...], [str(x-asix name of sld),...]] 47 self.multiplicity_info = [max_nshells,"No. of Shells:",[],['Radius']] 48 46 49 ## parameters with orientation: can be removed since there is no orientational params 47 50 for item in self.model.orientation_params: … … 91 94 nshell = 0 92 95 if name.split('_')[0] == 'thick' or name.split('_')[0] == 'sld': 93 if name.split('_')[1] == 'solv' or name.split('_')[1] == 'core ':96 if name.split('_')[1] == 'solv' or name.split('_')[1] == 'core0': 94 97 self.params[name]= value 95 98 continue … … 146 149 # for core at r=0 147 150 r.append(0) 148 beta.append(self.params['sld_core '])151 beta.append(self.params['sld_core0']) 149 152 # for core at r=rad_core 150 r.append(self.params['rad_core '])151 beta.append(self.params['sld_core '])153 r.append(self.params['rad_core0']) 154 beta.append(self.params['sld_core0']) 152 155 153 156 # for shells -
sansmodels/src/sans/models/OnionModel.py
r35aface r339ce67 38 38 n_shells = 1.0 39 39 scale = 1.0 40 rad_core 41 sld_core 40 rad_core0 = 200.0 [A] 41 sld_core0 = 1e-006 [1/A^(2)] 42 42 sld_solv = 6.4e-006 [1/A^(2)] 43 43 background = 0.0 [1/cm] … … 122 122 123 123 background:background, 124 rad_core : radius of sphere(core)124 rad_core0: radius of sphere(core) 125 125 thick_shell#:the thickness of the shell# 126 sld_core : the SLD of the sphere126 sld_core0: the SLD of the sphere 127 127 sld_solv: the SLD of the solvent 128 128 sld_shell: the SLD of the shell# … … 133 133 self.details['n_shells'] = ['', None, None] 134 134 self.details['scale'] = ['', None, None] 135 self.details['rad_core '] = ['[A]', None, None]136 self.details['sld_core '] = ['[1/A^(2)]', None, None]135 self.details['rad_core0'] = ['[A]', None, None] 136 self.details['sld_core0'] = ['[1/A^(2)]', None, None] 137 137 self.details['sld_solv'] = ['[1/A^(2)]', None, None] 138 138 self.details['background'] = ['[1/cm]', None, None] … … 189 189 190 190 ## fittable parameters 191 self.fixed=['rad_core .width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'thick_shell4.width', 'thick_shell5.width', 'thick_shell6.width', 'thick_shell7.width', 'thick_shell8.width', 'thick_shell9.width', 'thick_shell10.width']191 self.fixed=['rad_core0.width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'thick_shell4.width', 'thick_shell5.width', 'thick_shell6.width', 'thick_shell7.width', 'thick_shell8.width', 'thick_shell9.width', 'thick_shell10.width'] 192 192 193 193 ## non-fittable parameters -
sansmodels/src/sans/models/RPA10Model.py
r35aface r339ce67 46 46 47 47 ## functional multiplicity of the model 48 self.multiplicity = max_case_n 48 self.multiplicity_info = [max_case_n,"Case No.:",["C/D Binary Mixture of Homopolymers", 49 "C-D Diblock Copolymer", 50 "B/C/D Ternary Mixture of Homopolymers", 51 "B/C-D Mixture of Homopolymer B and Diblock Copolymer C-D", 52 "B-C-D Triblock Copolymer", 53 "A/B/C/D Quaternary Mixture of Homopolymers", 54 "A/B/C-D Mixture of Homopolymer A/B and Diblock C-D", 55 "A/B-C-D Mixture of Homopolymer A and triblock B-C-D", 56 "A-B/C-D Mixture of Diblock Copolymer A-B and Diblock C-D", 57 "A-B-C-D Four-block Copolymer"], 58 []] 49 59 50 60 def _clone(self, obj): -
sansmodels/src/sans/models/ReflModel.py
r35aface r339ce67 83 83 func_inter9 = 0.0 84 84 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 85 97 86 98 """ … … 169 181 self.details['func_inter9'] = ['', None, None] 170 182 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] 171 195 172 196 ## fittable parameters -
sansmodels/src/sans/models/ReflectivityModel.py
r35aface r339ce67 49 49 self.model.params['n_layers'] = self.n_layers 50 50 51 ## functional multiplicity of the model 52 self.multiplicity = max_nshells 51 ## functional multiplicity info of the model 52 # [int(maximum no. of functionality),"str(Titl), 53 # [str(name of function0),...], [str(x-asix name of sld),...]] 54 self.multiplicity_info = [max_nshells,"No. of Layers:",[],['Depth']] 55 53 56 54 57 def _clone(self, obj): … … 84 87 n = 0 85 88 pos = len(name.split('_'))-1 86 if name.split('_')[0] == 'func': 89 if name.split('_')[0] == 'sldIM': 90 continue 91 elif name.split('_')[0] == 'func': 87 92 n= -1 88 93 while n<self.n_layers: … … 141 146 if key.split('_')[1] == 'flat%s' % str(nshell+1): 142 147 try: 143 value = self.model.params['sld_medium'] 148 if key.split('_')[0] == 'sld': 149 value = self.model.params['sld_medium'] 150 elif key.split('_')[0] == 'sldIM': 151 value = self.model.params['sldIM_medium'] 144 152 self.model.setParam(key, value) 145 153 except: pass -
sansmodels/src/sans/models/SphereExpShellModel.py
rfbae881 r339ce67 39 39 self._set_fixed_params() 40 40 self.model.params['n_shells'] = self.n_shells 41 ## functional multiplicity info of the model 42 # [int(maximum no. of functionality),"str(Titl), 43 # [str(name of function0),...], [str(x-asix name of sld),...]] 44 self.multiplicity_info = [max_nshells,"No. of Shells:",[],['Radius']] 45 41 46 ## parameters with orientation: can be removed since there is no orientational params 42 47 for item in self.model.orientation_params: … … 146 151 # for core at r=0 147 152 r.append(0) 148 beta.append(self.params['sld_core '])153 beta.append(self.params['sld_core0']) 149 154 # for core at r=rad_core 150 r.append(self.params['rad_core '])151 beta.append(self.params['sld_core '])155 r.append(self.params['rad_core0']) 156 beta.append(self.params['sld_core0']) 152 157 153 158 # for shells -
sansmodels/src/sans/models/c_extensions/corefourshell.c
rc724ccd r339ce67 18 18 19 19 dp[0] = pars->scale; 20 dp[1] = pars->rad_core ;21 dp[2] = pars->sld_core ;20 dp[1] = pars->rad_core0; 21 dp[2] = pars->sld_core0; 22 22 dp[3] = pars->thick_shell1; 23 23 dp[4] = pars->sld_shell1; -
sansmodels/src/sans/models/c_extensions/corefourshell.h
rc724ccd r339ce67 6 6 */ 7 7 //[PYTHONCLASS] = CoreFourShellModel 8 //[DISP_PARAMS] = rad_core , thick_shell1,thick_shell2,thick_shell3,thick_shell48 //[DISP_PARAMS] = rad_core0, thick_shell1,thick_shell2,thick_shell3,thick_shell4 9 9 //[DESCRIPTION] =<text> Calculates the scattering intensity from a core-4 shell structure. 10 10 // scale = scale factor * volume fraction 11 // rad_core : the radius of the core12 // sld_core : the SLD of the core11 // rad_core0: the radius of the core 12 // sld_core0: the SLD of the core 13 13 // thick_shelli: the thickness of the i'th shell from the core 14 14 // sld_shelli: the SLD of the i'th shell from the core … … 16 16 // background: incoherent background 17 17 // </text> 18 //[FIXED]=<text> thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core .width </text>18 //[FIXED]=<text> thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core0.width </text> 19 19 //[ORIENTATION_PARAMS]= <text> </text> 20 20 … … 24 24 double scale; 25 25 26 /// Radius of the core [A]27 // [DEFAULT]=rad_core =60. [A]28 double rad_core ;26 /// Radius of the core0 [A] 27 // [DEFAULT]=rad_core0=60. [A] 28 double rad_core0; 29 29 30 /// sld of core [1/A^(2)]31 // [DEFAULT]=sld_core = 6.4e-6 [1/A^(2)]32 double sld_core ;30 /// sld of core0 [1/A^(2)] 31 // [DEFAULT]=sld_core0= 6.4e-6 [1/A^(2)] 32 double sld_core0; 33 33 34 34 /// thickness of the shell1 [A] -
sansmodels/src/sans/models/c_extensions/fcc.c
rd5b6a9d r339ce67 65 65 double answer; 66 66 double Pi = 4.0*atan(1.0); 67 double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2 ;67 double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2,contrast; 68 68 69 69 double dp[5]; … … 77 77 Da = pars->d_factor*aa; 78 78 qDa_2 = pow(q*Da,2.0); 79 contrast = pars->sldSph - pars->sldSolv; 79 80 80 81 latticeScale = 4.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa*sqrt(2.0),3.0); … … 133 134 134 135 // Use SphereForm directly from libigor 135 answer = SphereForm (dp,q)*Zq;136 answer = SphereForm_Paracrystal(pars->radius,contrast,q)*Zq; 136 137 137 138 //consider scales -
sansmodels/src/sans/models/c_extensions/onion.c
ra1b2471 r339ce67 11 11 int n = dp[0]; 12 12 double scale = dp[1]; 13 double rad_core = dp[2];14 double sld_core = dp[3];13 double rad_core0 = dp[2]; 14 double sld_core0 = dp[3]; 15 15 double sld_solv = dp[4]; 16 16 double background = dp[5]; … … 30 30 fun_type[i] = dp[i+45]; 31 31 } 32 sld_out[0] = sld_core ;32 sld_out[0] = sld_core0; 33 33 sld_out[n+1] = sld_solv; 34 sld_in[0] = sld_core ;34 sld_in[0] = sld_core0; 35 35 sld_in[n+1] = sld_solv; 36 thick[0] = rad_core ;36 thick[0] = rad_core0; 37 37 thick[n+1] = 1e+10; 38 38 A[0] = 0.0; … … 69 69 } 70 70 else{ 71 slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1 );71 slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1.0); 72 72 } 73 73 for (j=0; j<2; j++){ … … 174 174 dp[0] = pars->n_shells; 175 175 dp[1] = pars->scale; 176 dp[2] = pars->rad_core ;177 dp[3] = pars->sld_core ;176 dp[2] = pars->rad_core0; 177 dp[3] = pars->sld_core0; 178 178 dp[4] = pars->sld_solv; 179 179 dp[5] = pars->background; -
sansmodels/src/sans/models/c_extensions/onion.h
r7381f34 r339ce67 6 6 */ 7 7 //[PYTHONCLASS] = OnionModel 8 //[DISP_PARAMS] = rad_core , thick_shell1,thick_shell2,thick_shell3,thick_shell4, thick_shell5,thick_shell6,thick_shell7,thick_shell8,thick_shell9,thick_shell108 //[DISP_PARAMS] = rad_core0, thick_shell1,thick_shell2,thick_shell3,thick_shell4, thick_shell5,thick_shell6,thick_shell7,thick_shell8,thick_shell9,thick_shell10 9 9 //[DESCRIPTION] =<text>Form factor of mutishells normalized by the volume. Here each shell is described 10 10 // by an exponential function; … … 24 24 // 25 25 // background:background, 26 // rad_core : radius of sphere(core)26 // rad_core0: radius of sphere(core) 27 27 // thick_shell#:the thickness of the shell# 28 // sld_core : the SLD of the sphere28 // sld_core0: the SLD of the sphere 29 29 // sld_solv: the SLD of the solvent 30 30 // sld_shell: the SLD of the shell# 31 31 // A_shell#: the coefficient in the exponential function 32 32 // </text> 33 //[FIXED]= <text>rad_core .width;thick_shell1.width;thick_shell2.width;thick_shell3.width;thick_shell4.width;thick_shell5.width;thick_shell6.width;thick_shell7.width;thick_shell8.width;thick_shell9.width;thick_shell10.width</text>33 //[FIXED]= <text>rad_core0.width;thick_shell1.width;thick_shell2.width;thick_shell3.width;thick_shell4.width;thick_shell5.width;thick_shell6.width;thick_shell7.width;thick_shell8.width;thick_shell9.width;thick_shell10.width</text> 34 34 //[ORIENTATION_PARAMS]= <text> </text> 35 35 … … 42 42 double scale; 43 43 /// Radius of sphere [A] 44 // [DEFAULT]=rad_core =200.0 [A]45 double rad_core ;44 // [DEFAULT]=rad_core0=200.0 [A] 45 double rad_core0; 46 46 /// sld_core [1/A^(2)] 47 // [DEFAULT]=sld_core = 1.0e-6 [1/A^(2)]48 double sld_core ;47 // [DEFAULT]=sld_core0= 1.0e-6 [1/A^(2)] 48 double sld_core0; 49 49 /// sld_solv [1/A^(2)] 50 50 // [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)] -
sansmodels/src/sans/models/c_extensions/refl.c
r35aface r339ce67 268 268 double background = dp[6]; 269 269 270 double sld[n+2],sld_ nul[n+2],thick_inter[n+2],thick[n+2],total_thick;270 double sld[n+2],sld_im[n+2],thick_inter[n+2],thick[n+2],total_thick; 271 271 fun_type[0] = dp[3]; 272 272 for (i =1; i<=n; i++){ … … 275 275 thick[i] = dp[i+26]; 276 276 fun_type[i] = dp[i+36]; 277 sld_im[i] = dp[i+46]; 277 278 278 279 total_thick += thick[i] + thick_inter[i]; … … 280 281 sld[0] = sld_sub; 281 282 sld[n+1] = sld_super; 283 sld_im[0] = fabs(dp[0+56]); 284 sld_im[n+1] = fabs(dp[1+56]); 282 285 thick[0] = total_thick/5.0; 283 286 thick[n+1] = total_thick/5.0; … … 287 290 double nsl=21.0; //nsl = Num_sub_layer: MUST ODD number in double //no other number works now 288 291 int n_s, floor_nsl; 289 double sld_i, dz,phi,R,ko2;292 double sld_i,sldim_i,dz,phi,R,ko2; 290 293 double sign,erfunc; 291 294 double pi; … … 300 303 //Checking if floor is available. 301 304 //no imaginary sld inputs in this function yet 302 n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi), 0.0);303 n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi), 0.0);305 n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sld_im[0]); 306 n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sld_im[n+1]); 304 307 ko2 = pow(2.0*pi/lamda,2.0); 305 308 … … 323 326 dz = thick[i]; 324 327 sld_i = sld[i]; 328 sldim_i = sld_im[i]; 325 329 } 326 330 else{ 327 331 dz = thick_inter[i-1]/nsl; 328 sld_i = interfunc(fun_type[i-1],nsl, n_s, sld[i-1], sld[i]); 332 if (sld[i-1] == sld[i]){ 333 sld_i = sld[i]; 334 } 335 else{ 336 sld_i = interfunc(fun_type[i-1],nsl, n_s, sld[i-1], sld[i]); 337 } 338 if (sld_im[i-1] == sld_im[i]){ 339 sldim_i = sld_im[i]; 340 } 341 else{ 342 sldim_i = interfunc(fun_type[i-1],nsl, n_s, sld_im[i-1], sld_im[i]); 343 } 329 344 } 330 nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi), 0.0);345 nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sldim_i); 331 346 nn2=cmult(nn,nn); 332 347 … … 366 381 */ 367 382 double refl_analytical_1D(ReflParameters *pars, double q) { 368 double dp[ 47];383 double dp[59]; 369 384 370 385 dp[0] = pars->n_layers; … … 420 435 dp[46] = pars->func_inter10; 421 436 437 dp[47] = pars->sldIM_flat1; 438 dp[48] = pars->sldIM_flat2; 439 dp[49] = pars->sldIM_flat3; 440 dp[50] = pars->sldIM_flat4; 441 dp[51] = pars->sldIM_flat5; 442 dp[52] = pars->sldIM_flat6; 443 dp[53] = pars->sldIM_flat7; 444 dp[54] = pars->sldIM_flat8; 445 dp[55] = pars->sldIM_flat9; 446 dp[56] = pars->sldIM_flat10; 447 448 dp[57] = pars->sldIM_sub0; 449 dp[58] = pars->sldIM_medium; 450 422 451 return re_kernel(dp, q); 423 452 } -
sansmodels/src/sans/models/c_extensions/refl.h
r35aface r339ce67 142 142 double func_inter10; 143 143 144 // [DEFAULT]=sldIM_flat1=0 145 double sldIM_flat1; 146 // [DEFAULT]=sldIM_flat2=0 147 double sldIM_flat2; 148 // [DEFAULT]=sldIM_flat3=0 149 double sldIM_flat3; 150 // [DEFAULT]=sldIM_flat4=0 151 double sldIM_flat4; 152 // [DEFAULT]=sldIM_flat5=0 153 double sldIM_flat5; 154 // [DEFAULT]=sldIM_flat6=0 155 double sldIM_flat6; 156 // [DEFAULT]=sldIM_flat7=0 157 double sldIM_flat7; 158 // [DEFAULT]=sldIM_flat8=0 159 double sldIM_flat8; 160 // [DEFAULT]=sldIM_flat9=0 161 double sldIM_flat9; 162 // [DEFAULT]=sldIM_flat10=0 163 double sldIM_flat10; 164 // [DEFAULT]=sldIM_sub0=0 165 double sldIM_sub0; 166 // [DEFAULT]=sldIM_medium=0 167 double sldIM_medium; 144 168 145 169 } ReflParameters; -
sansmodels/src/sans/models/c_models/CCoreFourShellModel.cpp
r35aface r339ce67 97 97 PyDict_SetItemString(self->params,"thick_shell2",Py_BuildValue("d",10.000000000000)); 98 98 PyDict_SetItemString(self->params,"sld_shell1",Py_BuildValue("d",0.000001000000)); 99 PyDict_SetItemString(self->params," rad_core",Py_BuildValue("d",60.000000000000));100 PyDict_SetItemString(self->params,"sld_core ",Py_BuildValue("d",0.000006400000));99 PyDict_SetItemString(self->params,"thick_shell3",Py_BuildValue("d",10.000000000000)); 100 PyDict_SetItemString(self->params,"sld_core0",Py_BuildValue("d",0.000006400000)); 101 101 PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000)); 102 PyDict_SetItemString(self->params," thick_shell3",Py_BuildValue("d",10.000000000000));102 PyDict_SetItemString(self->params,"rad_core0",Py_BuildValue("d",60.000000000000)); 103 103 PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006400000)); 104 104 PyDict_SetItemString(self->params,"sld_shell3",Py_BuildValue("d",0.000003000000)); … … 107 107 PyObject * disp_dict; 108 108 disp_dict = PyDict_New(); 109 self->model->rad_core .dispersion->accept_as_source(visitor, self->model->rad_core.dispersion, disp_dict);110 PyDict_SetItemString(self->dispersion, "rad_core ", disp_dict);109 self->model->rad_core0.dispersion->accept_as_source(visitor, self->model->rad_core0.dispersion, disp_dict); 110 PyDict_SetItemString(self->dispersion, "rad_core0", disp_dict); 111 111 disp_dict = PyDict_New(); 112 112 self->model->thick_shell1.dispersion->accept_as_source(visitor, self->model->thick_shell1.dispersion, disp_dict); … … 257 257 self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") ); 258 258 self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") ); 259 self->model-> rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );260 self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );259 self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") ); 260 self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") ); 261 261 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 262 self->model-> thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );262 self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") ); 263 263 self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") ); 264 264 self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") ); … … 266 266 PyObject* disp_dict; 267 267 DispersionVisitor* visitor = new DispersionVisitor(); 268 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core ");269 self->model->rad_core .dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);268 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0"); 269 self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict); 270 270 disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1"); 271 271 self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict); … … 345 345 self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") ); 346 346 self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") ); 347 self->model-> rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );348 self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );347 self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") ); 348 self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") ); 349 349 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 350 self->model-> thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );350 self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") ); 351 351 self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") ); 352 352 self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") ); … … 354 354 PyObject* disp_dict; 355 355 DispersionVisitor* visitor = new DispersionVisitor(); 356 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core ");357 self->model->rad_core .dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);356 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0"); 357 self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict); 358 358 disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1"); 359 359 self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict); … … 420 420 self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") ); 421 421 self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") ); 422 self->model-> rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );423 self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );422 self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") ); 423 self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") ); 424 424 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 425 self->model-> thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );425 self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") ); 426 426 self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") ); 427 427 self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") ); … … 429 429 PyObject* disp_dict; 430 430 DispersionVisitor* visitor = new DispersionVisitor(); 431 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core ");432 self->model->rad_core .dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);431 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0"); 432 self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict); 433 433 disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1"); 434 434 self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict); … … 464 464 self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") ); 465 465 self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") ); 466 self->model-> rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );467 self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );466 self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") ); 467 self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") ); 468 468 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 469 self->model-> thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );469 self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") ); 470 470 self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") ); 471 471 self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") ); … … 473 473 PyObject* disp_dict; 474 474 DispersionVisitor* visitor = new DispersionVisitor(); 475 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core ");476 self->model->rad_core .dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);475 disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0"); 476 self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict); 477 477 disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1"); 478 478 self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict); … … 538 538 // Ugliness necessary to go from python to C 539 539 // TODO: refactor this 540 if (!strcmp(par_name, "rad_core ")) {541 self->model->rad_core .dispersion = dispersion;540 if (!strcmp(par_name, "rad_core0")) { 541 self->model->rad_core0.dispersion = dispersion; 542 542 } else if (!strcmp(par_name, "thick_shell1")) { 543 543 self->model->thick_shell1.dispersion = dispersion; -
sansmodels/src/sans/models/c_models/CReflModel.cpp
r35aface r339ce67 90 90 91 91 // Initialize parameter dictionary 92 PyDict_SetItemString(self->params,"sldIM_flat4",Py_BuildValue("d",0.000000000000)); 92 93 PyDict_SetItemString(self->params,"thick_flat8",Py_BuildValue("d",100.000000000000)); 93 94 PyDict_SetItemString(self->params,"thick_flat9",Py_BuildValue("d",100.000000000000)); 95 PyDict_SetItemString(self->params,"sldIM_flat7",Py_BuildValue("d",0.000000000000)); 96 PyDict_SetItemString(self->params,"sldIM_flat10",Py_BuildValue("d",0.000000000000)); 97 PyDict_SetItemString(self->params,"sldIM_flat5",Py_BuildValue("d",0.000000000000)); 94 98 PyDict_SetItemString(self->params,"thick_flat1",Py_BuildValue("d",10.000000000000)); 95 99 PyDict_SetItemString(self->params,"thick_flat3",Py_BuildValue("d",100.000000000000)); … … 109 113 PyDict_SetItemString(self->params,"thick_inter8",Py_BuildValue("d",1.000000000000)); 110 114 PyDict_SetItemString(self->params,"thick_inter9",Py_BuildValue("d",1.000000000000)); 115 PyDict_SetItemString(self->params,"sldIM_flat1",Py_BuildValue("d",0.000000000000)); 111 116 PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000)); 117 PyDict_SetItemString(self->params,"sldIM_flat2",Py_BuildValue("d",0.000000000000)); 112 118 PyDict_SetItemString(self->params,"func_inter9",Py_BuildValue("d",0.000000000000)); 113 119 PyDict_SetItemString(self->params,"thick_inter10",Py_BuildValue("d",1.000000000000)); 120 PyDict_SetItemString(self->params,"sldIM_flat3",Py_BuildValue("d",0.000000000000)); 114 121 PyDict_SetItemString(self->params,"func_inter8",Py_BuildValue("d",0.000000000000)); 115 122 PyDict_SetItemString(self->params,"thick_flat2",Py_BuildValue("d",100.000000000000)); … … 129 136 PyDict_SetItemString(self->params,"sld_flat2",Py_BuildValue("d",0.000003500000)); 130 137 PyDict_SetItemString(self->params,"sld_flat3",Py_BuildValue("d",0.000004000000)); 138 PyDict_SetItemString(self->params,"sldIM_flat8",Py_BuildValue("d",0.000000000000)); 131 139 PyDict_SetItemString(self->params,"sld_flat8",Py_BuildValue("d",0.000003500000)); 132 140 PyDict_SetItemString(self->params,"sld_flat9",Py_BuildValue("d",0.000004000000)); 141 PyDict_SetItemString(self->params,"sldIM_flat9",Py_BuildValue("d",0.000000000000)); 133 142 PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000)); 134 143 PyDict_SetItemString(self->params,"func_inter1",Py_BuildValue("d",0.000000000000)); 144 PyDict_SetItemString(self->params,"sldIM_sub0",Py_BuildValue("d",0.000000000000)); 145 PyDict_SetItemString(self->params,"sldIM_medium",Py_BuildValue("d",0.000000000000)); 135 146 PyDict_SetItemString(self->params,"sld_flat10",Py_BuildValue("d",0.000003500000)); 136 147 PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",1.000000000000)); 148 PyDict_SetItemString(self->params,"sldIM_flat6",Py_BuildValue("d",0.000000000000)); 137 149 PyDict_SetItemString(self->params,"func_inter4",Py_BuildValue("d",0.000000000000)); 138 150 PyDict_SetItemString(self->params,"func_inter10",Py_BuildValue("d",0.000000000000)); … … 272 284 273 285 // Reader parameter dictionary 286 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") ); 274 287 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 275 288 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 289 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") ); 290 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") ); 291 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") ); 276 292 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 277 293 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 291 307 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 292 308 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 309 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") ); 293 310 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 311 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") ); 294 312 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 295 313 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 314 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") ); 296 315 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 297 316 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 311 330 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 312 331 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 332 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") ); 313 333 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 314 334 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 335 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") ); 315 336 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 316 337 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 338 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") ); 339 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") ); 317 340 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 318 341 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 342 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") ); 319 343 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 320 344 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); … … 386 410 387 411 // Reader parameter dictionary 412 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") ); 388 413 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 389 414 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 415 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") ); 416 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") ); 417 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") ); 390 418 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 391 419 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 405 433 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 406 434 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 435 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") ); 407 436 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 437 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") ); 408 438 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 409 439 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 440 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") ); 410 441 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 411 442 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 425 456 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 426 457 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 458 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") ); 427 459 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 428 460 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 461 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") ); 429 462 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 430 463 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 464 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") ); 465 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") ); 431 466 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 432 467 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 468 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") ); 433 469 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 434 470 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); … … 487 523 488 524 // Reader parameter dictionary 525 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") ); 489 526 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 490 527 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 528 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") ); 529 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") ); 530 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") ); 491 531 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 492 532 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 506 546 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 507 547 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 548 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") ); 508 549 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 550 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") ); 509 551 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 510 552 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 553 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") ); 511 554 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 512 555 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 526 569 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 527 570 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 571 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") ); 528 572 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 529 573 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 574 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") ); 530 575 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 531 576 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 577 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") ); 578 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") ); 532 579 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 533 580 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 581 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") ); 534 582 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 535 583 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); … … 557 605 558 606 // Reader parameter dictionary 607 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") ); 559 608 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 560 609 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 610 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") ); 611 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") ); 612 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") ); 561 613 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 562 614 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 576 628 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 577 629 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 630 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") ); 578 631 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 632 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") ); 579 633 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 580 634 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 635 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") ); 581 636 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 582 637 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 596 651 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 597 652 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 653 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") ); 598 654 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 599 655 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 656 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") ); 600 657 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 601 658 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 659 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") ); 660 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") ); 602 661 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 603 662 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 663 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") ); 604 664 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 605 665 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); -
sansmodels/src/sans/models/c_models/corefourshell.cpp
rc724ccd r339ce67 33 33 CoreFourShellModel :: CoreFourShellModel() { 34 34 scale = Parameter(1.0); 35 rad_core = Parameter(60.0, true);36 rad_core .set_min(0.0);37 sld_core = Parameter(6.4e-6);35 rad_core0 = Parameter(60.0, true); 36 rad_core0.set_min(0.0); 37 sld_core0 = Parameter(6.4e-6); 38 38 thick_shell1 = Parameter(10.0, true); 39 39 thick_shell1.set_min(0.0); … … 64 64 // Add the background after averaging 65 65 dp[0] = scale(); 66 dp[1] = rad_core ();67 dp[2] = sld_core ();66 dp[1] = rad_core0(); 67 dp[2] = sld_core0(); 68 68 dp[3] = thick_shell1(); 69 69 dp[4] = sld_shell1(); … … 79 79 // Get the dispersion points for the radius 80 80 vector<WeightPoint> weights_rad; 81 rad_core .get_weights(weights_rad);81 rad_core0.get_weights(weights_rad); 82 82 83 83 // Get the dispersion points for the thick 1 … … 167 167 168 168 dp.scale = scale(); 169 dp.rad_core = rad_core();170 dp.sld_core = sld_core();169 dp.rad_core0 = rad_core0(); 170 dp.sld_core0 = sld_core0(); 171 171 dp.thick_shell1 = thick_shell1(); 172 172 dp.sld_shell1 = sld_shell1(); … … 182 182 // Get the dispersion points for the radius 183 183 vector<WeightPoint> weights_rad; 184 rad_core .get_weights(weights_rad);184 rad_core0.get_weights(weights_rad); 185 185 186 186 // Get the dispersion points for the thick 1 … … 207 207 // Loop over radius weight points 208 208 for(int i=0; i<weights_rad.size(); i++) { 209 dp.rad_core = weights_rad[i].value;209 dp.rad_core0 = weights_rad[i].value; 210 210 // Loop over radius weight points 211 211 for(int j=0; j<weights_s1.size(); j++) { … … 222 222 //Un-normalize FourShell by volume 223 223 sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight 224 * (dp.rad_core +dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4);224 * (dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4); 225 225 norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight; 226 226 } … … 234 234 else{ 235 235 //return normal value 236 rad_out = dp.rad_core +dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4;}236 rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4;} 237 237 238 238 return rad_out; -
sansmodels/src/sans/models/c_models/models.hh
rd5b6a9d r339ce67 49 49 }; 50 50 51 class BarBellModel{ 52 public: 53 // Model parameters 54 Parameter scale; 55 Parameter rad_bar; 56 Parameter len_bar; 57 Parameter rad_bell; 58 Parameter sld_barbell; 59 Parameter sld_solv; 60 Parameter background; 61 Parameter theta; 62 Parameter phi; 63 64 // Constructor 65 BarBellModel(); 66 67 // Operators to get I(Q) 68 double operator()(double q); 69 double operator()(double qx, double qy); 70 double calculate_ER(); 71 double evaluate_rphi(double q, double phi); 72 }; 73 74 class CappedCylinderModel{ 75 public: 76 // Model parameters 77 Parameter scale; 78 Parameter rad_cyl; 79 Parameter len_cyl; 80 Parameter rad_cap; 81 Parameter sld_capcyl; 82 Parameter sld_solv; 83 Parameter background; 84 Parameter theta; 85 Parameter phi; 86 87 // Constructor 88 CappedCylinderModel(); 89 90 // Operators to get I(Q) 91 double operator()(double q); 92 double operator()(double qx, double qy); 93 double calculate_ER(); 94 double evaluate_rphi(double q, double phi); 95 }; 96 97 51 98 class ParallelepipedModel{ 52 99 public: … … 80 127 Parameter n_shells; 81 128 Parameter scale; 82 Parameter rad_core ;83 Parameter sld_core ;129 Parameter rad_core0; 130 Parameter sld_core0; 84 131 Parameter sld_solv; 85 132 Parameter background; … … 256 303 Parameter func_inter10; 257 304 305 Parameter sldIM_flat1; 306 Parameter sldIM_flat2; 307 Parameter sldIM_flat3; 308 Parameter sldIM_flat4; 309 Parameter sldIM_flat5; 310 Parameter sldIM_flat6; 311 Parameter sldIM_flat7; 312 Parameter sldIM_flat8; 313 Parameter sldIM_flat9; 314 Parameter sldIM_flat10; 315 316 Parameter sldIM_sub0; 317 Parameter sldIM_medium; 318 258 319 // Constructor 259 320 ReflModel(); … … 511 572 // Model parameters 512 573 Parameter scale; 513 Parameter rad_core ;514 Parameter sld_core ;574 Parameter rad_core0; 575 Parameter sld_core0; 515 576 Parameter thick_shell1; 516 577 Parameter sld_shell1; -
sansmodels/src/sans/models/c_models/onion.cpp
re096270 r339ce67 33 33 n_shells = Parameter(1.0); 34 34 scale = Parameter(1.0); 35 rad_core = Parameter(200.0);36 sld_core = Parameter(1e-06);35 rad_core0 = Parameter(200.0); 36 sld_core0 = Parameter(1e-06); 37 37 sld_solv = Parameter(6.4e-06); 38 38 background = Parameter(0.0); … … 112 112 dp[0] = n_shells(); 113 113 dp[1] = scale(); 114 dp[2] = rad_core ();115 dp[3] = sld_core ();114 dp[2] = rad_core0(); 115 dp[3] = sld_core0(); 116 116 dp[4] = sld_solv(); 117 117 dp[5] = 0.0; … … 175 175 // Get the dispersion points for the radius 176 176 vector<WeightPoint> weights_rad; 177 rad_core .get_weights(weights_rad);177 rad_core0.get_weights(weights_rad); 178 178 179 179 // Get the dispersion points for the thick 1 … … 313 313 double OnionModel :: calculate_ER() { 314 314 OnionParameters dp; 315 dp.rad_core = rad_core();315 dp.rad_core0 = rad_core0(); 316 316 dp.thick_shell1 = thick_shell1(); 317 317 dp.thick_shell2 = thick_shell2(); … … 333 333 // Get the dispersion points for the radius 334 334 vector<WeightPoint> weights_rad; 335 rad_core .get_weights(weights_rad);335 rad_core0.get_weights(weights_rad); 336 336 337 337 // Get the dispersion points for the thick 1 … … 376 376 // Loop over radius weight points 377 377 for(int i=0; i<weights_rad.size(); i++) { 378 dp.rad_core = weights_rad[i].value;378 dp.rad_core0 = weights_rad[i].value; 379 379 // Loop over radius weight points 380 380 for(int j=0; j<weights_s1.size(); j++) { … … 411 411 *weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight 412 412 *weights_s9[r].weight*weights_s10[s].weight 413 * (dp.rad_core +dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4+dp.thick_shell5413 * (dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4+dp.thick_shell5 414 414 +dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10); 415 415 norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight … … 433 433 else{ 434 434 //return normal value 435 rad_out = dp.rad_core +dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4435 rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4 436 436 +dp.thick_shell5+dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10;} 437 437 return rad_out; -
sansmodels/src/sans/models/c_models/refl.cpp
r35aface r339ce67 67 67 func_inter10 = Parameter(0); 68 68 69 sldIM_flat1 = Parameter(0); 70 sldIM_flat2 = Parameter(0); 71 sldIM_flat3 = Parameter(0); 72 sldIM_flat4 = Parameter(0); 73 sldIM_flat5 = Parameter(0); 74 sldIM_flat6 = Parameter(0); 75 sldIM_flat7 = Parameter(0); 76 sldIM_flat8 = Parameter(0); 77 sldIM_flat9 = Parameter(0); 78 sldIM_flat10 = Parameter(0); 79 80 sldIM_sub0 = Parameter(0); 81 sldIM_medium = Parameter(0); 69 82 } 70 83 … … 75 88 */ 76 89 double ReflModel :: operator()(double q) { 77 double dp[ 47];90 double dp[59]; 78 91 // Fill parameter array for IGOR library 79 92 // Add the background after averaging … … 130 143 dp[46] = func_inter10(); 131 144 145 dp[47] = sldIM_flat1(); 146 dp[48] = sldIM_flat2(); 147 dp[49] = sldIM_flat3(); 148 dp[50] = sldIM_flat4(); 149 dp[51] = sldIM_flat5(); 150 dp[52] = sldIM_flat6(); 151 dp[53] = sldIM_flat7(); 152 dp[54] = sldIM_flat8(); 153 dp[55] = sldIM_flat9(); 154 dp[56] = sldIM_flat10(); 155 156 dp[57] = sldIM_sub0(); 157 dp[58] = sldIM_medium(); 158 132 159 // Get the dispersion points for the radius 133 160 //vector<WeightPoint> weights_thick; -
sansmodels/src/sans/models/test/utest_extra_models.py
r35aface r339ce67 1 1 """ 2 Unit tests for extra models,PolymerexclVolume, RPA10Model 2 Unit tests for extra models,PolymerexclVolume, RPA10Model 3 The reference values are calculated on IGOR/NIST package(Oct.,2010) 4 @author: JHJ Cho / UTK 3 5 """ 4 6 import unittest 5 7 class TestPolymerExclVolume(unittest.TestCase): 6 8 """ 7 9 Unit tests for PolymerexclVolume (non-shape) function 8 10 """ 9 11 def setUp(self): … … 17 19 self.assertAlmostEqual(self.model.runXY(0.41959), 0.000261302, 6) 18 20 19 class Test PolymerExclVolume(unittest.TestCase):21 class TestRPA10Case(unittest.TestCase): 20 22 """ 21 23 Unit tests for RPA10Model (non-shape) function 22 24 """ 23 25 def setUp(self): … … 83 85 # case 9 84 86 self.assertAlmostEqual(self.model9.run(0.001), 0.00839376, 6) 85 self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6) 87 self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6) 88 89 class TestBarBell(unittest.TestCase): 90 """ 91 Unit tests for BarBell function 92 """ 93 def setUp(self): 94 from sans.models.BarBellModel import BarBellModel 95 self.model= BarBellModel() 86 96 97 def test1D(self): 98 # the values are from Igor pro calculation 99 self.assertAlmostEqual(self.model.run(0.001), 2864.7, 1) 100 self.assertAlmostEqual(self.model.run(0.215268), 0.526351, 4) 101 self.assertAlmostEqual(self.model.runXY(0.414467), 0.0685892, 6) 102 103 class TestCappedCylinder(unittest.TestCase): 104 """ 105 Unit tests for CappedCylinder function 106 """ 107 def setUp(self): 108 from sans.models.CappedCylinderModel import CappedCylinderModel 109 self.model= CappedCylinderModel() 110 111 def test1D(self): 112 # the values are from Igor pro calculation 113 # the different digits are due to precision of q values 114 self.assertAlmostEqual(self.model.run(0.001), 1424.72, 2) 115 self.assertAlmostEqual(self.model.run(0.215268), 0.360736, 4) 116 self.assertAlmostEqual(self.model.runXY(0.414467), 0.110283, 5) 117 118 class TestLamellarParaCrystal(unittest.TestCase): 119 """ 120 Unit tests for LamellarParaCystal function 121 """ 122 def setUp(self): 123 from sans.models.LamellarPCrystalModel import LamellarPCrystalModel 124 self.model= LamellarPCrystalModel() 125 126 def test1D(self): 127 self.model.setParam("pd_spacing", 0.2) 128 # the values are from Igor pro calculation 129 # the different digits are due to precision of q values 130 self.assertAlmostEqual(self.model.run(0.001), 21829.3, 1) 131 self.assertAlmostEqual(self.model.run(0.215268), 0.00487686, 6) 132 self.assertAlmostEqual(self.model.runXY(0.414467), 0.00062029, 6) 133 134 135 class TestSCParaCrystal(unittest.TestCase): 136 """ 137 Unit tests for Simple Cubic ParaCrystal Model function 138 """ 139 def setUp(self): 140 from sans.models.SCCrystalModel import SCCrystalModel 141 self.model= SCCrystalModel() 142 143 def test1D(self): 144 # the values are from Igor pro calculation 145 # the different digits are due to precision of q values 146 self.assertAlmostEqual(self.model.run(0.001), 10.3038, 4) 147 self.assertAlmostEqual(self.model.run(0.215268), 0.00714905, 6) 148 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000313289, 6) 149 150 class TestFCParaCrystal(unittest.TestCase): 151 """ 152 Unit tests for Face Centered Cubic ParaCrystal Model function 153 """ 154 def setUp(self): 155 from sans.models.FCCrystalModel import FCCrystalModel 156 self.model= FCCrystalModel() 157 158 def test1D(self): 159 self.model.setParam("d_factor", 0.05) 160 # the values are from Igor pro calculation 161 # the different digits are due to precision of q values 162 self.assertAlmostEqual(self.model.run(0.001), 0.121017, 6) 163 self.assertAlmostEqual(self.model.run(0.215268), 0.0107218, 6) 164 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000443282, 6) 165 166 class TestBCParaCrystal(unittest.TestCase): 167 """ 168 Unit tests for Body Centered Cubic ParaCrystal Model function 169 """ 170 def setUp(self): 171 from sans.models.BCCrystalModel import BCCrystalModel 172 self.model= BCCrystalModel() 173 174 def test1D(self): 175 # the values are from Igor pro calculation 176 # the different digits are due to precision of q values 177 self.assertAlmostEqual(self.model.run(0.001), 1.77267, 4) 178 self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6) 179 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6) 180 87 181 if __name__ == '__main__': 88 182 unittest.main() -
sansmodels/src/sans/models/test/utest_model_sphereexpshell.py
r1e7de38 r339ce67 42 42 # model3: set param values as same as the model2 43 43 self.model3.setParam("background", 0.0) 44 self.model3.setParam("rad_core ", 200.0)44 self.model3.setParam("rad_core0", 200.0) 45 45 self.model3.setParam("scale", 1.0) 46 self.model3.setParam("sld_core ", 1.0e-006)46 self.model3.setParam("sld_core0", 1.0e-006) 47 47 self.model3.setParam("sld_shell1", 1.7e-006) 48 48 self.model3.setParam("sld_solv", 6.4e-006) … … 72 72 # model: set param values as same as the model2 73 73 self.model.setParam("background", 0.0) 74 self.model.setParam("rad_core ", 100.0)74 self.model.setParam("rad_core0", 100.0) 75 75 self.model.setParam("scale", 1.0) 76 self.model.setParam("sld_core ", 6.36e-006)76 self.model.setParam("sld_core0", 6.36e-006) 77 77 self.model.setParam("sld_in_shell1", 5e-007) 78 78 self.model.setParam("sld_solv", 6.36e-006) … … 80 80 # model2: set param values as same as the model2 81 81 self.model2.setParam("background", 0.0) 82 self.model2.setParam("rad_core ", 100.0)82 self.model2.setParam("rad_core0", 100.0) 83 83 self.model2.setParam("scale", 1.0) 84 self.model2.setParam("sld_core ", 6.36e-006)84 self.model2.setParam("sld_core0", 6.36e-006) 85 85 self.model2.setParam("sld_in_shell1", 5e-007) 86 86 self.model2.setParam("sld_solv", 6.36e-006)
Note: See TracChangeset
for help on using the changeset viewer.