Changeset 6d55d81 in sasview for invariantview


Ignore:
Timestamp:
Apr 21, 2010 4:23:01 PM (14 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:
1c271f2
Parents:
d8731ca
Message:

make sure the data is updated when the scale change

Location:
invariantview/perspectives/invariant
Files:
2 edited

Legend:

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

    rf29a433 r6d55d81  
    99""" 
    1010import wx 
    11 from copy import deepcopy 
     11 
    1212from sans.invariant import invariant 
    1313 
     
    163163        id = None 
    164164        if hasattr(item,"id"): 
    165             id = deepcopy(item.id) 
     165            id = item.id 
    166166 
    167167        data = Data1D(x=item.x, y=item.y, dx=None, dy=None) 
     
    171171        data.name = item.name 
    172172        ## allow to highlight data when plotted 
    173         data.interactive = deepcopy(item.interactive) 
     173        data.interactive = item.interactive 
    174174        ## when 2 data have the same id override the 1 st plotted 
    175175        data.id = id 
     
    222222        new_plot.id = self.__data.id + name 
    223223        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=self.__data.name)) 
    224  
    225  
    226          
     224         
     225    def plot_data(self, data): 
     226        """ 
     227            replot the current data if the user enters a new scale or background 
     228        """ 
     229        new_plot = self.copy_data(item=self.__data, dy=self.__data.dy) 
     230        new_plot.x = data.x 
     231        new_plot.y = data.y 
     232        new_plot.dx = data.dx 
     233        new_plot.dy = data.dy 
     234        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=new_plot.name)) 
     235         
  • invariantview/perspectives/invariant/invariant_panel.py

    re3f721e4 r6d55d81  
    1313from invariant_details import InvariantDetailsPanel, InvariantContainer 
    1414from invariant_widgets import OutputTextCtrl, InvTextCtrl 
     15 
    1516# The minimum q-value to be used when extrapolating 
    1617Q_MINIMUM  = 1e-5 
     
    6667        #Data uses for computation 
    6768        self._data = data 
     69        self._scale = SCALE  
     70        self._background = BACKGROUND 
    6871        #container of invariant value 
    6972        self.inv_container = None 
     
    151154            raise ValueError, "Need a background" 
    152155        if check_float(self.scale_tcl): 
     156            if float(scale)<= 0.0: 
     157                self.scale_tcl.SetBackgroundColour("pink") 
     158                self.scale_tcl.Refresh() 
     159                raise ValueError, "Receive invalid value for scale: %s"%(scale) 
    153160            return float(scale) 
    154161        else: 
    155             raise ValueError, "Receive invalid value for background : %s"%(scale) 
     162            raise ValueError, "Receive invalid value for scale : %s"%(scale) 
    156163         
    157164    def get_contrast(self): 
     
    392399        
    393400        #Compute invariant 
     401        bkg_changed = False 
     402        scale_changed = False 
    394403        try: 
    395404            self.get_qstar(inv=inv) 
     405            #if scale_changed or bkg_changed: 
     406            self._manager.plot_data(data=inv.get_data()) 
     407             
    396408        except: 
    397409            msg= "Error occurred computing invariant: %s"%sys.exc_value 
Note: See TracChangeset for help on using the changeset viewer.