Changeset 96672c0 in sasview for sansmodels/src/sans/models/c_extensions
- Timestamp:
- Oct 27, 2008 11:43:52 AM (16 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:
- 4d3acb6
- Parents:
- 922b0d1
- Location:
- sansmodels/src/sans/models/c_extensions
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/WrapperGenerator.py
rae3ce4e r96672c0 4 4 5 5 import os, sys 6 import re 6 7 7 8 class WrapperGenerator: … … 75 76 ## List of default parameters (text) 76 77 self.default_list = "" 78 ##description 79 self.description='' 77 80 ## Dictionary of units 78 81 self.details = "" … … 84 87 rep += " struc name: %s\n" % self.structName 85 88 rep += " params: %s\n" % self.params 89 rep += " description: %s\n"% self.description 86 90 return rep 87 91 … … 96 100 f = open(self.file,'r') 97 101 buf = f.read() 98 102 99 103 self.default_list = "List of default parameters:\n" 100 104 #lines = string.split(buf,'\n') … … 102 106 self.details = "## Parameter details [units, min, max]\n" 103 107 self.details += " self.details = {}\n" 108 # Catch Description 109 key = "[DESCRIPTION]" 110 find_description= 0 111 temp="" 112 for line in lines: 113 if line.count(key)>0 : 114 115 try: 116 find_description= 1 117 index = line.index(key) 118 toks = line[index:].split("=",1 ) 119 temp=toks[1].lstrip().rstrip() 120 text='text' 121 key2="<%s>"%text.lower() 122 if re.match(key2,temp)!=None: 123 #index2 = line.index(key2) 124 #temp = temp[index2:] 125 toks2=temp.split(key2,1) 126 self.description=toks2[1] 127 text='text' 128 key2="</%s>"%text.lower() 129 if re.search(key2,toks2[1])!=None: 130 temp=toks2[1].split(key2,1) 131 self.description=temp[0] 132 break 133 print self.description 134 else: 135 self.description=temp 136 break 137 except: 138 raise ValueError, "Could not parse file %s" % self.file 139 elif find_description==1: 140 text='text' 141 key2="</%s>"%text.lower() 142 #print "second line",line,key2,re.search(key2,line) 143 if re.search(key2,line)!=None: 144 tok=line.split(key2,1) 145 temp=tok[0].split("//",1) 146 self.description+=tok[1].lstrip().rstrip() 147 break 148 else: 149 print re.search("//",line) 150 if re.search("//",line)!=None: 151 temp=line.split("//",1) 152 self.description+='\n'+temp[1].lstrip().rstrip() 153 154 else: 155 self.description+=line 156 157 104 158 for line in lines: 105 159 … … 132 186 toks2 = toks[0].split(',') 133 187 self.structName = toks2[0].lstrip().rstrip() 134 188 135 189 # Catch struct content 136 190 key = "[DEFAULT]" … … 274 328 newline = self.replaceToken(newline, 275 329 "[DEFAULT_LIST]", self.default_list) 276 330 # Model Description 331 newline = self.replaceToken(newline, 332 "[DESCRIPTION]", self.description) 277 333 # Parameter details 278 334 newline = self.replaceToken(newline, -
sansmodels/src/sans/models/c_extensions/core_shell.h
r0f5bc9f r96672c0 7 7 //[PYTHONCLASS] = CoreShellModel 8 8 //[DISP_PARAMS] = radius, thickness 9 //[DESCRIPTION] ="" 9 10 typedef struct { 10 11 /// Scale factor -
sansmodels/src/sans/models/c_extensions/core_shell_cylinder.h
r4e2f6ef8 r96672c0 7 7 //[PYTHONCLASS] = CoreShellCylinderModel 8 8 //[DISP_PARAMS] = radius, thickness, length, axis_theta, axis_phi 9 //[DESCRIPTION] = '' 9 //[DESCRIPTION] = <text>"P(q,alpha)= scale/Vs*f(q)^(2) + bkg Where:\n\ 10 f(q)= 2(core_sld- solvant_sld)* Vc*sin[qLcos(alpha/2)]/\n\ 11 [qLcos(alpha/2)]*J1(qRsin(alpha))/[qRsin(alpha)] +\n 2(shell_sld-solvent_sld)*Vs\n\ 12 *sin[q(L+T)cos(alpha/2)]/[[q(L+T)cos(alpha/2)]\n\ 13 *J1(q(R+T)sin(alpha))/q(R+T)sin(alpha)]\n\ 14 alpha:is the angle between the axis of the cylinder and the q-vector\n\ 15 Vs: the volume of the outer shell\n\ 16 Vc: the volume of the core\n\ 17 L: the length of the core\n\ 18 shell_sld: the scattering length density of the shell\n\ 19 solvent_sld: the scattering length density of the solvent\n\ 20 bkg: the background\n\ 21 T: the thickness\n\ 22 R+T: is the outer radius\n\ 23 L+2T: The total length of the outershell\n\ 24 J1: the first order Bessel function\n\ 25 theta: axis_theta of the cylinder\n\ 26 phi: the axis_phi of the cylinder"\ 27 </text> 28 10 29 typedef struct { 11 30 /// Scale factor -
sansmodels/src/sans/models/c_extensions/cylinder.h
r4e2f6ef8 r96672c0 5 5 * [PYTHONCLASS] = CylinderModel 6 6 * [DISP_PARAMS] = radius, length, cyl_theta, cyl_phi 7 [DESCRIPTION] = '' 7 [DESCRIPTION] = <text>"P(q,alpha)= scale/V*f(q)^(2)+bkg\n\ 8 f(q)= 2*(scatter_sld - solvent_sld)*V*sin(qLcos(alpha/2))/[qLcos(alpha/2)]*\n\ 9 J1(qRsin(alpha/2))/[qRsin(alpha)]\n\ 10 V: Volume of the cylinder\n\ 11 R: Radius of the cylinder\n\ 12 L: Length of the cylinder\n\ 13 J1: The bessel function\n\ 14 alpha: angle betweenthe axis of the cylinder and the q-vector\n\ 15 for 1D:the ouput is P(q)=scale/V*integral from pi/2 to zero of f(q)^(2)*\n\ 16 sin(alpha)*dalpha+ bkg" 17 </text> 8 18 9 19 * */ -
sansmodels/src/sans/models/c_extensions/ellipsoid.h
r0f5bc9f r96672c0 9 9 //[PYTHONCLASS] = EllipsoidModel 10 10 //[DISP_PARAMS] = radius_a, radius_b, axis_theta, axis_phi 11 //[DESCRIPTION] = <text>"P(q.alpha)= scale*f(q)^(2)+ bkg\n\ 12 f(q)= 3*(scatter_sld- scatter_solvent)*V*[sin(q*r(Ra,Rb,alpha)) - q*r*cos(qr(Ra,Rb,alpha))]\n\ 13 /[qr(Ra,Rb,alpha)]^(3)"\ 14 r(Ra,Rb,alpha)= [Rb^(2)*(sin(alpha))^(2) + Ra^(2)*(cos(alpha))^(2)]^(1/2)\ 15 scatter_sld: scattering length density of the scatter\n\ 16 solvent_sld: scattering length density of the solvent\n\ 17 V: volune of the Eliipsoid\n\ 18 Ra: radius along the rotation axis of the Ellipsoid\n\ 19 Rb: radius perpendicular to the rotation axis of the ellipsoid\n\ 20 </text> 11 21 typedef struct { 12 22 /// Scale factor -
sansmodels/src/sans/models/c_extensions/elliptical_cylinder.h
r0f5bc9f r96672c0 5 5 * [PYTHONCLASS] = EllipticalCylinderModel 6 6 * [DISP_PARAMS] = r_minor, r_ratio, length, cyl_theta, cyl_phi, cyl_psi 7 * 7 * [DESCRIPTION] = "" 8 8 * */ 9 9 typedef struct { -
sansmodels/src/sans/models/c_extensions/gaussian.h
rae3ce4e r96672c0 8 8 * 9 9 * [PYTHONCLASS] = Gaussian 10 * [DESCRIPTION] = <text>f(x)=scale * 1/(sigma^2*2pi)e^(-(x-mu)^2/2sigma^2)</text> 10 11 */ 11 12 typedef struct { -
sansmodels/src/sans/models/c_extensions/lorentzian.h
rae3ce4e r96672c0 8 8 * 9 9 * [PYTHONCLASS] = Lorentzian 10 * [DESCRIPTION] = <text>f(x)=scale * 1/pi 0.5gamma / [ (x-x_0)^2 + (0.5gamma)^2 ]</text> 10 11 */ 11 12 typedef struct { -
sansmodels/src/sans/models/c_extensions/sphere.h
r0f5bc9f r96672c0 7 7 //[PYTHONCLASS] = SphereModel 8 8 //[DISP_PARAMS] = radius 9 //[DESCRIPTION] =<text>P(q)=(scale/V)*[3V(scatter_sld-solvent_sld)*(sin(qR)-qRcos(qR))/(qR)^3]^(2) 10 // +bkg 11 // bkg: background level 12 // R: radius of the sphere 13 // V:The volume of the scatter 14 // scatter_sld: the scattering length density of the scatter 15 // solvent_sld: the scattering length density of the solvent 16 // </text> 17 9 18 typedef struct { 10 19 /// Scale factor
Note: See TracChangeset
for help on using the changeset viewer.