Changeset 2c6b224 in sasview
- Timestamp:
- Jun 28, 2011 2:18:48 PM (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:
- d8c54ead
- Parents:
- 07c8630
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r07c8630 r2c6b224 2875 2875 # Figuring out key combo: Cmd for copy, Alt for paste 2876 2876 if event.AltDown() and event.ShiftDown(): 2877 self._ show_ftol_dialog()2877 self._manager.show_ftol_dialog() 2878 2878 flag = True 2879 2879 elif event.AltDown() or event.ShiftDown(): … … 2892 2892 StatusEvent(status= msg, info=infor)) 2893 2893 2894 2895 def _show_ftol_dialog(self):2896 """2897 Dialog to select ftol for Scipy2898 """2899 from ftol_dialog import ChangeFtol2900 panel = ChangeFtol(self)2901 panel.ShowModal()2902 2894 2903 2895 def _onModel2D(self, event): -
sansview/perspectives/fitting/fitting.py
r59afa71 r2c6b224 46 46 DEFAULT_NPTS = 50 47 47 MAX_NBR_DATA = 4 48 48 SANS_F_TOL = 5e-05 49 49 50 50 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() … … 84 84 self._fit_engine = 'scipy' 85 85 ## Relative error desired in the sum of squares (float); scipy only 86 self.ftol =1.49012e-0886 self.ftol = SANS_F_TOL 87 87 #List of selected data 88 88 self.selected_data_list = [] … … 133 133 134 134 scipy_help= "Scipy Engine: Perform Simple fit. More in Help window...." 135 self.menu1.AppendCheckItem(self.scipy_id, "Simple FitEngine [LeastSq]",scipy_help) 135 self.menu1.AppendCheckItem(self.scipy_id, "Simple FitEngine [LeastSq]", 136 scipy_help) 136 137 wx.EVT_MENU(owner, self.scipy_id, self._onset_engine_scipy) 137 138 138 139 park_help = "Park Engine: Perform Complex fit. More in Help window...." 139 self.menu1.AppendCheckItem(self.park_id, "Complex FitEngine [ParkMC]",park_help) 140 self.menu1.AppendCheckItem(self.park_id, "Complex FitEngine [ParkMC]", 141 park_help) 140 142 wx.EVT_MENU(owner, self.park_id, self._onset_engine_park) 141 143 142 144 self.menu1.FindItemById(self.scipy_id).Check(True) 143 145 self.menu1.FindItemById(self.park_id).Check(False) 146 self.menu1.AppendSeparator() 147 self.id_tol = wx.NewId() 148 ftol_help = "Change the current FTolerance (=%s) " % str(self.ftol) 149 ftol_help += "of Simple FitEngine..." 150 self.menu1.Append(self.id_tol, "Change FTolerance [LeastSq Only]", 151 ftol_help) 152 wx.EVT_MENU(owner, self.id_tol, self.show_ftol_dialog) 153 154 144 155 #create menubar items 145 156 return [(self.menu1, self.sub_menu)] … … 462 473 except: 463 474 # default 464 f_tol = 1.49012e-08475 f_tol = SANS_F_TOL 465 476 466 477 self.ftol = f_tol 467 478 # update ftol menu help strings 479 ftol_help = "Change the current FTolerance (=%s) " % str(self.ftol) 480 ftol_help += "of Simple FitEngine..." 481 self.menu1.SetHelpString(self.id_tol, ftol_help) 482 483 def show_ftol_dialog(self, event=None): 484 """ 485 Dialog to select ftol for Scipy 486 """ 487 #if event != None: 488 # event.Skip() 489 from ftol_dialog import ChangeFtol 490 panel = ChangeFtol(self.parent, self) 491 panel.ShowModal() 492 468 493 def stop_fit(self, uid): 469 494 """ -
sansview/perspectives/fitting/ftol_dialog.py
re7f70e8 r2c6b224 14 14 # default ftol 15 15 F_TOL = 1.49012e-08 16 SANS_F_TOL = 5e-05 16 17 17 18 if sys.platform.count("win32") > 0: 18 19 PANEL_WIDTH = 270 19 PANEL_HEIGHT = 2 5020 PANEL_HEIGHT = 265 20 21 FONT_VARIANT = 0 21 22 else: 22 23 PANEL_WIDTH = 285 23 PANEL_HEIGHT = 2 5524 PANEL_HEIGHT = 265 24 25 FONT_VARIANT = 1 25 26 … … 33 34 Dialog to select ftol 34 35 """ 35 def __init__(self, parent, id=-1, title="FTolerance"):36 def __init__(self, parent, base, id=-1, title="FTolerance"): 36 37 wx.Dialog.__init__(self, parent, id, title, 37 38 size=(PANEL_WIDTH, PANEL_HEIGHT)) 38 39 # parent 39 self.parent = parent40 self.parent = base 40 41 # default ftol 41 self.ftol = F_TOL42 self.ftol = SANS_F_TOL 42 43 # font size 43 44 self.SetWindowVariant(variant=FONT_VARIANT) … … 45 46 panel = wx.Panel(self, -1) 46 47 vbox = wx.BoxSizer(wx.VERTICAL) 47 wx.StaticBox(panel, -1, 'ftol selection (Scipy)', (5, 5), 48 (PANEL_WIDTH*0.9, PANEL_HEIGHT*0.65)) 49 default_bt = wx.RadioButton(panel, -1, 'Default', (15, 30), 48 wx.StaticBox(panel, -1, 'FTol selection (Leastsq)', (5, 6), 49 (PANEL_WIDTH*0.9, PANEL_HEIGHT*0.7)) 50 default_bt = wx.RadioButton(panel, -1, 'SansView Default (5e-05)', 51 (15, 30), 50 52 style=wx.RB_GROUP) 53 default_bt.SetValue(True) 51 54 default_bt.Bind(wx.EVT_RADIOBUTTON, self.OnFtolSelection) 52 default_bt.SetValue(True) 53 high_bt = wx.RadioButton(panel, -1, '1e-06', (15, 55)) 55 sci_default_bt = wx.RadioButton(panel, -1, 56 'Scipy Default (1.49012e-08)', (15, 55)) 57 sci_default_bt.SetValue(False) 58 sci_default_bt.Bind(wx.EVT_RADIOBUTTON, self.OnFtolSelection) 59 high_bt = wx.RadioButton(panel, -1, '1e-06', (15, 80)) 54 60 high_bt.SetValue(False) 55 61 high_bt.Bind(wx.EVT_RADIOBUTTON, self.OnFtolSelection) 56 mid_bt = wx.RadioButton(panel, -1, '1e-05', (15, 80))62 mid_bt = wx.RadioButton(panel, -1, '1e-05', (15, 105)) 57 63 mid_bt.SetValue(False) 58 64 mid_bt.Bind(wx.EVT_RADIOBUTTON, self.OnFtolSelection) 59 low_bt = wx.RadioButton(panel, -1, '1e-04', (15, 1 05))65 low_bt = wx.RadioButton(panel, -1, '1e-04', (15, 130)) 60 66 low_bt.SetValue(False) 61 67 low_bt.Bind(wx.EVT_RADIOBUTTON, self.OnFtolSelection) 62 self.custom_bt = wx.RadioButton(panel, -1, 'Custom', (15, 1 30))68 self.custom_bt = wx.RadioButton(panel, -1, 'Custom', (15, 155)) 63 69 self.custom_bt.SetValue(False) 64 70 self.custom_bt.Bind(wx.EVT_RADIOBUTTON, self.OnFtolSelection) 65 self.custombox = wx.TextCtrl(panel, -1, '', (95, 1 30))71 self.custombox = wx.TextCtrl(panel, -1, '', (95, 155)) 66 72 self.custombox.Disable() 67 73 hbox = wx.BoxSizer(wx.HORIZONTAL) … … 73 79 # set sizer 74 80 self.SetSizer(vbox) 75 81 76 82 def OnFtolSelection(self, event=None): 77 83 """ … … 83 89 selection = button.GetLabel() 84 90 # get float value 85 if selection == 'Default': 91 if selection.count('SansView') > 0: 92 ftol = SANS_F_TOL 93 self.custombox.Disable() 94 elif selection.count('Scipy') > 0: 86 95 ftol = F_TOL 87 96 self.custombox.Disable() … … 111 120 if flag: 112 121 # set ftol in fitting 113 self.parent. parent._manager.set_ftol(self.ftol)114 msg = "The ftol ( Scipy) is set to %s." % self.ftol122 self.parent.set_ftol(self.ftol) 123 msg = "The ftol (LeastSq) is set to %s." % self.ftol 115 124 else: 116 125 msg = "Error in the selection... No changes in ftol." 117 126 # post event for info 118 wx.PostEvent( self.parent.parent ._manager.parent,127 wx.PostEvent( self.parent.parent, 119 128 StatusEvent(status= msg, info='warning')) 120 129
Note: See TracChangeset
for help on using the changeset viewer.