Changeset 8e81af0 in sasview
- Timestamp:
- Sep 30, 2008 4:46:28 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:
- 57f3320
- Parents:
- 948add7
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitproblem.py
r948add7 r8e81af0 20 20 self.model_list=[] 21 21 self.schedule=0 22 self.param_name= None 23 self.param_value=None 22 self.list_param=[] 24 23 25 24 def set_model(self,model,name): … … 70 69 #print "fitproblem",name,value 71 70 #self.model_list[0].setParam(name,value) 72 self.param_name = name 73 self.param_value= value 71 self.list_param.append([name,value]) 74 72 def get_model_param(self): 75 73 """ … … 80 78 #print self.param_name, self.param_value 81 79 #self.model_list[0].setParam(name,value) 82 return self. param_name, self.param_value80 return self.list_param 83 81 84 82 def reset_model(self,model): -
sansview/perspectives/fitting/fitting.py
r948add7 r8e81af0 375 375 return 376 376 new_model=Model(model) 377 param_name,param_value=value.get_model_param() 378 print "fitting ",param_name,value.get_model_param() 379 if param_value !=None: 380 new_model.set( param_name =str(param_value)) 377 param=value.get_model_param() 378 379 if len(param)>0: 380 for item in param: 381 param_value = item[1] 382 param_name = item[0] 383 #print "fitting ", param,param_name, param_value 384 385 #new_model.set( model.getParam(param_name[0])= param_value) 386 #new_model.set( exec"%s=%s"%(param_name[0], param_value)) 387 #new_model.set( exec "%s"%(param_nam) = param_value) 388 new_model.parameterset[ param_name].set( param_value ) 389 381 390 self.fitter.set_model(new_model, self.id, pars) 382 391 self.fitter.set_data(Data(sans_data=data),self.id,qmin,qmax) -
sansview/perspectives/fitting/simfitpage.py
r948add7 r8e81af0 53 53 self.page_finder={} 54 54 55 56 #self.sizer2.Add((20,20),(iy, ix))57 #self.sizer2.Add((20,20), 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)58 55 self.vbox.Layout() 59 56 self.vbox.Fit(self) … … 64 61 def onFit(self,event): 65 62 """ signal for fitting""" 66 63 for page in self.page_finder.iterkeys(): 64 page.set_model_parameter() 65 67 66 if len(self.model_toFit) ==1 : 68 67 self.manager._on_single_fit() 69 print "simfitpage: when here"68 # print "simfitpage: when here" 70 69 elif len(self.model_toFit) > 1 : 71 if len(self.params)>0: 72 self._onTextEnter() 73 self.set_model() 74 else: 75 for page in self.page_finder.iterkeys(): 76 page.set_model_parameter() 70 self._onTextEnter() 71 self.set_model() 77 72 self.manager._on_simul_fit() 78 73 else: … … 101 96 self.model_toFit.append(item) 102 97 else: 103 print"simfit: deselected all"98 #print"simfit: deselected all" 104 99 self.manager.schedule_for_fit( value=0,fitproblem =item[1]) 105 100 for item in self.model_list: … … 186 181 self.manager.schedule_for_fit( value=1,fitproblem =item[1]) 187 182 else: 188 print"simfit: deselected one"183 #print"simfit: deselected one" 189 184 self.manager.schedule_for_fit( value=0,fitproblem =item[1]) 190 185 if item in self.model_toFit: 191 186 self.model_toFit.remove(item) 187 self.cb1.SetValue(False) 192 188 193 194 self.cb1.SetValue(False)195 189 if len(self.model_list)==len(self.model_toFit): 196 190 self.cb1.SetValue(True) … … 212 206 model=list[0] 213 207 param_list=model.getParamList() 214 #print "simfitpage: on set_model",self.params208 print "simfitpage: on set_model self.params ",self.params 215 209 if self.params !=[]: 216 210 for element in self.params: … … 218 212 for item in param_list: 219 213 if item==str(element[1]): 220 #print "simfitpage: on set_model page 1",param_list221 #print "simfitpage: model name",element[0], model.name222 #print "simfitpage: param name ,param value",element[1],element[2]214 print "simfitpage: on set_model page 1",param_list 215 print "simfitpage: model name",element[0], model.name 216 print "simfitpage: param name ,param value",element[1],element[2] 223 217 self.manager.set_page_finder(model.name,element[1],\ 224 218 str(element[2])) 225 219 #print "simfitpage:on set_model page 2",model.params['A'],self.params[2] 226 220 227 228 #def _onTextEnter(self,event):229 221 def _onTextEnter(self): 230 222 """ … … 235 227 """ 236 228 value= self.ctl2.GetValue() 237 self.params=[]238 #print "simfitpage: value",value239 try:240 expression='[\s,;]'241 if re.search(expression,value) !=None:242 word=re.split(expression,value)243 #print "simfitpage: when herre",word244 for item in word:245 try:229 if value: 230 self.params=[] 231 #print "simfitpage: value",value 232 try: 233 expression='[\s,;]' 234 if re.search(expression,value) !=None: 235 word=re.split(expression,value) 236 #print "simfitpage: when herre",word 237 for item in word: 246 238 self.params.append(self.parser_helper(item)) 247 except: 248 wx.PostEvent(self.parent.GrandParent, StatusEvent(status="Constraint Error: %s" % sys.exc_value)) 249 else: 250 try: 251 self.params.append(self.parser_helper(value)) 252 except: 253 wx.PostEvent(self.parent.GrandParent, StatusEvent(status="Constraint Error: %s" % sys.exc_value)) 254 return 255 except: 256 raise 239 else: 240 self.params.append(self.parser_helper(value)) 241 except: 242 raise 243 wx.PostEvent(self.parent.GrandParent, StatusEvent(status="Constraint Error: %s" % sys.exc_value)) 257 244 #print "simfitpage: self.params",self.params 258 245 … … 276 263 param_name=param_names[1] 277 264 ##### just added 278 if string.find(param_name,".")!=-1: 279 ######## 280 param_new_name= re.split("\.",param_name) 281 else: 282 param_new_name= param_name 283 print "simfitpage: param name",param_new_name 284 param=[str(model_name),str(param_new_name[1]),str(param_value)] 265 print "simfitpage: param name",model_name,param_name 266 267 param=[str(model_name),param_name,str(param_value)] 285 268 #print "simfitpage: param",param 286 269 return param
Note: See TracChangeset
for help on using the changeset viewer.