Changeset dad49a0 in sasview
- Timestamp:
- May 13, 2009 7:30:10 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:
- 138ac69
- Parents:
- c3435b7f
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
re814734 rdad49a0 101 101 """ 102 102 # Skipping the save state functionality for release 0.9.0 103 return103 #return 104 104 105 105 pos = event.GetPosition() … … 258 258 @param event: check box event 259 259 """ 260 261 262 260 # Go through the list of dispersion check boxes to identify which one has changed 263 261 for p in self.disp_cb_dict: … … 265 263 if event.GetEventObject() == self.disp_cb_dict[p]: 266 264 267 265 self.state.disp_cb_dict[p]= self.disp_cb_dict[p].GetValue() 268 266 if self.disp_cb_dict[p].GetValue() == True: 269 267 # The user wants this parameter to be averaged. … … 304 302 #TODO: refactor model to clean this up? 305 303 self._disp_obj_dict[p] = disp_model 304 self.state._disp_obj_dict [p]= disp_model 305 self.state.values=[] 306 self.state.weights=[] 307 self.state.values = values 308 self.state.weights = weights 306 309 # Set the new model as the dispersion object for the selected parameter 307 310 self.model.set_dispersion(p, disp_model) … … 315 318 # The parameter was un-selected. Go back to Gaussian model (with 0 pts) 316 319 self._reset_dispersity() 317 320 318 321 ## Redraw the model 319 322 self._draw_model() 323 ## post state to fit panel 324 event = PageInfoEvent(page = self) 325 wx.PostEvent(self.parent, event) 320 326 return 321 327 … … 460 466 if hasattr(self,"cb1"): 461 467 self.state.cb1= self.cb1.GetValue() 462 463 468 except: 464 469 pass … … 472 477 self.state.enable_smearer = copy.deepcopy(self.enable_smearer.GetValue()) 473 478 self.state.disable_smearer = copy.deepcopy(self.disable_smearer.GetValue()) 474 475 479 476 480 if hasattr(self,"disp_box"): … … 504 508 self.state.orientation_params_disp) 505 509 self._copy_parameters_state(self.parameters, self.state.parameters) 506 507 510 self._copy_parameters_state(self.fittable_param, self.state.fittable_param) 508 511 self._copy_parameters_state(self.fixed_param, self.state.fixed_param) … … 526 529 self._set_model_sizer_selection( self.model ) 527 530 self.set_model_param_sizer(self.model) 528 531 529 532 self.enable2D= state.enable2D 530 533 self.state.enable2D= state.enable2D 531 534 532 535 if hasattr(self,"model_view"): 533 536 if not self.enable2D: … … 543 546 if hasattr(self, "disp_box"): 544 547 self.disp_box.SetSelection(self.state.disp_box) 545 546 self.disp_cb_dict = {} 547 for k,v in self.state.disp_cb_dict.iteritems(): 548 549 self._set_dipers_Param(event=None) 550 551 n = self.disp_box.GetCurrentSelection() 552 dispersity= self.disp_box.GetClientData(n) 553 name= dispersity.__name__ 554 if name == "GaussianDispersion": 555 self.disp_cb_dict = {} 548 556 self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 549 557 self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 550 551 self._disp_obj_dict={} 552 for k , v in self.state._disp_obj_dict.iteritems(): 553 self._disp_obj_dict[k]=v 554 555 self._set_dipers_Param(event=None) 558 559 self._disp_obj_dict={} 560 for k , v in self.state._disp_obj_dict.iteritems(): 561 self._disp_obj_dict[k]=v 562 563 if name=="ArrayDispersion": 564 565 for k,v in state.disp_cb_dict.iteritems(): 566 self.disp_cb_dict[k].SetValue(v) 567 568 self._disp_obj_dict={} 569 for k , v in state._disp_obj_dict.iteritems(): 570 # Create the dispersion objects 571 from sans.models.dispersion_models import ArrayDispersion 572 disp_model = ArrayDispersion() 573 self.state.values = copy.deepcopy(state.values) 574 self.state.weights = copy.deepcopy(state.weights) 575 576 disp_model.set_weights(self.state.values, self.state.weights) 577 578 self._disp_obj_dict[k] = disp_model 579 self.state._disp_obj_dict[k]= disp_model 580 self.state.values=[] 581 self.state.weights=[] 582 583 if not hasattr(self.model, "_persistency_dict"): 584 self.model._persistency_dict = {} 585 self.model._persistency_dict[k] = [self.state.values, self.state.weights] 586 # Set the new model as the dispersion object for the selected parameter 587 self.model.set_dispersion(k, disp_model) 588 556 589 ##plotting range restore 557 590 self._reset_plotting_range() … … 563 596 self.compute_chisqr(smearer= self.smearer) 564 597 565 566 598 ## reset state of checkbox,textcrtl and parameters value 567 599 self._reset_parameters_state(self.orientation_params_disp, … … 572 604 self._reset_parameters_state(self.fittable_param,state.fittable_param) 573 605 self._reset_parameters_state(self.fixed_param,state.fixed_param) 606 ## draw the model with previous parameters value 574 607 self._onparamEnter_helper() 575 608 ## reset context menu items 576 609 self._reset_context_menu() 577 ## draw the model with previous parameters value 578 #self._draw_model() 579 580 581 610 582 611 583 612 … … 611 640 Reset the plotting range to a given state 612 641 """ 613 614 #self.qmin.SetValue(format_number(self.state.qmin)) 615 #self.qmax.SetValue(format_number(self.state.qmax)) 642 616 643 self.qmin.SetValue(str(self.state.qmin)) 617 644 self.qmax.SetValue(str(self.state.qmax)) … … 1341 1368 self.sizer4.Layout() 1342 1369 self.SetScrollbars(20,20,200,100) 1370 1343 1371 1344 1372 def _set_range_sizer(self, title, object1=None,object=None): … … 1400 1428 """ 1401 1429 # Skipping save state functionality for release 0.9.0 1402 return1430 #return 1403 1431 1404 1432 self.sizer6.Clear(True) -
sansview/perspectives/fitting/fitting.py
rc3435b7f rdad49a0 963 963 self.calc_thread.ready(0.01) 964 964 965 965 966 def _fill_default_model2D(self, theory, qmax,qstep, qmin=None): 966 967 """ … … 1038 1039 1039 1040 return my_info 1041 1040 1042 1041 1043 def _complete1D(self, x,y, elapsed,model,data=None): … … 1082 1084 wx.PostEvent( self.parent, StatusEvent(status= msg, type="stop" )) 1083 1085 return 1084 1085 1086 1086 1087 1087 1088 … … 1137 1138 """ 1138 1139 self.err_dy= event.err_dy 1140 1139 1141 1140 1142 def _draw_model2D(self,model,data=None,description=None, enable2D=False, … … 1150 1152 1151 1153 """ 1152 1153 1154 x= numpy.linspace(start= -1*qmax, 1154 1155 stop= qmax, … … 1240 1241 1241 1242 1242 1243 1244 1245 1243 if __name__ == "__main__": 1246 1244 i = Plugin() -
sansview/perspectives/fitting/modelpage.py
r848a2ef rdad49a0 14 14 import basepage 15 15 from basepage import BasicPage 16 16 from basepage import PageInfoEvent 17 17 18 18 class ModelPage(BasicPage): … … 315 315 item[2].Enable() 316 316 self.state.enable2D = copy.deepcopy(self.enable2D) 317 317 ## post state to fit panel 318 event = PageInfoEvent(page = self) 319 wx.PostEvent(self.parent, event) 320 321 318 322 319 323 def reset_page(self, state): -
sansview/perspectives/fitting/pagestate.py
rc477b31 rdad49a0 23 23 # model on which the fit would be performed 24 24 self.model = model 25 if not hasattr(self.model, "_persistency_dict"): 26 self.model._persistency_dict = {} 25 27 #fit page manager 26 28 self.manager = None … … 50 52 self._disp_obj_dict={} 51 53 self.disp_cb_dict={} 54 self.values=[] 55 self.weights=[] 56 52 57 #contains link between a model and selected parameters to fit 53 58 self.param_toFit =[] … … 105 110 obj.enable_disp = copy.deepcopy(self.enable_disp) 106 111 obj.disable_disp = copy.deepcopy(self.disable_disp) 107 112 if len(self.model._persistency_dict)>0: 113 for k, v in self.model._persistency_dict.iteritems(): 114 obj.model._persistency_dict[k] = copy.deepcopy(v) 108 115 if len(self._disp_obj_dict)>0: 109 116 for k , v in self._disp_obj_dict.iteritems(): 110 117 obj._disp_obj_dict[k]= v 111 obj.disp_cb_dict = copy.deepcopy(self.disp_cb_dict) 118 if len(self.disp_cb_dict)>0: 119 for k , v in self.disp_cb_dict.iteritems(): 120 obj.disp_cb_dict[k]= v 121 obj.values = copy.deepcopy(self.values) 122 obj.weights = copy.deepcopy(self.weights) 112 123 obj.enable_smearer = copy.deepcopy(self.enable_smearer) 113 124 obj.disable_smearer = copy.deepcopy(self.disable_smearer)
Note: See TracChangeset
for help on using the changeset viewer.