Changeset 75df58b in sasview for prview/perspectives/pr/inversion_panel.py
- Timestamp:
- Jan 21, 2011 12:44:46 PM (14 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:
- f444b20
- Parents:
- 8dc02d8b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/inversion_panel.py
r3e41f43 r75df58b 10 10 import logging 11 11 from wx.lib.scrolledpanel import ScrolledPanel 12 from sans.guicomm.events import StatusEvent 12 from sans.guiframe.events import StatusEvent 13 from sans.guiframe.panel_base import PanelBase 13 14 from inversion_state import InversionState 14 15 from pr_widgets import PrTextCtrl … … 18 19 19 20 20 class InversionControl(ScrolledPanel ):21 class InversionControl(ScrolledPanel, PanelBase): 21 22 """ 22 23 """ … … 35 36 """ 36 37 ScrolledPanel.__init__(self, parent, id=id, **kwargs) 38 PanelBase.__init__(self) 37 39 self.SetupScrolling() 38 40 … … 72 74 self.alpha_estimate_ctl = None 73 75 self.nterms_estimate_ctl = None 74 75 76 ## D_max distance explorator 76 77 self.distance_explorator_ctl = None 77 78 78 ## Data manager 79 79 self.manager = None 80 81 80 ## Standalone flage 82 81 self.standalone = standalone 83 84 82 ## Default file location for save 85 83 self._default_save_location = os.getcwd() 86 87 88 84 # Default width 89 85 self._default_width = 350 … … 578 574 hint_msg = "Radius of gyration for the computed P(r)." 579 575 self.rg_ctl.SetToolTipString(hint_msg) 580 self.iq0_ctl = OutputTextCtrl(self, -1, size=(60, 20))576 self.iq0_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 581 577 hint_msg = "Scattering intensity at Q=0 for the computed P(r)." 582 578 self.iq0_ctl.SetToolTipString(hint_msg) 583 self.bck_ctl = OutputTextCtrl(self, -1, size=(60, 20))579 self.bck_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 584 580 self.bck_ctl.SetToolTipString("Value of estimated constant background.") 585 581 … … 592 588 label_pos_err = wx.StaticText(self, -1, "1-sigma positive fraction") 593 589 594 self.time_ctl = OutputTextCtrl(self, -1, size=(60, 20))590 self.time_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 595 591 hint_msg = "Computation time for the last inversion, in seconds." 596 592 self.time_ctl.SetToolTipString(hint_msg) 597 593 598 self.chi2_ctl = OutputTextCtrl(self, -1, size=(60, 20))594 self.chi2_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 599 595 self.chi2_ctl.SetToolTipString("Chi^2 over degrees of freedom.") 600 596 601 597 # Oscillation parameter 602 self.osc_ctl = OutputTextCtrl(self, -1, size=(60, 20))598 self.osc_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 603 599 hint_msg = "Oscillation parameter. P(r) for a sphere has an " 604 600 hint_msg += " oscillation parameter of 1.1." … … 606 602 607 603 # Positive fraction figure of merit 608 self.pos_ctl = OutputTextCtrl(self, -1, size=(60, 20))604 self.pos_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 609 605 hint_msg = "Fraction of P(r) that is positive. " 610 606 hint_msg += "Theoretically, P(r) is defined positive." … … 612 608 613 609 # 1-simga positive fraction figure of merit 614 self.pos_err_ctl = OutputTextCtrl(self, -1, size=(60, 20))610 self.pos_err_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 615 611 message = "Fraction of P(r) that is at least 1 standard deviation" 616 612 message += " greater than zero.\n" … … 775 771 height = 0 776 772 width = 0 777 778 773 flag = True 779 780 781 774 # Read slit height 782 775 try: … … 917 910 wx.PostEvent(self.parent, StatusEvent(status=message)) 918 911 919 def _change_file(self, evt=None, filepath=None ):912 def _change_file(self, evt=None, filepath=None, data=None): 920 913 """ 921 914 Choose a new input file for I(q) 922 915 """ 923 import os 924 if not self.manager==None: 925 path = self.manager.choose_file(path=filepath) 926 927 if path and os.path.isfile(path): 928 self.plot_data.SetValue(str(path)) 929 try: 930 self.manager.show_data(path, reset=True) 931 self._on_pars_changed(None) 932 933 # Perform inversion 934 if self.standalone == True: 935 self._on_invert(None) 936 except: 937 # Invalid data 938 msg = "InversionControl._change_file: %s" % sys.exc_value 939 logging.error(msg) 916 if not self.manager is None: 917 self.plot_data.SetValue(str(data.name)) 918 try: 919 self.manager.show_data(data=data, reset=True) 920 self._on_pars_changed(None) 921 self._on_invert(None) 922 except: 923 msg = "InversionControl._change_file: %s" % sys.exc_value 924 logging.error(msg) 940 925 941 926 class HelpDialog(wx.Dialog): … … 954 939 explanation = help() 955 940 956 label_explain = wx.StaticText(self, -1, explanation, size=(350, 320))941 label_explain = wx.StaticText(self, -1, explanation, size=(350, 320)) 957 942 958 943 vbox.Add(label_explain, 0, wx.ALL|wx.EXPAND, 15) … … 991 976 992 977 label_npts = wx.StaticText(self, -1, "Number of points") 993 self.npts_ctl = PrTextCtrl(self, -1, size=(100, 20))978 self.npts_ctl = PrTextCtrl(self, -1, size=(100, 20)) 994 979 995 pars_sizer = wx.GridBagSizer(5, 5)980 pars_sizer = wx.GridBagSizer(5, 5) 996 981 iy = 0 997 pars_sizer.Add(label_npts, (iy,0), (1,1), wx.LEFT, 15)998 pars_sizer.Add(self.npts_ctl, (iy,1), (1,1), wx.RIGHT, 0)982 pars_sizer.Add(label_npts, (iy, 0), (1, 1), wx.LEFT, 15) 983 pars_sizer.Add(self.npts_ctl, (iy, 1), (1, 1), wx.RIGHT, 0) 999 984 1000 985 vbox.Add(pars_sizer, 0, wx.ALL|wx.EXPAND, 15) 1001 1002 986 1003 987 static_line = wx.StaticLine(self, -1)
Note: See TracChangeset
for help on using the changeset viewer.