Changeset 6cfe703 in sasview for guitools


Ignore:
Timestamp:
Mar 31, 2008 2:45:13 PM (17 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:
e40b651
Parents:
6b8399b
Message:

fixing X(2)

Location:
guitools
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • guitools/plottables.py

    r057210c r6cfe703  
    199199         
    200200        return labels 
     201    def returnPlottable(self): 
     202        return self.plottables 
    201203 
    202204    def render(self,plot): 
     
    332334 
    333335    def __init__(self): 
    334         pass 
     336        self.view = View() 
    335337     
    336338    def render(self,plot): 
     
    342344        that it makes sense. 
    343345        """ 
    344         plot.xaxis(self._xaxis, self._xunit) 
    345         plot.yaxis(self._yaxis, self._yunit) 
     346        self.view.render() 
     347        #plot.xaxis(self._xaxis, self._xunit) 
     348        #plot.yaxis(self._yaxis, self._yunit) 
    346349         
    347350    def colors(self): 
    348351        """Return the number of colors need to render the object""" 
    349352        return 1 
     353     
     354    def transform_x(self, func, errfunc): 
     355        """ 
     356            @param func: reference to x transformation function 
     357             
     358        """ 
     359        self.view.transform_x(func, errfunc, self.x, self.dx) 
     360     
     361    def transform_y(self, func, errfunc): 
     362        """ 
     363            @param func: reference to y transformation function 
     364             
     365        """ 
     366        self.view.transform_y(func, errfunc, self.y, self.dy) 
    350367     
    351368    class View: 
     
    378395                raise ValueError, "Plottable.View: Given x and dx are not of the same length" 
    379396             
    380             self.x  = deepcopy(x) 
    381             self.dx = deepcopy(dx) 
     397            self.x  = copy.deepcopy(x) 
     398            self.dx = copy.deepcopy(dx) 
    382399             
    383400            for i in range(len(x)): 
    384401                 self.x[i] = func(x[i]) 
    385402                 self.dx[i] = errfunc(dx[i]) 
    386                        
     403                           
    387404        def transform_y(self, func, errfunc, y, dy): 
    388405            """ 
     
    405422                 self.y[i] = func(y[i]) 
    406423                 self.dy[i] = errfunc(dy[i]) 
    407                        
    408          
     424        def render(self,plot): 
     425            """The base class makes sure the correct units are being used for 
     426            subsequent plottable.   
     427             
     428            For now it is assumed that the graphs are commensurate, and if you  
     429            put a Qx object on a Temperature graph then you had better hope  
     430            that it makes sense. 
     431            """ 
     432            plot.xaxis(self._xaxis, self._xunit) 
     433            plot.yaxis(self._yaxis, self._yunit) 
     434                           
     435             
    409436 
    410437class Data1D(Plottable): 
Note: See TracChangeset for help on using the changeset viewer.