Changeset deeba75 in sasview


Ignore:
Timestamp:
Jan 21, 2010 4:42:55 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
91db958
Parents:
76c1727
Message:

add more plot for invariant panel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/invariant_panel.py

    re6b9723 rdeeba75  
    88 
    99from sans.invariant import invariant 
    10 from sans.guiframe.dataFitting import Theory1D 
     10from sans.guiframe.dataFitting import Theory1D, Data1D 
    1111from sans.guiframe.utils import format_number, check_float 
    1212from sans.guicomm.events import NewPlotEvent, StatusEvent 
     
    1616# The maximum q-value to be used when extrapolating 
    1717Q_MAXIMUM  = 10 
     18# the maximum value to plot the theory data 
     19Q_MAXIMUM_PLOT = 2 
    1820# the number of points to consider during fit 
    1921NPTS = 10 
     
    144146                    check_float(self.invariant_low_ctl) 
    145147                    #plot data 
    146                     low_data = inv.get_extra_data_low() 
    147                     self._plot_data(data=low_data, name=self.data.name+" Extra_low_Q") 
     148                    low_out_data, low_in_data = inv.get_extra_data_low() 
     149                    self._plot_theory(data=low_out_data, name=self.data.name+" Extra_low_Q") 
     150                    self._plot_data(data=low_in_data, name=self.data.name+"Fitted data for low_Q") 
    148151                except: 
    149152                    raise 
     
    156159                    check_float(self.invariant_high_ctl) 
    157160                    #plot data 
    158                     high_data = inv.get_extra_data_high() 
    159                     self._plot_data(data=high_data, name=self.data.name+" Extra_high_Q") 
     161                    high_out_data, high_in_data = inv.get_extra_data_high(q_end=Q_MAXIMUM_PLOT) 
     162                    self._plot_theory(data=high_out_data, name=self.data.name+" Extra_high_Q") 
     163                    self._plot_data(data=high_in_data, name=self.data.name+"Fitted data for high_Q") 
    160164                except: 
    161165                    raise 
     
    217221        """ 
    218222        # Create a plottable data 
     223        new_plot = Data1D(x=[], y=[], dx=None, dy=None) 
     224        if data is not None: 
     225            new_plot.copy_from_datainfo(data)  
     226            data.clone_without_data(clone=new_plot)  
     227             
     228        new_plot.name = name 
     229        title = self.data.name 
     230        new_plot.xaxis(self.data._xaxis, self.data._xunit) 
     231        new_plot.yaxis(self.data._yaxis, self.data._yunit) 
     232        new_plot.group_id = self.data.group_id 
     233        new_plot.id = self.data.id + name 
     234        ##post data to plot 
     235        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=title)) 
     236         
     237    def _plot_theory(self, data=None, name="Unknown"): 
     238        """ 
     239            Receive a data and post a NewPlotEvent to parent 
     240            @param data: data created frome xtrapolation to plot 
     241            @param name: Data's name to use for the legend 
     242        """ 
     243        # Create a plottable data 
    219244        new_plot = Theory1D(x=[], y=[], dy=None) 
    220245        if data is not None: 
Note: See TracChangeset for help on using the changeset viewer.