Changeset 96672c0 in sasview
- 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
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/BEPolyelectrolyte.py
r5f89fb8 r96672c0 37 37 ## Name of the model 38 38 self.name = "BEPolyelectrolyte" 39 self.description='' 39 self.description=""" 40 F(x) = K*1/(4*pi*Lb*(alpha)^(2))*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\ 41 *(q^(2)-(12*h*C/b^(2))) 42 The model has Eight parameters: 43 K = Constrast factor of the polymer 44 Lb = Bjerrum length 45 H = virial parameter 46 B = monomer length 47 Cs = Concentration of monovalent salt 48 alpha = ionazation degree 49 C = polymer molar concentration 50 bkd = background 51 """ 40 52 ## Define parameters 41 53 self.params = {} -
sansmodels/src/sans/models/Constant.py
r5f89fb8 r96672c0 20 20 ## Name of the model 21 21 self.name = "Constant" 22 self.description=' '22 self.description='F(c)= c where c is a constant' 23 23 ## Parameter details [units, min, max] 24 24 self.details = {} -
sansmodels/src/sans/models/CoreShellCylinderModel.py
r5f89fb8 r96672c0 1 1 #!/usr/bin/env python 2 """3 This software was developed by the University of Tennessee as part of the4 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)5 project funded by the US National Science Foundation.6 7 If you use DANSE applications to do scientific research that leads to8 publication, we ask that you acknowledge the use of the software with the9 following sentence:10 11 "This work benefited from DANSE software developed under NSF award DMR-0520547."12 13 copyright 2008, University of Tennessee14 """15 16 2 """ Provide functionality for a C extension model 17 3 18 4 WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY ../c_extensions/core_shell_cylinder.h5 DO NOT MODIFY THIS FILE, MODIFY core_shell_cylinder.h 20 6 AND RE-RUN THE GENERATOR SCRIPT 21 7 8 @author: Mathieu Doucet / UTK 9 @contact: mathieu.doucet@nist.gov 22 10 """ 23 11 … … 28 16 class CoreShellCylinderModel(CCoreShellCylinderModel, BaseComponent): 29 17 """ Class that evaluates a CoreShellCylinderModel model. 30 This file was auto-generated from ../c_extensions/core_shell_cylinder.h.18 This file was auto-generated from core_shell_cylinder.h. 31 19 Refer to that file and the structure it contains 32 20 for details of the model. … … 54 42 ## Name of the model 55 43 self.name = "CoreShellCylinderModel" 56 self.description='' 44 57 45 ## Parameter details [units, min, max] 58 46 self.details = {} … … 90 78 91 79 return CCoreShellCylinderModel.runXY(self, x) 92 93 def set_dispersion(self, parameter, dispersion):94 """95 Set the dispersion object for a model parameter96 @param parameter: name of the parameter [string]97 @dispersion: dispersion object of type DispersionModel98 """99 return CCoreShellCylinderModel.set_dispersion(self, parameter, dispersion.cdisp)100 101 80 102 81 # End of file -
sansmodels/src/sans/models/CoreShellModel.py
r5f89fb8 r96672c0 1 1 #!/usr/bin/env python 2 """3 This software was developed by the University of Tennessee as part of the4 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)5 project funded by the US National Science Foundation.6 7 If you use DANSE applications to do scientific research that leads to8 publication, we ask that you acknowledge the use of the software with the9 following sentence:10 11 "This work benefited from DANSE software developed under NSF award DMR-0520547."12 13 copyright 2008, University of Tennessee14 """15 16 2 """ Provide functionality for a C extension model 17 3 18 4 WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY ../c_extensions/core_shell.h5 DO NOT MODIFY THIS FILE, MODIFY core_shell.h 20 6 AND RE-RUN THE GENERATOR SCRIPT 21 7 8 @author: Mathieu Doucet / UTK 9 @contact: mathieu.doucet@nist.gov 22 10 """ 23 11 … … 28 16 class CoreShellModel(CCoreShellModel, BaseComponent): 29 17 """ Class that evaluates a CoreShellModel model. 30 This file was auto-generated from ../c_extensions/core_shell.h.18 This file was auto-generated from core_shell.h. 31 19 Refer to that file and the structure it contains 32 20 for details of the model. … … 51 39 ## Name of the model 52 40 self.name = "CoreShellModel" 53 self.description='' 41 54 42 ## Parameter details [units, min, max] 55 43 self.details = {} … … 65 53 def clone(self): 66 54 """ Return a identical copy of self """ 67 return self._clone(CoreShellModel()) 55 obj = CoreShellModel() 56 obj.params = copy.deepcopy(self.params) 57 return obj 68 58 69 59 def run(self, x = 0.0): … … 82 72 83 73 return CCoreShellModel.runXY(self, x) 84 85 def set_dispersion(self, parameter, dispersion):86 """87 Set the dispersion object for a model parameter88 @param parameter: name of the parameter [string]89 @dispersion: dispersion object of type DispersionModel90 """91 return CCoreShellModel.set_dispersion(self, parameter, dispersion.cdisp)92 93 74 94 75 # End of file -
sansmodels/src/sans/models/Cos.py
r5f89fb8 r96672c0 18 18 ## Name of the model 19 19 self.name = "Cos" 20 self.description=' '20 self.description='F(x)=cos(x)' 21 21 ## Parameter details [units, min, max] 22 22 self.details = {} -
sansmodels/src/sans/models/CylinderModel.py
r5f89fb8 r96672c0 1 1 #!/usr/bin/env python 2 """3 This software was developed by the University of Tennessee as part of the4 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)5 project funded by the US National Science Foundation.6 7 If you use DANSE applications to do scientific research that leads to8 publication, we ask that you acknowledge the use of the software with the9 following sentence:10 11 "This work benefited from DANSE software developed under NSF award DMR-0520547."12 13 copyright 2008, University of Tennessee14 """15 16 2 """ Provide functionality for a C extension model 17 3 18 4 WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY ../c_extensions/cylinder.h5 DO NOT MODIFY THIS FILE, MODIFY cylinder.h 20 6 AND RE-RUN THE GENERATOR SCRIPT 21 7 8 @author: Mathieu Doucet / UTK 9 @contact: mathieu.doucet@nist.gov 22 10 """ 23 11 … … 28 16 class CylinderModel(CCylinderModel, BaseComponent): 29 17 """ Class that evaluates a CylinderModel model. 30 This file was auto-generated from ../c_extensions/cylinder.h.18 This file was auto-generated from cylinder.h. 31 19 Refer to that file and the structure it contains 32 20 for details of the model. … … 51 39 ## Name of the model 52 40 self.name = "CylinderModel" 53 self.description='' 41 54 42 ## Parameter details [units, min, max] 55 43 self.details = {} … … 65 53 def clone(self): 66 54 """ Return a identical copy of self """ 67 return self._clone(CylinderModel()) 55 obj = CylinderModel() 56 obj.params = copy.deepcopy(self.params) 57 return obj 68 58 69 59 def run(self, x = 0.0): … … 82 72 83 73 return CCylinderModel.runXY(self, x) 84 85 def set_dispersion(self, parameter, dispersion):86 """87 Set the dispersion object for a model parameter88 @param parameter: name of the parameter [string]89 @dispersion: dispersion object of type DispersionModel90 """91 return CCylinderModel.set_dispersion(self, parameter, dispersion.cdisp)92 93 74 94 75 # End of file -
sansmodels/src/sans/models/DebyeModel.py
r5f89fb8 r96672c0 32 32 ## Name of the model 33 33 self.name = "Debye" 34 self.description='' 34 self.description=""" 35 F(x) = 2( exp(-x) + x - 1 )/x**2 36 with x = (q*R_g)**2 37 The model has three parameters: 38 Rg = radius of gyration 39 scale = scale factor 40 bkd = Constant background 41 """ 35 42 ## Define parameters 36 43 self.params = {} -
sansmodels/src/sans/models/EllipsoidModel.py
r5f89fb8 r96672c0 51 51 ## Name of the model 52 52 self.name = "EllipsoidModel" 53 self.description=''53 54 54 ## Parameter details [units, min, max] 55 55 self.details = {} -
sansmodels/src/sans/models/FractalModel.py
r5f89fb8 r96672c0 35 35 ## Name of the model 36 36 self.name = "Number Density Fractal" 37 self.description='' 37 self.description=""" 38 I(x)= P(x)*S(x) + bkd 39 p(x)= scale* V^(2)*delta^(2)* F(x*Radius)^(2) 40 F(x) = 3*[sin(x)-xcos(x)]/x**3 41 The model has Seven parameters: 42 scale = Volume fraction 43 radius = Block radius 44 fractal_dim = Fractal dimension 45 corr_length = correlation Length 46 block_sld = SDL block 47 solvent_sld = SDL solvent 48 background = background 49 """ 38 50 ## Define parameters 39 51 self.params = {} -
sansmodels/src/sans/models/Gaussian.py
r5f89fb8 r96672c0 35 35 ## Name of the model 36 36 self.name = "Gaussian" 37 self.description='' 37 38 38 ## Parameter details [units, min, max] 39 39 self.details = {} -
sansmodels/src/sans/models/SphereModel.py
r5f89fb8 r96672c0 1 1 #!/usr/bin/env python 2 """3 This software was developed by the University of Tennessee as part of the4 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)5 project funded by the US National Science Foundation.6 7 If you use DANSE applications to do scientific research that leads to8 publication, we ask that you acknowledge the use of the software with the9 following sentence:10 11 "This work benefited from DANSE software developed under NSF award DMR-0520547."12 13 copyright 2008, University of Tennessee14 """15 16 2 """ Provide functionality for a C extension model 17 3 18 4 WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY ../c_extensions/sphere.h5 DO NOT MODIFY THIS FILE, MODIFY sphere.h 20 6 AND RE-RUN THE GENERATOR SCRIPT 21 7 8 @author: Mathieu Doucet / UTK 9 @contact: mathieu.doucet@nist.gov 22 10 """ 23 11 … … 28 16 class SphereModel(CSphereModel, BaseComponent): 29 17 """ Class that evaluates a SphereModel model. 30 This file was auto-generated from ../c_extensions/sphere.h.18 This file was auto-generated from sphere.h. 31 19 Refer to that file and the structure it contains 32 20 for details of the model. … … 48 36 ## Name of the model 49 37 self.name = "SphereModel" 50 self.description='' 38 51 39 ## Parameter details [units, min, max] 52 40 self.details = {} … … 59 47 def clone(self): 60 48 """ Return a identical copy of self """ 61 return self._clone(SphereModel()) 49 obj = SphereModel() 50 obj.params = copy.deepcopy(self.params) 51 return obj 62 52 63 53 def run(self, x = 0.0): … … 76 66 77 67 return CSphereModel.runXY(self, x) 78 79 def set_dispersion(self, parameter, dispersion):80 """81 Set the dispersion object for a model parameter82 @param parameter: name of the parameter [string]83 @dispersion: dispersion object of type DispersionModel84 """85 return CSphereModel.set_dispersion(self, parameter, dispersion.cdisp)86 87 68 88 69 # End of file -
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 -
sansmodels/src/sans/models/c_models/WrapperGenerator.py
r4e2f6ef8 r96672c0 88 88 rep += " struc name: %s\n" % self.structName 89 89 rep += " params: %s\n" % self.params 90 rep += " description: %s\n" % self.description 90 91 return rep 91 92 … … 106 107 self.details = "## Parameter details [units, min, max]\n" 107 108 self.details += " self.details = {}\n" 109 # Catch Description 110 key = "[DESCRIPTION]" 111 find_description= False 112 temp="" 113 for line in lines: 114 if line.count(key)>0 : 115 find_description= True 116 try: 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=line[index:] 125 else: 126 self.description=temp 127 except: 128 raise ValueError, "Could not parse file %s" % self.file 129 if find_description: 130 text='text' 131 key2="</%s>"%text.lower 132 if re.match(key2,temp)!=None: 133 index2 = line.index(key2) 134 temp=line[:index] 135 temp+=line 136 self.description= temp 137 108 138 for line in lines: 109 139 … … 136 166 toks2 = toks[0].split(',') 137 167 self.structName = toks2[0].lstrip().rstrip() 138 168 169 170 139 171 # Catch struct content 140 172 key = "[DEFAULT]"
Note: See TracChangeset
for help on using the changeset viewer.