Changeset 225aca8 in sasview for src/sas/perspectives
- Timestamp:
- Jul 28, 2015 10:14:38 AM (9 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:
- a910c788
- Parents:
- ae2a197 (diff), d06c34c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/perspectives
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/calculator/calculator.py
r49ab5d7 rf21d496 33 33 for calculator perspective 34 34 """ 35 def __init__(self , standalone=True):36 PluginBase.__init__(self, name="Calculator" , standalone=standalone)35 def __init__(self): 36 PluginBase.__init__(self, name="Calculator") 37 37 # Log startup 38 38 logging.info("Calculator plug-in started") -
src/sas/perspectives/fitting/fitpage.py
r098f3d2 r225aca8 268 268 weighting_box.Add(sizer_weighting) 269 269 270 sizer_fit = wx.GridSizer(2, 5, 2, 6)271 272 270 # combobox for smear2d accuracy selection 273 271 self.smear_accuracy = wx.ComboBox(self, -1, size=(50, -1), … … 282 280 283 281 #Fit button 284 self.btFit = wx.Button(self, wx.NewId(), 'Fit' , size=(88, 25))282 self.btFit = wx.Button(self, wx.NewId(), 'Fit') 285 283 self.default_bt_colour = self.btFit.GetDefaultAttributes() 286 284 self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId()) … … 288 286 289 287 #General Help button 290 self.btFitHelp = wx.Button(self, -1, 'H ELP')291 self.btFitHelp.SetToolTipString("General Fitting Help.")288 self.btFitHelp = wx.Button(self, -1, 'Help') 289 self.btFitHelp.SetToolTipString("General fitting help.") 292 290 self.btFitHelp.Bind(wx.EVT_BUTTON, self._onFitHelp) 293 291 … … 303 301 self.btSmearHelp = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT,\ 304 302 size=size_q) 305 self.btSmearHelp.SetToolTipString("Resolution Smearing Help.")303 self.btSmearHelp.SetToolTipString("Resolution smearing help.") 306 304 self.btSmearHelp.Bind(wx.EVT_BUTTON, self._onSmearHelp) 307 305 … … 362 360 self.disable_smearer.SetValue(True) 363 361 364 # add 4 types of smearing to the sizer365 # Note from June 14, 2015366 # removed the extra (10,10) spaces to make room for help. Actually367 # don't see the need for those anyway as the wx.LEFT, xx should take368 # care of spacing anyway though it does not seem to work for some369 # reason. Currently leaving as we are in "code freeze" only making370 # minimal changes necessary for release 3.1. We probably want to clean371 # up the whole fitpage (and basepage and fitpanel etc) eventually.372 # ---- PDB373 362 sizer_smearer.Add(self.disable_smearer, 0, wx.LEFT, 10) 374 # sizer_smearer.Add((10, 10))375 363 sizer_smearer.Add(self.enable_smearer) 376 # sizer_smearer.Add((10, 10))377 364 sizer_smearer.Add(self.pinhole_smearer) 378 # sizer_smearer.Add((10, 10))379 365 sizer_smearer.Add(self.slit_smearer) 380 # sizer_smearer.Add((10, 10))381 366 sizer_smearer.Add(self.btSmearHelp) 382 367 sizer_smearer.Add((10, 10)) … … 397 382 398 383 # Update and Draw button 399 self.draw_button = wx.Button(self, wx.NewId(), 400 'Compute', size=(88, 24)) 384 self.draw_button = wx.Button(self, wx.NewId(), 'Compute') 401 385 self.draw_button.Bind(wx.EVT_BUTTON, \ 402 386 self._onDraw, id=self.draw_button.GetId()) … … 414 398 box_description_1 = wx.StaticText(self, -1, ' Chi2/Npts') 415 399 box_description_2 = wx.StaticText(self, -1, 'Npts(Fit)') 416 #box_description_3 = wx.StaticText(self, -1, 'Total Npts')417 #box_description_3.SetToolTipString( \418 # " Total Npts : total number of data points")419 420 sizer_fit.Add(box_description_1, 0, 0)421 sizer_fit.Add(box_description_2, 0, 0)422 sizer_fit.Add(self.points_sizer, 0, 0)423 #sizer_fit.Add(box_description_3, 0, 0)424 sizer_fit.Add(self.draw_button, 0, 0)425 sizer_fit.Add((-1,5))426 sizer_fit.Add(self.tcChi, 0, 0)427 sizer_fit.Add(self.Npts_fit, 0, 0)428 sizer_fit.Add(self.Npts_total, 0, 0)429 sizer_fit.Add(self.btFit, 0, 0)430 sizer_fit.Add(self.btFitHelp, 0, 0)431 400 432 401 # StaticText for smear … … 576 545 self.qmin.Bind(wx.EVT_TEXT, self.on_qrange_text) 577 546 self.qmax.Bind(wx.EVT_TEXT, self.on_qrange_text) 578 id = wx.NewId()579 self.reset_qrange = wx.Button(self, id, 'Reset', size=(77, 20))580 581 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id= id)547 wx_id = wx.NewId() 548 self.reset_qrange = wx.Button(self, wx_id, 'Reset') 549 550 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=wx_id) 582 551 self.reset_qrange.SetToolTipString("Reset Q range to the default") 583 552 584 sizer = wx.GridSizer( 2, 4, 2, 6)585 586 self.btEditMask = wx.Button(self, wx.NewId(), 'Editor' , size=(88, 23))553 sizer = wx.GridSizer(5, 5, 2, 6) 554 555 self.btEditMask = wx.Button(self, wx.NewId(), 'Editor') 587 556 self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask, 588 557 id=self.btEditMask.GetId()) … … 594 563 sizer.Add(wx.StaticText(self, -1, ' Max[1/A]')) 595 564 sizer.Add(self.EditMask_title) 565 sizer.Add((-1,5)) 566 596 567 sizer.Add(self.reset_qrange) 597 568 sizer.Add(self.qmin) 598 569 sizer.Add(self.qmax) 599 #sizer.Add(self.theory_npts_tcrtl)600 570 sizer.Add(self.btEditMask) 571 sizer.Add((-1,5)) 572 573 sizer.AddMany(5*[(-1,5)]) 574 575 sizer.Add(box_description_1, 0, 0) 576 sizer.Add(box_description_2, 0, 0) 577 sizer.Add(self.points_sizer, 0, 0) 578 sizer.Add(self.draw_button, 0, 0) 579 sizer.Add((-1,5)) 580 581 sizer.Add(self.tcChi, 0, 0) 582 sizer.Add(self.Npts_fit, 0, 0) 583 sizer.Add(self.Npts_total, 0, 0) 584 sizer.Add(self.btFit, 0, 0) 585 sizer.Add(self.btFitHelp, 0, 0) 586 601 587 boxsizer_range.Add(sizer_chi2) 602 boxsizer_range.Add((10, 10))603 588 boxsizer_range.Add(sizer) 604 605 boxsizer_range.Add((10, 15))606 boxsizer_range.Add(sizer_fit)607 589 if is_2Ddata: 608 590 self.btEditMask.Enable() -
src/sas/perspectives/fitting/fitting.py
r098f3d2 r225aca8 61 61 Fitting plugin is used to perform fit 62 62 """ 63 def __init__(self , standalone=False):64 PluginBase.__init__(self, name="Fitting" , standalone=standalone)63 def __init__(self): 64 PluginBase.__init__(self, name="Fitting") 65 65 66 66 #list of panel to send to guiframe … … 221 221 Get the python editor panel 222 222 """ 223 id = event.GetId()224 label = self.edit_menu.GetLabel( id)223 event_id = event.GetId() 224 label = self.edit_menu.GetLabel(event_id) 225 225 from sas.perspectives.calculator.pyconsole import PyConsole 226 226 filename = os.path.join(models.find_plugins_dir(), label) … … 236 236 Delete custom model file 237 237 """ 238 id = event.GetId()239 label = self.delete_menu.GetLabel( id)238 event_id = event.GetId() 239 label = self.delete_menu.GetLabel(event_id) 240 240 toks = os.path.splitext(label) 241 241 path = os.path.join(models.find_plugins_dir(), toks[0]) … … 256 256 # info='warning')) 257 257 else: 258 self.delete_menu.Delete( id)258 self.delete_menu.Delete(event_id) 259 259 for item in self.edit_menu.GetMenuItems(): 260 260 if item.GetLabel() == label: … … 272 272 Edit summodel template and make one 273 273 """ 274 id = event.GetId()274 event_id = event.GetId() 275 275 model_manager = models.ModelManager() 276 276 model_list = model_manager.get_model_name_list() … … 290 290 self.new_model_frame.Show(True) 291 291 else: 292 id = event.GetId()292 event_id = event.GetId() 293 293 dir_path = models.find_plugins_dir() 294 294 title = "New Custom Model Function" … … 332 332 Set list of the edit model menu labels 333 333 """ 334 id = wx.NewId()334 wx_id = wx.NewId() 335 335 #new_model_menu = wx.Menu() 336 self.edit_model_menu.Append( id, 'New',336 self.edit_model_menu.Append(wx_id, 'New', 337 337 'Add a new model function') 338 wx.EVT_MENU(owner, id, self.make_new_model)339 id = wx.NewId()340 self.edit_model_menu.Append( id, 'Sum|Multi(p1, p2)',338 wx.EVT_MENU(owner, wx_id, self.make_new_model) 339 wx_id = wx.NewId() 340 self.edit_model_menu.Append(wx_id, 'Sum|Multi(p1, p2)', 341 341 'Sum of two model functions') 342 wx.EVT_MENU(owner, id, self.make_sum_model)342 wx.EVT_MENU(owner, wx_id, self.make_sum_model) 343 343 e_id = wx.NewId() 344 344 self.edit_menu = wx.Menu() … … 376 376 has_file = True 377 377 if not has_file: 378 id = wx.NewId()379 submenu.Append( id, name)380 wx.EVT_MENU(owner, id, menu)378 wx_id = wx.NewId() 379 submenu.Append(wx_id, name) 380 wx.EVT_MENU(owner, wx_id, menu) 381 381 has_file = False 382 382 … … 397 397 Create a page to access simultaneous fit option 398 398 """ 399 id = event.GetId()399 event_id = event.GetId() 400 400 caption = "Const & Simul Fit" 401 401 page = self.sim_page 402 if id == self.id_batchfit:402 if event_id == self.id_batchfit: 403 403 caption = "Combined Batch" 404 404 page = self.batch_page … … 719 719 for uid, value in self.page_finder.iteritems(): 720 720 if uid != sim_page_id and uid != self.batch_page.uid: 721 list = value.get_model()722 model = list[0]721 model_list = value.get_model() 722 model = model_list[0] 723 723 if model.name == modelname: 724 724 value.set_model_param(names, values) … … 1568 1568 """ 1569 1569 if event.panel is not None: 1570 new_panel = event.panel1571 1570 self.slicer_panels.append(event.panel) 1572 1571 # Set group ID if available … … 1652 1651 #find if this theory was already plotted and replace that plot given 1653 1652 #the same id 1654 theory_data =self.page_finder[page_id].get_theory_data(fid=data.id)1653 self.page_finder[page_id].get_theory_data(fid=data.id) 1655 1654 1656 1655 if data.is_data: -
src/sas/perspectives/invariant/invariant.py
r824e488 rf21d496 33 33 """ 34 34 35 def __init__(self , standalone=False):36 PluginBase.__init__(self, name="Invariant" , standalone=standalone)35 def __init__(self): 36 PluginBase.__init__(self, name="Invariant") 37 37 38 38 # dictionary containing data name and error on dy of that data -
src/sas/perspectives/pr/inversion_panel.py
r3db44fb rf21d496 35 35 oscillation_max = 1.5 36 36 37 def __init__(self, parent, id=-1, plots=None, standalone=False,**kwargs):37 def __init__(self, parent, id=-1, plots=None, **kwargs): 38 38 """ 39 39 """ … … 83 83 ## Data manager 84 84 self._manager = None 85 ## Standalone flage86 self.standalone = standalone87 85 ## Default file location for save 88 86 self._default_save_location = os.getcwd() -
src/sas/perspectives/pr/pr.py
rc1c14ba rf21d496 54 54 DEFAULT_DMAX = 140.0 55 55 56 def __init__(self , standalone=True):57 PluginBase.__init__(self, name="Pr Inversion" , standalone=standalone)56 def __init__(self): 57 PluginBase.__init__(self, name="Pr Inversion") 58 58 ## Simulation window manager 59 59 self.simview = None … … 94 94 ## Number of P(r) points to display on the output plot 95 95 self._pr_npts = 51 96 ## Flag to let the plug-in know that it is running standalone97 self.standalone = standalone98 96 self._normalize_output = False 99 97 self._scale_output_unity = False … … 623 621 return [] 624 622 elif item.id == graph.selected_plottable: 625 if not self.standalone andissubclass(item.__class__, Data1D):623 if issubclass(item.__class__, Data1D): 626 624 return [["Compute P(r)", 627 625 "Compute P(r) from distribution", … … 1238 1236 self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 1239 1237 self.control_panel = InversionControl(self.frame, -1, 1240 style=wx.RAISED_BORDER, 1241 standalone=self.standalone) 1238 style=wx.RAISED_BORDER) 1242 1239 self.frame.set_panel(self.control_panel) 1243 1240 self._frame_set_helper() … … 1317 1314 [Somehow openGL needs this call] 1318 1315 """ 1319 if self.standalone: 1320 self.parent.set_perspective(self.perspective) 1316 pass -
src/sas/perspectives/fitting/resultpanel.py
r2f4b430 r9df6a03 9 9 import wx.lib.newevent 10 10 from wx.aui import AuiNotebook as Notebook 11 12 from bumps.gui.convergence_view import ConvergenceView 13 from bumps.gui.uncertainty_view import UncertaintyView, CorrelationView, TraceView 14 from bumps.dream.stats import var_stats, format_vars 11 15 12 16 from sas.guiframe.panel_base import PanelBase … … 55 59 result = event.result[0][0] 56 60 if hasattr(result, 'convergence'): 57 from bumps.gui.convergence_view import ConvergenceView58 61 best, pop = result.convergence[:, 0], result.convergence[:, 1:] 59 self.get_panel(ConvergenceView).update(best, pop) 62 self._get_view(ConvergenceView).update(best, pop) 63 else: 64 self._del_view(ConvergenceView) 60 65 if hasattr(result, 'uncertainty_state'): 61 from bumps.gui.uncertainty_view import UncertaintyView, CorrelationView, TraceView62 from bumps.dream.stats import var_stats, format_vars63 66 stats = var_stats(result.uncertainty_state.draw()) 64 67 msg = format_vars(stats) 65 self. get_panel(CorrelationView).update(result.uncertainty_state)66 self. get_panel(UncertaintyView).update((result.uncertainty_state, stats))67 self. get_panel(TraceView).update(result.uncertainty_state)68 self._get_view(CorrelationView).update(result.uncertainty_state) 69 self._get_view(UncertaintyView).update((result.uncertainty_state, stats)) 70 self._get_view(TraceView).update(result.uncertainty_state) 68 71 # TODO: stats should be stored in result rather than computed in bumps UncertaintyView 69 72 wx.PostEvent(self.frame.parent, 70 73 StatusEvent(status=msg, info="info")) 71 print 74 else: 75 for view in (CorrelationView, UncertaintyView, TraceView): 76 self._del_view(view) 72 77 73 78 def get_frame(self): 74 79 return self.frame 75 80 76 def add_panel(self, panel): 77 self.AddPage(panel, panel.title) 78 79 def get_panel(self, panel_class): 81 def _get_view(self, view_class): 80 82 for idx in range(self.PageCount): 81 if self.GetPageText(idx) == panel_class.title:83 if self.GetPageText(idx) == view_class.title: 82 84 return self.GetPage(idx) 83 85 else: 84 panel = panel_class(self)85 self. add_panel(panel)86 panel = view_class(self) 87 self.AddPage(panel, panel.title) 86 88 return panel 89 90 def _del_view(self, view_class): 91 for idx in range(self.PageCount): 92 if self.GetPageText(idx) == view_class.title: 93 self.DeletePage(idx) 94
Note: See TracChangeset
for help on using the changeset viewer.