Changeset 6f023e8 in sasview for sansview/perspectives/fitting
- Timestamp:
- Mar 30, 2009 12:31:41 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:
- 9619367
- Parents:
- ded92e4
- Location:
- sansview/perspectives/fitting
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
rca7a626 r6f023e8 29 29 Initialization of the Panel 30 30 """ 31 self.name= self.data.name 31 32 ## fit page does not content npts txtcrtl 32 33 self.npts=None … … 328 329 self.qmin_x=float(self.qmin.GetValue()) 329 330 self.qmax_x =float( self.qmax.GetValue()) 330 331 self.manager._reset_schedule_problem( value=0) 331 332 self.manager.schedule_for_fit( value=1,page=self,fitproblem =None) 332 333 self.manager.set_fit_range(page= self,qmin= self.qmin_x, qmax= self.qmax_x) -
sansview/perspectives/fitting/fitpanel.py
r00c3aac r6f023e8 6 6 #import models 7 7 _BOX_WIDTH = 80 8 ( FitPageEvent, EVT_FIT_PAGE) = wx.lib.newevent.NewEvent()8 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() 9 9 10 10 class FitPanel(wx.aui.AuiNotebook): … … 61 61 close page and remove all references to the closed page 62 62 """ 63 page_info=self.get_current_page().page_info.clone() 64 self.manager._add_page_onmenu("Model", page_info) 65 63 66 selected_page = self.GetPage(self.GetSelection()) 64 67 page_number = self.GetSelection() … … 152 155 panel = FitPage(parent= self, page_info=myinfo, name=name ) 153 156 panel.name=name 154 157 panel.window_name= "fitpage" 155 158 panel.set_manager(self.manager) 156 159 panel.set_owner(self.event_owner) … … 159 162 #panel.populate_box( self.model_list_box) 160 163 self.fit_page_name.append(name) 161 164 162 165 return panel 163 166 else: … … 199 202 #FOR PLUGIN for some reason model.name is = BASEcomponent 200 203 self.manager.draw_model(model) 204 201 205 202 206 -
sansview/perspectives/fitting/fitting.py
rca7a626 r6f023e8 3 3 import string, numpy, math 4 4 5 from copy importdeepcopy5 #import copy,deepcopy 6 6 from danse.common.plottools.plottables import Data1D, Theory1D,Data2D 7 7 from danse.common.plottools.PlotPanel import PlotPanel … … 22 22 import time 23 23 import thread 24 25 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() 24 26 class PlotInfo: 25 27 """ … … 63 65 #Flag to let the plug-in know that it is running stand alone 64 66 self.standalone=True 67 ## dictionary of page closed and id 68 self.closed_page_dict ={} 65 69 ## Fit engine 66 70 self._fit_engine = 'scipy' … … 87 91 #Menu for fitting 88 92 self.menu1 = wx.Menu() 89 id1 = wx.NewId() 90 self.menu1.Append(id1, '&Simultaneous') 91 wx.EVT_MENU(owner, id1, self.on_add_sim_page) 92 self.menu1.AppendSeparator() 93 93 94 #Set park engine 94 95 id3 = wx.NewId() 95 96 scipy_help= "Scipy Engine: Perform Simple fit. More in Help window...." 96 self.menu1.Append(id3, "Scipy",scipy_help) 97 #self.menu1.Append(id3, "Scipy",scipy_help) 98 self.menu1.AppendCheckItem(id3, "Scipy",scipy_help) 97 99 wx.EVT_MENU(owner, id3, self._onset_engine_scipy) 98 self.menu1.AppendSeparator()100 99 101 id3 = wx.NewId() 100 102 park_help = "Park Engine: Perform Complex fit. More in Help window...." 101 self.menu1.Append (id3, "park",park_help)103 self.menu1.AppendCheckItem(id3, "Park",park_help) 102 104 wx.EVT_MENU(owner, id3, self._onset_engine_park) 103 105 self.menu1.AppendSeparator() 106 107 id1 = wx.NewId() 108 simul_help = "Allow to edit fit engine with multiple model and data" 109 self.menu1.Append(id1, '&Simultaneous page',simul_help) 110 wx.EVT_MENU(owner, id1, self.on_add_sim_page) 111 104 112 #menu for model 105 113 menu2 = wx.Menu() … … 113 121 owner.Bind(fitpage.EVT_MODEL_BOX,self._on_model_panel) 114 122 123 self.menu3= wx.Menu() 124 id4 = wx.NewId() 125 115 126 #create menubar items 116 return [(id, self.menu1, "Fitting"),(id2, menu2, "Model")] 127 return [(id, self.menu1, "Fitting"), 128 (id4,self.menu3,"Averagers"), 129 (id2, menu2, "Model")] 117 130 118 131 def on_add_sim_page(self, event): … … 356 369 qstep=qstep) 357 370 371 372 358 373 def onFit(self): 359 374 """ … … 427 442 return 428 443 429 430 431 432 433 444 445 def _add_page_onmenu(self, name, page_info): 446 """ 447 Add name of a closed page of fitpanel in a menu 448 """ 449 # Post paramters 450 event_id = wx.NewId() 451 self.menu1.Append(event_id, name, 452 "Show %s fit panel" % name) 453 self.closed_page_dict[event_id ]= page_info 454 wx.EVT_MENU(self.parent,event_id, self._open_closed_page) 455 456 457 def _open_closed_page(self, event): 458 """ 459 reopen a closed page 460 """ 461 print "reopen" 462 463 def _reset_schedule_problem(self, value=0): 464 """ 465 unschedule or schedule all fitproblem to be fit 466 """ 467 for page, fitproblem in self.page_finder.iteritems(): 468 fitproblem.schedule_tofit(value) 469 434 470 def _fit_helper(self,current_pg,pars,value, id, title="Single Fit " ): 435 471 """ … … 637 673 set engine to park 638 674 """ 675 if event.IsChecked(): 676 self.menu1.FindItemByPosition(0).Check(False) 639 677 self._on_change_engine('park') 640 678 … … 644 682 set engine to scipy 645 683 """ 684 if event.IsChecked(): 685 self.menu1.FindItemByPosition(1).Check(False) 646 686 self._on_change_engine('scipy') 647 687 … … 655 695 # Set group ID if available 656 696 event_id = self.parent.popup_panel(new_panel) 657 self.menu 1.Append(event_id, new_panel.window_caption,697 self.menu3.Append(event_id, new_panel.window_caption, 658 698 "Show %s plot panel" % new_panel.window_caption) 659 699 # Set UID to allow us to reference the panel later … … 662 702 self.mypanels.append(new_panel) 663 703 return 664 704 665 705 def _on_change_engine(self, engine='park'): 666 706 """ -
sansview/perspectives/fitting/modelpage.py
rdfae8b3 r6f023e8 29 29 Initialization of the Panel 30 30 """ 31 31 self.name ="Model" 32 32 self._fill_model_sizer( self.sizer1) 33 33 self._fill_range_sizer() -
sansview/perspectives/fitting/pageInfo.py
rc77d859 r6f023e8 2 2 3 3 import wx 4 import copy 4 5 5 6 class PageInfo(object): … … 69 70 self.list_of_radiobox[label]=[label, id, state] 70 71 71 72 def clone(self): 73 model=None 74 if self.model !=None: 75 model = self.model.clone() 76 77 obj = PageInfo( self.parent,model= model ) 78 obj.data = copy.deepcopy(self.data) 79 80 return obj 72 81 73 82 -
sansview/perspectives/fitting/simfitpage.py
rca7a626 r6f023e8 125 125 ## model was actually selected from this page to be fit 126 126 if len(self.model_toFit) >= 1 : 127 self.manager._reset_schedule_problem( value=0) 128 for item in self.model_list: 129 if item[0].GetValue(): 130 self.manager.schedule_for_fit( value=1,fitproblem =item[1]) 127 131 self.manager.onFit() 128 132 else: … … 148 152 for item in self.model_list: 149 153 item[0].SetValue(True) 150 self.manager.schedule_for_fit( value=1,fitproblem =item[1])151 154 self.model_toFit.append(item) 152 155 … … 160 163 for item in self.model_list: 161 164 item[0].SetValue(False) 162 self.manager.schedule_for_fit( value=0,fitproblem =item[1])163 165 164 166 self.model_toFit=[] … … 175 177 if item[0].GetValue()==True: 176 178 self.model_toFit.append(item) 177 self.manager.schedule_for_fit( value=1,fitproblem =item[1])178 179 else: 179 self.manager.schedule_for_fit( value=0,fitproblem =item[1])180 180 if item in self.model_toFit: 181 181 self.model_toFit.remove(item)
Note: See TracChangeset
for help on using the changeset viewer.