Changeset 79ba1fc in sasview for sansmodels/src
- Timestamp:
- Apr 18, 2012 10:52:17 AM (13 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:
- 3bd7cec
- Parents:
- d47c349
- Location:
- sansmodels/src/python_wrapper
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/python_wrapper/WrapperGenerator.py
r1b758b3 r79ba1fc 134 134 key = "[FIXED]" 135 135 try: 136 self.fixed= lineparser.readhelper(lines,key, key2,key3, file= self.file) 136 self.fixed= lineparser.readhelper(lines, key, 137 key2, key3, file=self.file) 137 138 except: 138 139 raise … … 140 141 key = "[NON_FITTABLE_PARAMS]" 141 142 try: 142 self.non_fittable= lineparser.readhelper(lines,key, key2,key3, file= self.file) 143 self.non_fittable= lineparser.readhelper(lines, key, key2, 144 key3, file=self.file) 143 145 except: 144 146 raise … … 147 149 key = "[ORIENTATION_PARAMS]" 148 150 try: 149 self.orientation_params = lineparser.readhelper( lines,key,150 key2, key3, file=self.file)151 self.orientation_params = lineparser.readhelper(lines, key, 152 key2, key3, file=self.file) 151 153 except: 152 154 raise … … 452 454 453 455 # fixed list details 454 newline = self.replaceToken(newline, 455 "[FIXED]",str(self.fixed)) 456 # non-fittable list details 457 newline = self.replaceToken(newline, 458 "[NON_FITTABLE_PARAMS]",str(self.non_fittable)) 456 fixed_str = str(self.fixed) 457 fixed_str.replace(', ', '\n ') 458 newline = self.replaceToken(newline, "[FIXED]",fixed_str) 459 460 # non-fittable list details 461 newline = self.replaceToken(newline, 462 "[NON_FITTABLE_PARAMS]", 463 str(self.non_fittable)) 464 459 465 ## parameters with orientation 460 461 newline = self.replaceToken(newline, 462 "[ORIENTATION_PARAMS]",str(self.orientation_params)) 466 oriented_str = str(self.orientation_params) 467 oriented_str.replace(', ', '\n ') 468 newline = self.replaceToken(newline, 469 "[ORIENTATION_PARAMS]", oriented_str) 463 470 464 471 # Write new line to the wrapper .c file -
sansmodels/src/python_wrapper/lineparser.py
r101065a r79ba1fc 57 57 58 58 59 def readhelper(lines, key, key2,key3 , file):59 def readhelper(lines, key, key2, key3 , file): 60 60 61 61 temp="" … … 68 68 if line.count(key.lstrip().rstrip())>0 :#[FIXED]= ..... 69 69 try: 70 #print "found key", key71 70 find_fixed= True 72 71 index = line.index(key) 73 72 toks = line[index:].split("=",1 ) 74 73 temp = toks[1].lstrip().rstrip() 75 find_key2, find_key3=look_for_tag( string1=temp,begin=key2, end=key3 ) 76 #print "looking for endpoints",find_key2, find_key3 77 ##[key]=<text>param </text> 74 find_key2, find_key3=look_for_tag( string1=temp, 75 begin=key2, end=key3 ) 78 76 if find_key2 and find_key3: 79 80 77 temp1=[] 81 78 temp2=[] … … 87 84 temp4=split_list(separator=',', mylist=temp3) 88 85 listtofill= temp3 + temp4 89 #print "endpoints found",listtofill90 86 return listtofill 91 87 … … 106 102 temp4=split_list(separator=',', mylist=temp3) 107 103 108 if len(temp3 + temp4)==0:104 if len(temp3 + temp4)==0: 109 105 # [FIXED]= only one param 110 106 listtofill+= temp1 … … 136 132 if not find_key2: 137 133 raise ValueError, "Could not parse file %s" % file 138 #print "find_key3",find_key3,line,key3139 134 if find_key3: 140 #print "At the ned of the file----->"141 135 temp1=[] 142 136 temp2=[] … … 159 153 temp4=split_list(separator=',', mylist=temp1) 160 154 161 if len(temp3 + temp4)==0:# [FIXED]= only one param162 listtofill += temp1155 if len(temp3 + temp4)==0:# [FIXED]= only one param 156 listtofill += temp1 163 157 listtofill+=temp3+temp4 # 164 158 break 165 159 166 160 else: 167 temp2=split_text(separator='//', string1=line)168 temp5=split_text(separator="\*", string1=line)161 temp2=split_text(separator='//', string1=line) 162 temp5=split_text(separator="\*", string1=line) 169 163 if len(temp5)>0: 170 temp3=split_list(separator=';', mylist=temp5)164 temp3=split_list(separator=';', mylist=temp5) 171 165 temp4=split_list(separator=',', mylist=temp5) 172 166 elif len(temp2)>0: 173 temp3=split_list(separator=';', mylist=temp2)167 temp3=split_list(separator=';', mylist=temp2) 174 168 temp4=split_list(separator=',', mylist=temp2) 175 169 else: 176 170 if look_for_tag( string1=line,begin=";")[0]:# split ";" first 177 temp3=split_text(separator=';', string1=line)171 temp3=split_text(separator=';', string1=line) 178 172 temp4=split_list(separator=',', mylist=temp3) 179 173 else: 180 temp3=split_text(separator=',', string1=line)# slip "," first174 temp3=split_text(separator=',', string1=line)# slip "," first 181 175 temp4=split_list(separator=';', mylist=temp3) 182 176 if len(temp3+ temp4)==0:# [FIXED]= only one param 183 177 if line.lstrip().rstrip()!="": 184 listtofill= 178 listtofill=[line.lstrip().rstrip()] 185 179 listtofill+=temp3+temp4 # 186 180 break -
sansmodels/src/python_wrapper/modelTemplate.txt
rd47c349 r79ba1fc 17 17 18 18 :WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE] 19 DO NOT MODIFY THIS FILE, MODIFY 20 [INCLUDE_FILE] 20 21 AND RE-RUN THE GENERATOR SCRIPT 21 22 """ … … 29 30 """ 30 31 obj = [PYTHONCLASS]() 31 #[CPYTHONCLASS].__init__(obj) is called by [PYTHONCLASS] constructor 32 # [CPYTHONCLASS].__init__(obj) is called by 33 # the [PYTHONCLASS] constructor 32 34 return obj 33 35 … … 145 147 146 148 """ 147 return [CPYTHONCLASS].set_dispersion(self, parameter, dispersion.cdisp) 149 return [CPYTHONCLASS].set_dispersion(self, 150 parameter, dispersion.cdisp) 148 151 149 152
Note: See TracChangeset
for help on using the changeset viewer.