Changeset 6ffa0dd in sasview for src/sas/sasgui


Ignore:
Timestamp:
Aug 22, 2016 11:17:33 AM (8 years ago)
Author:
lewis
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
338d6ff
Parents:
a3ed157
Message:

Plot entire extrapolation

Location:
src/sas/sasgui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/events.py

    rd85c194 r6ffa0dd  
    88# plot Qrange 
    99(PlotQrangeEvent, EVT_PLOT_QRANGE) = wx.lib.newevent.NewEvent() 
     10# set plot limits 
     11(PlotLimitEvent, EVT_PLOT_LIM) = wx.lib.newevent.NewEvent() 
    1012# print the messages on statusbar 
    1113(StatusEvent,  EVT_STATUS)   = wx.lib.newevent.NewEvent() 
    12 #create a panel slicer  
     14#create a panel slicer 
    1315(SlicerPanelEvent, EVT_SLICER_PANEL)   = wx.lib.newevent.NewEvent() 
    14 #print update paramaters for panel slicer  
     16#print update paramaters for panel slicer 
    1517(SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE)   = wx.lib.newevent.NewEvent() 
    16 #update the slicer from the panel  
     18#update the slicer from the panel 
    1719(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent() 
    1820#slicer event 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py

    rd85c194 r6ffa0dd  
    1616from sas.sasgui.guiframe.events import EVT_NEW_PLOT 
    1717from sas.sasgui.guiframe.events import EVT_PLOT_QRANGE 
     18from sas.sasgui.guiframe.events import EVT_PLOT_LIM 
    1819from sas.sasgui.guiframe.events import DeletePlotPanelEvent 
    1920from sas.sasgui.guiframe.plugin_base import PluginBase 
     
    7980        self.parent.Bind(EVT_NEW_PLOT, self._on_plot_event) 
    8081        self.parent.Bind(EVT_PLOT_QRANGE, self._on_plot_qrange) 
     82        self.parent.Bind(EVT_PLOT_LIM, self._on_plot_lim) 
    8183        # We have no initial panels for this plug-in 
    8284        return [] 
     
    9597            return 
    9698        panel.on_plot_qrange(event) 
     99 
     100    def _on_plot_lim(self, event=None): 
     101        if event == None: 
     102            return 
     103        if event.id in self.plot_panels.keys(): 
     104            panel = self.plot_panels[event.id] 
     105        elif event.group_id in self.plot_panels.keys(): 
     106            panel = self.plot_panels[event.group_id] 
     107        else: 
     108            return 
     109        if hasattr(event, 'xlim'): 
     110            panel.subplot.set_xlim(event.xlim) 
     111        if hasattr(event, 'ylim'): 
     112            panel.subplot.set_ylim(event.ylim) 
     113 
    97114 
    98115    def _on_show_panel(self, event): 
     
    312329                new_panel = self.create_2d_panel(data, group_id) 
    313330            self.create_panel_helper(new_panel, data, group_id, title) 
     331            if hasattr(event, 'xlim'): 
     332                new_panel.subplot.set_xlim(event.xlim) 
     333            if hasattr(event, 'ylim'): 
     334                new_panel.subplot.set_ylim(event.ylim) 
    314335        return 
  • src/sas/sasgui/perspectives/corfunc/corfunc.py

    r6f343e3 r6ffa0dd  
    1010from sas.sasgui.guiframe.events import StatusEvent 
    1111from sas.sasgui.guiframe.events import NewPlotEvent 
     12from sas.sasgui.guiframe.events import PlotLimitEvent 
    1213from sas.sasgui.guiframe.gui_style import GUIFRAME_ID 
    1314from sas.sasgui.perspectives.corfunc.corfunc_panel import CorfuncPanel 
     
    186187            wx.CallAfter(self.corfunc_panel.plot_qrange, active=active_ctrl, 
    187188                leftdown=True) 
     189        if label == IQ_EXTRAPOLATED_DATA_LABEL: 
     190            xlim = (min(self.corfunc_panel._extrapolated_data.x), self.corfunc_panel.qmax[1]*1.2) 
     191            wx.CallAfter(wx.PostEvent, self.parent, PlotLimitEvent(id=IQ_DATA_LABEL, group_id=GROUP_ID_IQ_DATA, xlim=xlim)) 
    188192 
    189193    def clear_data(self): 
  • src/sas/sasgui/perspectives/corfunc/corfunc_panel.py

    ra3ed157 r6ffa0dd  
    217217            self._transform_btn.Disable() 
    218218            return 
    219         # TODO: Find way to set xlim and ylim so full range of data can be 
    220         # plotted but zoomed in 
    221         maxq = self._data.x.max() 
    222         mask = self._extrapolated_data.x <= maxq 
    223         numpts = len(self._extrapolated_data.x[mask]) + 250 
    224         plot_x = self._extrapolated_data.x[0:numpts] 
    225         plot_y = self._extrapolated_data.y[0:numpts] 
    226         to_plot = Data1D(plot_x, plot_y) 
    227         self._manager.show_data(to_plot, IQ_EXTRAPOLATED_DATA_LABEL) 
     219        self._manager.show_data(self._extrapolated_data, IQ_EXTRAPOLATED_DATA_LABEL) 
    228220        # Update state of the GUI 
    229221        self._transform_btn.Enable() 
Note: See TracChangeset for help on using the changeset viewer.