Changeset d7a39e5 in sasview for invariantview/perspectives/invariant
- Timestamp:
- Jun 3, 2010 1:09:19 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:
- 7e4a6ff
- Parents:
- d955bf19
- Location:
- invariantview/perspectives/invariant
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/help_panel.py
r1c779b6 rd7a39e5 7 7 8 8 class HelpDialog(wx.Dialog): 9 """ 10 """ 9 11 def __init__(self, parent, id): 10 12 """ 13 """ 11 14 wx.Dialog.__init__(self, parent, id, size=(400, 420)) 12 15 self.SetTitle("Invariant help") 13 16 14 15 17 vbox = wx.BoxSizer(wx.VERTICAL) 16 18 … … 39 41 40 42 class HelpWindow(wx.Frame): 43 """ 44 """ 41 45 def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None): 42 46 wx.Frame.__init__(self, parent, id, title, size=(820, 450)) 43 47 """ 44 48 contains help info 45 49 """ 46 50 … … 112 116 def OnLinkClicked(self, event): 113 117 """ 114 118 Function to diplay html page related to the hyperlinktext selected 115 119 """ 116 120 self.rhelp.LoadPage(self.path) -
invariantview/perspectives/invariant/invariant.py
r8f2069d5 rd7a39e5 1 """ 2 This software was developed by the University of Tennessee as part of the 3 Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 4 project funded by the US National Science Foundation. 5 6 See the license text in license.txt 7 8 copyright 2009, University of Tennessee 9 """ 1 2 3 4 ################################################################################ 5 #This software was developed by the University of Tennessee as part of the 6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 7 #project funded by the US National Science Foundation. 8 # 9 #See the license text in license.txt 10 # 11 #copyright 2009, University of Tennessee 12 ################################################################################ 13 10 14 import wx 11 15 … … 17 21 from sans.guicomm.events import NewPlotEvent, StatusEvent 18 22 from sans.guicomm.events import ERR_DATA 23 19 24 class Plugin: 20 25 """ 21 22 26 This class defines the interface for invariant Plugin class 27 that can be used by the gui_manager. 23 28 24 29 """ … … 26 31 def __init__(self, standalone=False): 27 32 """ 28 33 Abstract class for gui_manager Plugins. 29 34 """ 30 35 ## Plug-in name. It will appear on the application menu. … … 41 46 def populate_menu(self, id, parent): 42 47 """ 43 Create and return the list of application menu 44 items for the plug-in. 45 46 @param id: deprecated. Un-used. 47 @param parent: parent window 48 @return: plug-in menu 48 Create and return the list of application menu 49 items for the plug-in. 50 51 :param id: deprecated. Un-used. 52 :param parent: parent window 53 54 :return: plug-in menu 55 49 56 """ 50 57 return [] … … 52 59 def help(self, evt): 53 60 """ 54 Show a general help dialog. 55 TODO: replace the text with a nice image 56 provide more hint on the SLD calculator 61 Show a general help dialog. 62 57 63 """ 58 64 from help_panel import HelpWindow … … 62 68 def get_panels(self, parent): 63 69 """ 64 Create and return the list of wx.Panels for your plug-in. 65 Define the plug-in perspective. 66 67 Panels should inherit from DefaultPanel defined below, 68 or should present the same interface. They must define 69 "window_caption" and "window_name". 70 71 @param parent: parent window 72 @return: list of panels 70 Create and return the list of wx.Panels for your plug-in. 71 Define the plug-in perspective. 72 73 Panels should inherit from DefaultPanel defined below, 74 or should present the same interface. They must define 75 "window_caption" and "window_name". 76 77 :param parent: parent window 78 79 :return: list of panels 80 73 81 """ 74 82 ## Save a reference to the parent … … 85 93 def get_tools(self): 86 94 """ 87 95 Returns a set of menu entries for tools 88 96 """ 89 97 return [] … … 92 100 def get_context_menu(self, graph=None): 93 101 """ 94 This method is optional. 95 96 When the context menu of a plot is rendered, the 97 get_context_menu method will be called to give you a 98 chance to add a menu item to the context menu. 99 100 A ref to a Graph object is passed so that you can 101 investigate the plot content and decide whether you 102 need to add items to the context menu. 103 104 This method returns a list of menu items. 105 Each item is itself a list defining the text to 106 appear in the menu, a tool-tip help text, and a 107 call-back method. 108 109 @param graph: the Graph object to which we attach the context menu 110 @return: a list of menu items with call-back function 102 This method is optional. 103 104 When the context menu of a plot is rendered, the 105 get_context_menu method will be called to give you a 106 chance to add a menu item to the context menu. 107 108 A ref to a Graph object is passed so that you can 109 investigate the plot content and decide whether you 110 need to add items to the context menu. 111 112 This method returns a list of menu items. 113 Each item is itself a list defining the text to 114 appear in the menu, a tool-tip help text, and a 115 call-back method. 116 117 :param graph: the Graph object to which we attach the context menu 118 119 :return: a list of menu items with call-back function 120 111 121 """ 112 122 self.graph = graph … … 127 137 def get_perspective(self): 128 138 """ 129 139 Get the list of panel names for this perspective 130 140 """ 131 141 return self.perspective … … 133 143 def on_perspective(self, event): 134 144 """ 135 Call back function for the perspective menu item. 136 We notify the parent window that the perspective 137 has changed. 138 @param event: menu event 145 Call back function for the perspective menu item. 146 We notify the parent window that the perspective 147 has changed. 148 149 :param event: menu event 150 139 151 """ 140 152 self.parent.set_perspective(self.perspective) … … 142 154 def post_init(self): 143 155 """ 144 156 Post initialization call back to close the loose ends 145 157 """ 146 158 pass … … 148 160 def set_default_perspective(self): 149 161 """ 150 151 152 153 162 Call back method that True to notify the parent that the current plug-in 163 can be set as default perspective. 164 when returning False, the plug-in is not candidate for an automatic 165 default perspective setting 154 166 """ 155 167 return False … … 157 169 def copy_data(self, item, dy=None): 158 170 """ 159 160 161 @param return171 receive a data 1D and the list of errors on dy 172 and create a new data1D data 173 162 174 """ 163 175 id = None … … 179 191 def _on_data_error(self, event): 180 192 """ 181 182 193 receives and event from plotting plu-gins to store the data name and 194 their errors of y coordinates for 1Data hide and show error 183 195 """ 184 196 self.err_dy = event.err_dy … … 186 198 def _compute_invariant(self, event): 187 199 """ 188 200 Open the invariant panel to invariant computation 189 201 """ 190 202 self.panel = event.GetEventObject() … … 208 220 def plot_theory(self, data=None, name=None): 209 221 """ 210 Receive a data set and post a NewPlotEvent to parent. 211 @param data: extrapolated data to be plotted 212 @param name: Data's name to use for the legend 222 Receive a data set and post a NewPlotEvent to parent. 223 224 :param data: extrapolated data to be plotted 225 :param name: Data's name to use for the legend 226 213 227 """ 214 228 if data is None: … … 235 249 def plot_data(self, scale, background): 236 250 """ 237 251 replot the current data if the user enters a new scale or background 238 252 """ 239 253 new_plot = scale * self.__data - background -
invariantview/perspectives/invariant/invariant_details.py
r5dc4236 rd7a39e5 31 31 class InvariantContainer(wx.Object): 32 32 """ 33 34 35 33 This class stores some values resulting resulting from invariant 34 calculations. Given the value of total invariant, this class can also 35 determine the percentage of invariants resulting from extrapolation. 36 36 """ 37 37 def __init__(self): … … 62 62 def compute_percentage(self): 63 63 """ 64 64 Compute percentage of each invariant 65 65 """ 66 66 if self.qstar_total is None: … … 99 99 def check_values(self): 100 100 """ 101 101 check the validity if invariant 102 102 """ 103 103 if self.qstar_total is None and self.qstar is None: … … 145 145 class InvariantDetailsPanel(wx.Dialog): 146 146 """ 147 147 This panel describes proportion of invariants 148 148 """ 149 149 def __init__(self, parent=None, id=-1, qstar_container=None, … … 182 182 def _define_structure(self): 183 183 """ 184 184 Define main sizers needed for this panel 185 185 """ 186 186 #Box sizers must be defined first before defining buttons/textctrls (MAC). … … 206 206 def _layout_shart(self): 207 207 """ 208 208 Draw widgets related to chart 209 209 """ 210 210 self.panel_chart = wx.Panel(self) … … 214 214 def _layout_invariant(self): 215 215 """ 216 216 Draw widgets related to invariant 217 217 """ 218 218 uncertainty = "+/-" … … 301 301 def _layout_warning(self): 302 302 """ 303 303 Draw widgets related to warning 304 304 """ 305 305 #Warning [string] … … 312 312 def _layout_button(self): 313 313 """ 314 314 Draw widgets related to button 315 315 """ 316 316 #Close button … … 323 323 def _do_layout(self): 324 324 """ 325 325 Draw window content 326 326 """ 327 327 self._define_structure() … … 339 339 def set_values(self): 340 340 """ 341 341 Set value of txtcrtl 342 342 """ 343 343 self.invariant_tcl.SetValue(format_number(self.qstar_container.qstar)) … … 350 350 def get_scale(self, percentage, scale_name='scale'): 351 351 """ 352 352 Check scale receive in this panel. 353 353 """ 354 354 scale = RECTANGLE_SCALE … … 366 366 def set_color_bar(self): 367 367 """ 368 368 Change the color for low and high bar when necessary 369 369 """ 370 370 #warning to the user when the extrapolated invariant is greater than %5 … … 376 376 def on_close(self, event): 377 377 """ 378 378 Close the current window 379 379 """ 380 380 self.Close() … … 382 382 def on_paint(self, event): 383 383 """ 384 384 Draw the chart 385 385 """ 386 386 dc = wx.PaintDC(self.panel_chart) -
invariantview/perspectives/invariant/invariant_panel.py
r3de66c1 rd7a39e5 1 1 """ 2 3 @author: Gervaise B. Alina 2 This module provide GUI for the neutron scattering length density calculator 3 4 4 """ 5 5 … … 47 47 class InvariantPanel(ScrolledPanel): 48 48 """ 49 49 Provides the Invariant GUI. 50 50 """ 51 51 ## Internal nickname for the window, used by the AUI manager … … 81 81 def err_check_on_data(self): 82 82 """ 83 83 Check if data is valid for further computation 84 84 """ 85 85 flag = False … … 98 98 def set_data(self, data): 99 99 """ 100 100 Set the data 101 101 """ 102 102 self._data = data … … 115 115 def set_message(self): 116 116 """ 117 117 Display warning message if available 118 118 """ 119 119 if self.inv_container is not None: … … 133 133 def set_manager(self, manager): 134 134 """ 135 135 set value for the manager 136 136 """ 137 137 self._manager = manager … … 139 139 def get_background(self): 140 140 """ 141 @return the background textcrtl value as a float141 return the background textcrtl value as a float 142 142 """ 143 143 background = self.background_tcl.GetValue().lstrip().rstrip() … … 151 151 def get_scale(self): 152 152 """ 153 @return the scale textcrtl value as a float153 return the scale textcrtl value as a float 154 154 """ 155 155 scale = self.scale_tcl.GetValue().lstrip().rstrip() … … 167 167 def get_contrast(self): 168 168 """ 169 @return the contrast textcrtl value as a float169 return the contrast textcrtl value as a float 170 170 """ 171 171 par_str = self.contrast_tcl.GetValue().strip() … … 189 189 def get_porod_const(self): 190 190 """ 191 @return the porod constant textcrtl value as a float191 return the porod constant textcrtl value as a float 192 192 """ 193 193 par_str = self.porod_constant_tcl.GetValue().strip() … … 304 304 def set_extrapolation_low(self, inv, low_q=False): 305 305 """ 306 @return float value necessary to compute invariant a low q306 return float value necessary to compute invariant a low q 307 307 """ 308 308 #get funtion … … 341 341 def set_extrapolation_high(self, inv, high_q=False): 342 342 """ 343 @return float value necessary to compute invariant a high q343 return float value necessary to compute invariant a high q 344 344 """ 345 345 power_high = None … … 372 372 def display_details(self, event): 373 373 """ 374 374 open another panel for more details on invariant calculation 375 375 """ 376 376 panel = InvariantDetailsPanel(parent=self, … … 382 382 def compute_invariant(self, event=None): 383 383 """ 384 384 compute invariant 385 385 """ 386 386 msg= "" … … 465 465 def reset_panel(self): 466 466 """ 467 467 set the panel at its initial state. 468 468 """ 469 469 self.background_tcl.SetValue(str(BACKGROUND)) … … 491 491 def _reset_output(self): 492 492 """ 493 493 clear outputs textcrtl 494 494 """ 495 495 self.invariant_total_tcl.Clear() … … 504 504 def _define_structure(self): 505 505 """ 506 506 Define main sizers needed for this panel 507 507 """ 508 508 ## Box sizers must be defined first before defining buttons/textctrls (MAC). … … 550 550 def _layout_data_name(self): 551 551 """ 552 552 Draw widgets related to data's name 553 553 """ 554 554 #Sizer hint … … 586 586 def _layout_bkg_scale(self): 587 587 """ 588 588 Draw widgets related to background and scale 589 589 """ 590 590 background_txt = wx.StaticText(self, -1, 'Background : ') … … 605 605 def _layout_contrast_porod(self): 606 606 """ 607 607 Draw widgets related to porod constant and contrast 608 608 """ 609 609 contrast_txt = wx.StaticText(self, -1, 'Contrast : ') … … 627 627 def _enable_fit_power_law_low(self, event=None): 628 628 """ 629 629 Enable and disable the power value editing 630 630 """ 631 631 if self.fix_enable_low.IsEnabled(): … … 637 637 def _enable_low_q_section(self, event=None): 638 638 """ 639 639 Disable or enable some button if the user enable low q extrapolation 640 640 """ 641 641 if self.enable_low_cbox.GetValue(): … … 658 658 def _enable_power_law_low(self, event=None): 659 659 """ 660 660 Enable editing power law section at low q range 661 661 """ 662 662 if self.guinier.GetValue(): … … 672 672 def _layout_extrapolation_low(self): 673 673 """ 674 674 Draw widgets related to extrapolation at low q range 675 675 """ 676 676 self.enable_low_cbox = wx.CheckBox(self, -1, "Enable Extrapolate Low Q") … … 742 742 def _enable_fit_power_law_high(self, event=None): 743 743 """ 744 744 Enable and disable the power value editing 745 745 """ 746 746 if self.fix_enable_high.IsEnabled(): … … 752 752 def _enable_high_q_section(self, event=None): 753 753 """ 754 754 Disable or enable some button if the user enable high q extrapolation 755 755 """ 756 756 if self.enable_high_cbox.GetValue(): … … 771 771 def _layout_extrapolation_high(self): 772 772 """ 773 773 Draw widgets related to extrapolation at high q range 774 774 """ 775 775 self.enable_high_cbox = wx.CheckBox(self, -1, "Enable Extrapolate high-Q") … … 833 833 def _layout_extrapolation(self): 834 834 """ 835 835 Draw widgets related to extrapolation 836 836 """ 837 837 extra_hint = "Extrapolation Maximum Q Range [1/A]: " … … 869 869 def _layout_volume_surface_sizer(self): 870 870 """ 871 871 Draw widgets related to volume and surface 872 872 """ 873 873 unit_volume = '' … … 922 922 def _layout_invariant_sizer(self): 923 923 """ 924 924 Draw widgets related to invariant 925 925 """ 926 926 uncertainty = "+/-" … … 954 954 def _layout_inputs_sizer(self): 955 955 """ 956 956 Draw widgets related to inputs 957 957 """ 958 958 self._layout_bkg_scale() … … 963 963 def _layout_outputs_sizer(self): 964 964 """ 965 965 Draw widgets related to outputs 966 966 """ 967 967 self._layout_volume_surface_sizer() … … 973 973 def _layout_button(self): 974 974 """ 975 975 Do the layout for the button widgets 976 976 """ 977 977 #compute button … … 995 995 def _do_layout(self): 996 996 """ 997 997 Draw window content 998 998 """ 999 999 self._define_structure() … … 1016 1016 1017 1017 class InvariantDialog(wx.Dialog): 1018 """ 1019 """ 1018 1020 def __init__(self, parent=None, id=1,graph=None, 1019 1021 data=None, title="Invariant",base=None): … … 1025 1027 1026 1028 class InvariantWindow(wx.Frame): 1029 """ 1030 """ 1027 1031 def __init__(self, parent=None, id=1,graph=None, 1028 1032 data=None, title="Invariant",base=None): -
invariantview/perspectives/invariant/invariant_widgets.py
r6546e4b rd7a39e5 1 """2 This software was developed by the University of Tennessee as part of the3 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)4 project funded by the US National Science Foundation.5 1 6 See the license text in license.txt7 2 8 copyright 2009, University of Tennessee 9 """ 3 4 ################################################################################ 5 #This software was developed by the University of Tennessee as part of the 6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 7 #project funded by the US National Science Foundation. 8 # 9 #See the license text in license.txt 10 # 11 #copyright 2009, University of Tennessee 12 ################################################################################ 13 14 10 15 import wx 11 16 import os … … 13 18 class InvTextCtrl(wx.TextCtrl): 14 19 """ 15 16 20 Text control for model and fit parameters. 21 Binds the appropriate events for user interactions. 17 22 """ 18 23 def __init__(self, *args, **kwds): … … 30 35 def _on_set_focus(self, event): 31 36 """ 32 Catch when the text control is set in focus to highlight the whole 33 text if necessary 34 @param event: mouse event 37 Catch when the text control is set in focus to highlight the whole 38 text if necessary 39 40 :param event: mouse event 41 35 42 """ 36 43 event.Skip() … … 39 46 def _highlight_text(self, event): 40 47 """ 41 Highlight text of a TextCtrl only of no text has be selected 42 @param event: mouse event 48 Highlight text of a TextCtrl only of no text has be selected 49 50 :param event: mouse event 51 43 52 """ 44 53 # Make sure the mouse event is available to other listeners … … 57 66 class OutputTextCtrl(wx.TextCtrl): 58 67 """ 59 60 61 68 Text control used to display outputs. 69 No editing allowed. The background is 70 grayed out. User can't select text. 62 71 """ 63 72 def __init__(self, *args, **kwds): … … 73 82 def _click(self, event): 74 83 """ 75 76 84 Prevent further handling of the mouse event 85 by not calling Skip(). 77 86 """ 78 87 pass
Note: See TracChangeset
for help on using the changeset viewer.