Changeset 25a608f5 in sasview
- Timestamp:
- Apr 14, 2009 4:24:14 PM (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:
- 9cb364a
- Parents:
- 7b78bb6
- Location:
- sansmodels/src/sans/models
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/BaseComponent.py
rc9636f7 r25a608f5 33 33 #list of parameter that can be fitted 34 34 self.fixed= [] 35 ## parameters with orientation 36 self.orientation_params =[] 35 37 36 38 def __str__(self): -
sansmodels/src/sans/models/CoreShellCylinderModel.py
r836fe6e r25a608f5 89 89 ## fittable parameters 90 90 self.fixed=['axis_phi.width', 'axis_theta.width', 'length.width', 'radius.width', 'thickness_width'] 91 92 ## parameters with orientation 93 self.orientation_params =['axis_phi', 'axis_theta', 'axis_phi.width', 'axis_theta.width'] 91 94 92 95 def clone(self): -
sansmodels/src/sans/models/CoreShellModel.py
r369e492e r25a608f5 17 17 18 18 WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY c:\ECLPS\workspace\trunk\sansmodels\src\sans\models\c_extensions\core_shell.h19 DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\core_shell.h 20 20 AND RE-RUN THE GENERATOR SCRIPT 21 21 … … 28 28 class CoreShellModel(CCoreShellModel, BaseComponent): 29 29 """ Class that evaluates a CoreShellModel model. 30 This file was auto-generated from c:\ECLPS\workspace\trunk\sansmodels\src\sans\models\c_extensions\core_shell.h.30 This file was auto-generated from ..\c_extensions\core_shell.h. 31 31 Refer to that file and the structure it contains 32 32 for details of the model. … … 75 75 ## fittable parameters 76 76 self.fixed=['thickness.width', 'radius.width'] 77 78 ## parameters with orientation 79 self.orientation_params =[] 77 80 78 81 def clone(self): -
sansmodels/src/sans/models/CylinderModel.py
r836fe6e r25a608f5 75 75 ## fittable parameters 76 76 self.fixed=['cyl_phi.width', 'cyl_theta.width', 'length.width', 'radius.width'] 77 78 ## parameters with orientation 79 self.orientation_params =['cyl_phi', 'cyl_theta', 'cyl_phi.width', 'cyl_theta.width'] 77 80 78 81 def clone(self): -
sansmodels/src/sans/models/EllipsoidModel.py
rda3dae3 r25a608f5 73 73 74 74 ## fittable parameters 75 self.fixed=['axis_phi.width', 'axis_theta.width', 'radius_a.width', 'radius_b.width', 'length.width', 'r_minor.width', 'r_ratio.width'] 75 self.fixed=['axis_phi.width', 'axis_theta.width', 'radius_a.width', 'radius_b.width', 'length.width', 'r_minor.width'] 76 77 ## parameters with orientation 78 self.orientation_params =['axis_phi.width', 'axis_theta.width', 'axis_phi', 'axis_theta'] 76 79 77 80 def clone(self): -
sansmodels/src/sans/models/EllipticalCylinderModel.py
rda3dae3 r25a608f5 69 69 70 70 ## fittable parameters 71 self.fixed=['cyl_phi.width', 'cyl_theta.width', 'cyl_psi.width', 'length.width', 'r_minor.width', 'r_ratio.width'] 71 self.fixed=['cyl_phi.width', 'cyl_theta.width', 'cyl_psi.width', 'length.width', 'r_minor.width', 'r_ratio.width </text>'] 72 73 ## parameters with orientation 74 self.orientation_params =['cyl_phi', 'cyl_theta', 'cyl_psi', 'cyl_phi.width', 'cyl_theta.width', 'cyl_psi.width'] 72 75 73 76 def clone(self): -
sansmodels/src/sans/models/SphereModel.py
r836fe6e r25a608f5 66 66 ## fittable parameters 67 67 self.fixed=['radius.width'] 68 69 ## parameters with orientation 70 self.orientation_params =[] 68 71 69 72 def clone(self): -
sansmodels/src/sans/models/c_extensions/Hardsphere.h
r25579e8 r25a608f5 21 21 // </text> 22 22 //[FIXED]= radius.width 23 24 23 25 typedef struct { 24 26 /// Radius of hardsphere [A] -
sansmodels/src/sans/models/c_extensions/SquareWell.h
r25579e8 r25a608f5 22 22 // </text> 23 23 // [FIXED]= radius.width 24 //[ORIENTATION_PARAMS]= <text> </text> 24 25 25 26 -
sansmodels/src/sans/models/c_extensions/core_shell.h
r25579e8 r25a608f5 19 19 // </text> 20 20 //[FIXED]= <text> thickness.width;radius.width</text> 21 22 21 23 typedef struct { 22 24 /// Scale factor -
sansmodels/src/sans/models/c_extensions/core_shell_cylinder.h
r836fe6e r25a608f5 27 27 // </text> 28 28 //[FIXED]= <text> axis_phi.width; axis_theta.width; length.width;radius.width; thickness_width</text> 29 //[ORIENTATION_PARAMS]= axis_phi; axis_theta;axis_phi.width; axis_theta.width 30 29 31 30 32 typedef struct { -
sansmodels/src/sans/models/c_extensions/cylinder.h
rda3dae3 r25a608f5 15 15 sin(alpha)*dalpha+ bkg 16 16 </text> 17 [FIXED]= <text> 18 cyl_phi.width; cyl_theta.width; length.width;radius.width 19 </text> 17 [FIXED]= <text>cyl_phi.width; cyl_theta.width; length.width;radius.width</text> 18 [ORIENTATION_PARAMS]= <text>cyl_phi; cyl_theta; cyl_phi.width; cyl_theta.width</text> 20 19 20 21 21 **/ 22 22 typedef struct { -
sansmodels/src/sans/models/c_extensions/ellipsoid.h
rda3dae3 r25a608f5 22 22 //radius_b.width; length.width; r_minor.width 23 23 //, r_ratio.width</text> 24 //[ORIENTATION_PARAMS]= axis_phi.width; axis_theta.width;axis_phi; axis_theta 25 26 24 27 typedef struct { 25 28 /// Scale factor -
sansmodels/src/sans/models/c_extensions/elliptical_cylinder.h
rda3dae3 r25a608f5 8 8 * [FIXED]= <text> cyl_phi.width; 9 9 * cyl_theta.width; cyl_psi.width; length.width; r_minor.width; r_ratio.width </text> 10 * [ORIENTATION_PARAMS]= cyl_phi; cyl_theta; cyl_psi; cyl_phi.width; cyl_theta.width; cyl_psi.width 10 11 * */ 12 13 11 14 typedef struct { 12 15 /// Scale factor -
sansmodels/src/sans/models/c_extensions/sphere.h
rda3dae3 r25a608f5 16 16 // </text> 17 17 //[FIXED]= radius.width 18 //[ORIENTATION_PARAMS]= <text> </text> 18 19 19 20 typedef struct { -
sansmodels/src/sans/models/c_models/WrapperGenerator.py
rda3dae3 r25a608f5 4 4 5 5 import os, sys,re 6 def split_list(separator, mylist, n=0): 7 """ 8 @return a list of string without white space of separator 9 @param separator: the string to remove 10 """ 11 list=[] 12 for item in mylist: 13 if re.search( separator,item)!=None: 14 if n >0: 15 word =re.split(separator,item,int(n)) 16 else: 17 word =re.split( separator,item) 18 for new_item in word: 19 if new_item.lstrip().rstrip() !='': 20 list.append(new_item.lstrip().rstrip()) 21 return list 22 def split_text(separator, string1, n=0): 23 """ 24 @return a list of string without white space of separator 25 @param separator: the string to remove 26 """ 27 list=[] 28 if re.search( separator,string1)!=None: 29 if n >0: 30 word =re.split(separator,string1,int(n)) 31 else: 32 word =re.split(separator,string1) 33 for item in word: 34 if item.lstrip().rstrip() !='': 35 list.append(item.lstrip().rstrip()) 36 return list 37 def look_for_tag( string1,begin, end=None ): 38 """ 39 @note: this method remove the begin and end tags given by the user 40 from the string . 41 @param begin: the initial tag 42 @param end: the final tag 43 @param string: the string to check 44 @return: begin_flag==True if begin was found, 45 end_flag==if end was found else return false, false 46 47 """ 48 begin_flag= False 49 end_flag= False 50 if re.search( begin,string1)!=None: 51 begin_flag= True 52 if end !=None: 53 if re.search(end,string1)!=None: 54 end_flag= True 55 return begin_flag, end_flag 6 import lineparser 56 7 57 8 class WrapperGenerator: … … 133 84 # paramaters for fittable 134 85 self.fixed= [] 86 ## parameters with orientation 87 self.orientation_params =[] 88 135 89 136 90 def __repr__(self): 137 91 """ Simple output for printing """ 138 92 139 rep = "Python class: %s\n" % self.pythonClass 140 rep += " struc name: %s\n" % self.structName 141 rep += " params: %s\n" % self.params 142 rep += " description: %s\n" % self.description 143 rep += " fittable paramaters list %s\n"% self.fixed 93 rep = "\n Python class: %s\n\n" % self.pythonClass 94 rep += " struc name: %s\n\n" % self.structName 95 rep += " params: %s\n\n" % self.params 96 rep += " description: %s\n\n" % self.description 97 rep += " Fittable parameters: %s\n\n"% self.fixed 98 rep += " Orientation parameters: %s\n\n"% self.orientation_params 144 99 return rep 145 100 … … 160 115 self.details = "## Parameter details [units, min, max]\n" 161 116 self.details += " self.details = {}\n" 162 # Catch Description 163 key = "[FIXED]" 117 164 118 #open item in this case Fixed 165 119 text='text' … … 168 122 text='TexT' 169 123 key3="</%s>"%text.lower() 170 temp="" 171 # flag to found key 172 find_fixed= False 173 find_key2=False 174 find_key3=False 175 176 for line in lines: 177 if line.count(key)>0 :#[FIXED]= ..... 178 try: 179 find_fixed= True 180 index = line.index(key) 181 toks = line[index:].split("=",1 ) 182 temp = toks[1].lstrip().rstrip() 183 find_key2, find_key3=look_for_tag( string1=temp,begin=key2, end=key3 ) 184 if find_key2 and find_key3: 185 #print"Found both:find_key2, find_key3", find_key2, find_key3 186 temp1=[] 187 temp2=[] 188 temp3=[] 189 temp4=[] 190 temp1=split_text(separator=key2, string1=temp) 191 temp2=split_list(separator=key3, mylist=temp1) 192 temp3=split_list(separator=';', mylist=temp2) 193 temp4=split_list(separator=',', mylist=temp3) 194 self.fixed= temp3 + temp4 195 break 196 197 elif find_key2 and not find_key3: 198 #print"Find find_key2 not find_key3", find_key2, find_key3 199 temp1=[] 200 temp2=[] 201 temp3=[] 202 temp4=[] 203 temp1=split_text(separator=key2, string1=temp) 204 temp3=split_list(separator=';', mylist=temp1) 205 temp4=split_list(separator=',', mylist=temp3) 206 #print "found only key2 , temp4", temp3,temp4 207 if len(temp3+ temp4)==0:# [FIXED]= only one param 208 self.fixed+= temp1 209 self.fixed+=temp3+temp4 # 210 elif not (find_key2 and find_key3) : 211 #print"Find nothing find_key2 not find_key3", find_key2, find_key3 212 temp3=[] 213 temp4=[] 214 if look_for_tag( string1=temp,begin=";")[0]:# split ";" first 215 temp3=split_text(separator=';',string1=temp) 216 temp4=split_list(separator=',', mylist=temp3) 217 else: 218 temp3=split_text(separator=',',string1=temp)# slip "," first 219 temp4=split_list(separator=';', mylist=temp3) 220 if len(temp3+ temp4)==0:# [FIXED]= only one param 221 self.fixed= [temp] 222 self.fixed+=temp3+temp4 # 223 break 224 except: 225 raise ValueError, "Could not parse file %s" % self.file 226 227 elif find_fixed: 228 #looking only for key3 229 if not find_key2: 230 raise ValueError, "Could not parse file %s" % self.file 231 find_key3=look_for_tag( string1=line,begin=key3)[0]# split "</text>" first 232 #print "find_key3",find_key3,line,key3 233 if find_key3: 234 temp1=[] 235 temp2=[] 236 temp3=[] 237 temp4=[] 238 temp5=[] 239 240 temp1=split_text(separator=key3, string1=line) 241 temp2=split_list(separator='//',mylist=temp1) 242 temp5=split_list(separator="\*",mylist=temp1) 243 244 if len(temp5)>0: 245 temp3=split_list(separator=';',mylist=temp5) 246 temp4=split_list(separator=',', mylist=temp5) 247 elif len(temp2)>0: 248 temp3=split_list(separator=';',mylist=temp2) 249 temp4=split_list(separator=',', mylist=temp2) 250 else: 251 temp3=split_list(separator=';',mylist=temp1) 252 temp4=split_list(separator=',', mylist=temp1) 253 254 if len(temp3+ temp4)==0:# [FIXED]= only one param 255 self.fixed+= temp1 256 self.fixed+=temp3+temp4 # 257 break 258 else: 259 temp2=split_text(separator='//',string1=line) 260 temp5=split_text(separator="\*",string1=line) 261 if len(temp5)>0: 262 temp3=split_list(separator=';',mylist=temp5) 263 temp4=split_list(separator=',', mylist=temp5) 264 elif len(temp2)>0: 265 temp3=split_list(separator=';',mylist=temp2) 266 temp4=split_list(separator=',', mylist=temp2) 267 else: 268 if look_for_tag( string1=line,begin=";")[0]:# split ";" first 269 temp3=split_text(separator=';',string1=line) 270 temp4=split_list(separator=',', mylist=temp3) 271 else: 272 temp3=split_text(separator=',',string1=line)# slip "," first 273 temp4=split_list(separator=';', mylist=temp3) 274 if len(temp3+ temp4)==0:# [FIXED]= only one param 275 self.fixed= [line.lstrip().rstrip()] 276 self.fixed+=temp3+temp4 # 277 278 279 280 # Catch Description 124 125 ## Catch fixed parameters 126 key = "[FIXED]" 127 try: 128 self.fixed= lineparser.readhelper(lines,key, key2,key3, file= self.file) 129 except: 130 raise 131 ## Catch parameters with orientation 132 key = "[ORIENTATION_PARAMS]" 133 try: 134 self.orientation_params = lineparser.readhelper( lines,key, 135 key2,key3, file= self.file) 136 except: 137 raise 138 ## Catch Description 281 139 key = "[DESCRIPTION]" 282 find_description= 0 140 141 find_description = False 283 142 temp="" 284 143 for line in lines: … … 286 145 287 146 try: 288 find_description= 1147 find_description= True 289 148 index = line.index(key) 290 149 toks = line[index:].split("=",1 ) … … 293 152 key2="<%s>"%text.lower() 294 153 if re.match(key2,temp)!=None: 295 #index2 = line.index(key2) 296 #temp = temp[index2:] 154 297 155 toks2=temp.split(key2,1) 298 156 self.description=toks2[1] … … 303 161 self.description=temp[0] 304 162 break 305 #print self.description163 306 164 else: 307 165 self.description=temp 308 166 break 309 167 except: 310 raise311 168 raise ValueError, "Could not parse file %s" % self.file 312 elif find_description ==1:169 elif find_description: 313 170 text='text' 314 171 key2="</%s>"%text.lower() 315 #print "second line",line,key2,re.search(key2,line)316 172 if re.search(key2,line)!=None: 317 173 tok=line.split(key2,1) … … 320 176 break 321 177 else: 322 #if re.search("*",line)!=None:323 # temp=line.split("*",1)324 # self.description+='\n'+temp[1].lstrip().rstrip()325 178 if re.search("//",line)!=None: 326 179 temp=line.split("//",1) … … 567 420 newline = self.replaceToken(newline, 568 421 "[FIXED]",str(self.fixed)) 422 ## parameters with orientation 423 424 newline = self.replaceToken(newline, 425 "[ORIENTATION_PARAMS]",str(self.orientation_params)) 569 426 570 427 # Write new line to the wrapper .c file -
sansmodels/src/sans/models/c_models/modelTemplate.txt
r836fe6e r25a608f5 49 49 ## fittable parameters 50 50 self.fixed=[FIXED] 51 52 ## parameters with orientation 53 self.orientation_params =[ORIENTATION_PARAMS] 51 54 52 55 def clone(self):
Note: See TracChangeset
for help on using the changeset viewer.