Changeset 52b1f77 in sasview for guitools/plottables.py


Ignore:
Timestamp:
Apr 1, 2008 2:27:52 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:
f79b054
Parents:
8e4516f
Message:

plotpanel modified…trouble to load dx…dy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guitools/plottables.py

    r8e4516f r52b1f77  
    199199         
    200200        return labels 
     201     
    201202    def returnPlottable(self): 
    202203        return self.plottables 
     
    335336    def __init__(self): 
    336337        self.view = View() 
     338    def set_View(self,x,y): 
     339        self.x= x 
     340        self.y = y 
     341        self.dx= x 
     342        self.dy = y 
     343        self.reset_view() 
     344         
     345    def reset_view(self): 
     346        self.view = self.View(self.x, self.y, self.dx, self.dy) 
    337347     
    338348    def render(self,plot): 
     
    344354        that it makes sense. 
    345355        """ 
    346          
     356        
    347357        plot.xaxis(self._xaxis, self._xunit) 
    348358        plot.yaxis(self._yaxis, self._yunit) 
     
    400410            for i in range(len(x)): 
    401411                 self.x[i] = func(x[i]) 
     412            for i in range(len(dx)): 
    402413                 self.dx[i] = errfunc(dx[i]) 
    403414                           
     
    416427                raise ValueError, "Plottable.View: Given y and dy are not of the same length" 
    417428             
    418             self.y  = deepcopy(y) 
    419             self.dy = deepcopy(dy) 
     429            self.y  = copy.deepcopy(y) 
     430            self.dy = copy.deepcopy(dy) 
    420431             
    421432            for i in range(len(y)): 
    422433                 self.y[i] = func(y[i]) 
     434            for i in range(len(dy)): 
    423435                 self.dy[i] = errfunc(dy[i]) 
    424                   
    425              
    426  
     436      
    427437class Data1D(Plottable): 
    428438    """Data plottable: scatter plot of x,y with errors in x and y. 
     
    444454         
    445455        self.view = self.View(self.x, self.y, self.dx, self.dy) 
    446  
     456         
    447457    def render(self,plot,**kw): 
    448458        plot.points(self.view.x,self.view.y,dx=self.view.dx,dy=self.view.dy,**kw) 
    449  
     459    
    450460    def changed(self): 
    451461        return False 
     
    524534    graph.add(Theory1D(x,y,dy=dy)) 
    525535 
    526     return graph 
     536    return graph  
    527537 
    528538def demo_plotter(graph): 
Note: See TracChangeset for help on using the changeset viewer.