Changeset 0a518e4c in sasview for sansview/perspectives
- Timestamp:
- Mar 27, 2009 11:20:00 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:
- 1ae3fe1
- Parents:
- 8f90cfd
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r8bd4dc0 r0a518e4c 87 87 self.sizer4 = wx.BoxSizer(wx.VERTICAL) 88 88 self.sizer5 = wx.BoxSizer(wx.VERTICAL) 89 self.sizer6 = wx.BoxSizer(wx.VERTICAL) 89 90 90 91 self.sizer0.SetMinSize((375,-1)) … … 94 95 self.sizer4.SetMinSize((375,-1)) 95 96 self.sizer5.SetMinSize((375,-1)) 97 self.sizer6.SetMinSize((375,-1)) 96 98 97 99 self.vbox.Add(self.sizer0) … … 101 103 self.vbox.Add(self.sizer4) 102 104 self.vbox.Add(self.sizer5) 105 self.vbox.Add(self.sizer6) 103 106 104 107 def set_layout(self): … … 116 119 self.SetScrollbars(20,20,200,100) 117 120 self.Layout() 121 self.SetAutoLayout(True) 118 122 119 123 def set_owner(self,owner): … … 171 175 import sans.models.dispersion_models 172 176 self.polydisp= sans.models.dispersion_models.models 173 self.disp_box = wx.ComboBox(self, -1 ,style=wx.CB_READONLY)177 self.disp_box = wx.ComboBox(self, -1) 174 178 self.disp_box.SetValue("GaussianModel") 175 179 … … 199 203 self.sizer4.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) 200 204 self.sizer4.Layout() 205 201 206 self.SetScrollbars(20,20,200,100) 207 202 208 203 209 def select_disp_angle(self, event): … … 322 328 is_modified =self._check_value_enter( self.parameters ,is_modified) 323 329 330 self.Layout() 324 331 # Here we should check whether the boundaries have been modified. 325 332 # If qmin and qmax have been modified, update qmin and qmax and … … 574 581 self.structurebox.Show(True) 575 582 self.text2.Show(True) 576 583 ## draw empty model 584 from sans.models.NullModel import NullModel 585 self.model = NullModel() 586 self.model.name = "Select P(Q) and S(Q)" 587 self.set_model_param_sizer(self.model) 588 self.sizer4_4.Clear() 589 self.sizer4.Layout() 590 self._draw_model() 591 577 592 self.set_scroll() 578 593 … … 589 604 model= models() 590 605 name = model.__class__.__name__ 591 if hasattr(model, "name"): 592 name = model.name 593 combobox.Append(name,models) 606 if models.__name__!="NoStructure": 607 if hasattr(model, "name"): 608 name = model.name 609 combobox.Append(name,models) 594 610 595 611 wx.EVT_COMBOBOX(combobox,-1, self._on_select_model) … … 607 623 608 624 if self.multip_cb.GetValue(): 609 if struct_factor != None and struct_factor.__name__ != "NoStructure":625 if struct_factor != None and form_factor != None: 610 626 from sans.models.MultiplicationModel import MultiplicationModel 611 if form_factor != None: 612 self.model= MultiplicationModel(form_factor(),struct_factor()) 613 msg= "select one P(Q) and one S(Q) to plot" 614 wx.PostEvent(self.parent.parent, StatusEvent(status= msg)) 627 self.model= MultiplicationModel(form_factor(),struct_factor()) 628 else: 629 from sans.models.NullModel import NullModel 630 self.model = NullModel() 631 self.model.name = "Select P(Q) and S(Q)" 632 msg= "select one P(Q) and one S(Q) to plot" 633 wx.PostEvent(self.parent.parent, StatusEvent(status= msg)) 615 634 else: 616 635 if form_factor != None: … … 636 655 for item in list: 637 656 try: 638 name = str(item[1]) 639 value= float(item[2].GetValue()) 640 # If the value of the parameter has changed, 641 # update the model and set the is_modified flag 642 if value != self.model.getParam(name): 643 self.model.setParam(name,value) 644 is_modified = True 657 if hasattr(self,"text2_3"): 658 self.text2_3.Hide() 659 if item[3]!=None: 660 item[3].Hide() 661 if item[4]!=None: 662 item[4].Clear() 663 item[4].Hide() 664 name = str(item[1]) 665 value= float(item[2].GetValue()) 666 # If the value of the parameter has changed, 667 # update the model and set the is_modified flag 668 if value != self.model.getParam(name): 669 self.model.setParam(name,value) 670 is_modified = True 645 671 except: 646 672 msg= "Model Drawing Error:wrong value entered : %s"% sys.exc_value 647 673 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 648 674 return 675 649 676 return is_modified 650 677 … … 676 703 self._draw_model() 677 704 678 self.sizer4_4.Layout()679 705 self.sizer4.Layout() 706 self.Layout() 680 707 self.SetScrollbars(20,20,200,100) 708 681 709 682 710 … … 694 722 model_disp = wx.StaticText(self, -1, 'No PolyDispersity for this model') 695 723 self.sizer4_4.Add(model_disp,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 696 self.sizer4_4.Layout()724 #self.sizer4_4.Layout() 697 725 self.sizer4.Layout() 698 726 self.SetScrollbars(20,20,200,100) -
sansview/perspectives/fitting/fitpage.py
r24cab5d r0a518e4c 307 307 self.sizer4.Layout() 308 308 self.SetScrollbars(20,20,200,100) 309 309 310 310 311 def _onFit(self, event): … … 384 385 is_modified = False 385 386 has_error = False 387 self.text2_3.Hide() 388 if self.text_disp_1 !=None: 389 self.text_disp_1.Hide() 386 390 #set the panel when fit result are float not list 387 391 if out.__class__==numpy.float64: 388 392 self.param_toFit[0][2].SetValue(format_number(out)) 389 393 self.param_toFit[0][2].Refresh() 394 395 self.param_toFit[0][4].Clear() 396 self.param_toFit[0][4].Hide() 390 397 if cov !=None : 391 398 self.text2_3.Show(True) 392 if self.text_disp_1 !=None:399 if self.text_disp_1 !=None: 393 400 self.text_disp_1.Show(True) 394 401 … … 402 409 #Set the panel when fit result are list 403 410 for item in self.param_toFit: 411 ## reset error value to initial state 412 item[4].Clear() 413 item[4].Hide() 414 item[4].Refresh() 404 415 if( out != None ) and len(out)<=len(self.param_toFit)and i < len(out): 405 416 item[2].SetValue(format_number(self.model.getParam(item[1]))) … … 420 431 421 432 self.sizer3.Layout() 422 #self.sizer4_4.Layout()423 433 self.sizer4.Layout() 424 434 self.SetScrollbars(20,20,200,100) -
sansview/perspectives/fitting/fitting.py
r24cab5d r0a518e4c 524 524 ## draw model 1D with smeared data 525 525 data = self.page_finder[current_pg].get_plotted_data() 526 list= self.page_finder[current_pg].get_model()526 model = self.page_finder[current_pg].get_model() 527 527 ## if user has already selected a model to plot 528 528 ## redraw the model with data smeared 529 if len(list)>0: 530 model = list[0] 531 smearer =self.page_finder[current_pg].get_smearer() 532 if smearer != None: 533 self.draw_model( model=model, data= data, smearer= smearer, 534 qmin= qmin, qmax= qmax) 535 529 530 smearer =self.page_finder[current_pg].get_smearer() 531 if smearer != None: 532 self.draw_model( model=model, data= data, smearer= smearer, 533 qmin= qmin, qmax= qmax) 534 536 535 537 536
Note: See TracChangeset
for help on using the changeset viewer.