Changeset f1e06a8e in sasview for invariantview


Ignore:
Timestamp:
Jan 19, 2011 10:13:54 AM (13 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:
890a909b
Parents:
ca4c150
Message:

working on loading data to invariant panel

Location:
invariantview/perspectives/invariant
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • invariantview/perspectives/invariant/invariant.py

    rd65a00a rf1e06a8e  
    2323from sans.guiframe.dataFitting import Data1D 
    2424 
    25 from sans.guicomm.events import NewPlotEvent 
    26 from sans.guicomm.events import ERR_DATA 
    27 from invariant_state import Reader as reader 
     25from sans.guiframe.events import NewPlotEvent 
     26from sans.guiframe.events import ERR_DATA 
     27from .invariant_state import Reader as reader 
    2828from DataLoader.loader import Loader 
    29 from invariant_panel import InvariantPanel 
     29from .invariant_panel import InvariantPanel 
    3030from sans.guicomm.events import EVT_INVSTATE_UPDATE 
    3131 
     
    5757        Show a general help dialog.  
    5858        """ 
    59         from help_panel import  HelpWindow 
     59        from .help_panel import  HelpWindow 
    6060        frame = HelpWindow(None, -1)     
    6161        frame.Show(True) 
     
    144144        data.dy = dy 
    145145        data.name = item.name 
     146        data.title = item.title 
    146147         
    147148        ## allow to highlight data when plotted 
     
    178179                self.compute_helper(data=data) 
    179180                 
     181    def set_data(self, data_list): 
     182        """ 
     183        receive a list of data and compute invariant 
     184        """ 
     185        if len(data_list) > 1: 
     186            msg = "invariant panel does not allow more than one value" 
     187            msg += " at this time" 
     188            raise ValueError, msg 
     189        elif len(data_list) == 1: 
     190            if issubclass(data_list[0].__class__, LoaderData1D): 
     191                self.compute_helper(data_list[0]) 
     192                wx.PostEvent(self.parent, NewPlotEvent(plot=data_list[0], 
     193                                               title=data_list[0].title)) 
     194            else: 
     195                msg = "invariant cannot be computed for" 
     196                msg += " data of type %s" % (data_list[0].__class__.__name__) 
     197                raise ValueError, msg 
     198             
     199             
    180200    def compute_helper(self, data): 
    181201        """ 
     
    189209            # Set the data set to be user for invariant calculation 
    190210            self.invariant_panel.set_data(data=data) 
    191          
     211            
    192212    def save_file(self, filepath, state=None): 
    193213        """ 
     
    282302        new_plot.group_id = self.__data.group_id 
    283303        new_plot.id = self.__data.id + name 
     304        new_plot.title = self.__data.title 
    284305        # Save theory_data in a state 
    285306        if data != None: 
     
    288309                self.invariant_panel.state.theory_lowQ = copy.deepcopy(new_plot) 
    289310            elif name_head[0] == 'High': 
    290                 self.invariant_panel.state.theory_highQ = copy.deepcopy(new_plot) 
     311                self.invariant_panel.state.theory_highQ =copy.deepcopy(new_plot) 
    291312 
    292313        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 
    293                                                title=self.__data.name)) 
     314                                               title=self.__data.title)) 
    294315         
    295316    def plot_data(self, scale, background): 
     
    301322        new_plot.group_id = self.__data.group_id 
    302323        new_plot.id = self.__data.id  
     324        new_plot.title = self.__data.title 
    303325        
    304326        # Save data in a state: but seems to never happen  
     
    306328            self.invariant_panel.state.data = copy.deepcopy(new_plot) 
    307329        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 
    308                                                title=new_plot.name)) 
    309          
     330                                               title=new_plot.title)) 
     331         
  • invariantview/perspectives/invariant/invariant_panel.py

    r6a0cbcf4 rf1e06a8e  
    1212from sans.guiframe.utils import format_number 
    1313from sans.guiframe.utils import check_float 
    14 from sans.guicomm.events import NewPlotEvent, StatusEvent 
    15 from invariant_details import InvariantDetailsPanel 
    16 from invariant_details import InvariantContainer 
    17 from invariant_widgets import OutputTextCtrl 
    18 from invariant_widgets import InvTextCtrl 
    19 from invariant_state import InvariantState as IState 
     14from sans.guiframe.events import StatusEvent 
     15from .invariant_details import InvariantDetailsPanel 
     16from .invariant_details import InvariantContainer 
     17from .invariant_widgets import OutputTextCtrl 
     18from .invariant_widgets import InvTextCtrl 
     19from .invariant_state import InvariantState as IState 
    2020from sans.guiframe.panel_base import PanelBase 
    2121# The minimum q-value to be used when extrapolating 
     
    141141            self.state.data = copy.deepcopy(data) 
    142142            self._reset_state_list() 
     143             
    143144        return True   
    144145     
     
    531532         
    532533        low_q = self.enable_low_cbox.GetValue() 
    533         high_q = self.enable_high_cbox.GetValue()   
     534        high_q = self.enable_high_cbox.GetValue()  
     535        temp_data = copy.deepcopy(self._data) 
     536         
    534537        #set invariant calculator  
    535         inv = invariant.InvariantCalculator(data=self._data, 
     538        inv = invariant.InvariantCalculator(data=temp_data, 
    536539                                            background=background, 
    537540                                            scale=scale) 
     
    618621            wx.PostEvent(self.parent, 
    619622                StatusEvent(status='\nFinished invariant computation...')) 
    620              
     623            
    621624 
    622625    def undo(self,event=None): 
     
    674677        : param event: report button event 
    675678        """ 
    676         from report_dialog import ReportDialog 
     679        from .report_dialog import ReportDialog 
    677680 
    678681        self.state.set_report_string() 
     
    717720            except: 
    718721                pass 
    719            
     722         
    720723        self.compute_invariant(event=None) 
     724        
    721725        # set the input params at the state at pre_state_num 
    722726        for key in current_state: 
Note: See TracChangeset for help on using the changeset viewer.