Package topo :: Package tkgui :: Module featurecurvepanel
[hide private]
[frames] | no frames]

Source Code for Module topo.tkgui.featurecurvepanel

 1  """ 
 2  Panels for displaying tuning curves. 
 3   
 4  Uses a PlotGroup to generate the pylab plots  
 5  which are currently displayed separately from the gui. 
 6   
 7  $Id: featurecurvepanel.py 11310 2010-07-27 16:56:14Z ceball $ 
 8  """ 
 9  __version__='$Revision: 11310 $' 
10   
11  import topo 
12   
13  from topo.base.projection import ProjectionSheet 
14   
15  from plotgrouppanel import PlotGroupPanel 
16 17 18 ## CEBALERT: same as for featurecurveplotgroup: shares code with templateplotgrouppanel 19 # Should be changed to inherit from UnitPGPanel, or whatever is created to handle the PlotGroup 20 # hierarchy. 21 -class FeatureCurvePanel(PlotGroupPanel):
22 23 # CEBHACKALERT: to which types of sheet is this plotgroup supposed to be applicable? 24 sheet_type = ProjectionSheet 25 26 @classmethod
27 - def valid_context(cls):
28 if topo.sim.objects(cls.sheet_type).items(): 29 return True 30 else: 31 return False
32 33
34 - def __init__(self,master,plotgroup,**params):
35 PlotGroupPanel.__init__(self,master,plotgroup,**params) 36 37 self.pack_param("sheet",parent=self.control_frame_3, 38 on_modify=self.sheet_change,side='left',expand=1, 39 widget_options={'new_default':True, 40 'sort_fn_args':{'cmp':lambda x, y: cmp(-x.precedence,-y.precedence)}}) 41 42 self.pack_param("x",parent=self.control_frame_4) 43 self.pack_param("y",parent=self.control_frame_4) 44 45 # remove currently irrelevant widgets (plots are drawn in a separate window by pylab) 46 # CEBNOTE: when plots are in this window, remove this line. 47 for name in ['Enlarge','Reduce','Back','Fwd']: self.hide_param(name) 48 49 self.auto_refresh= False 50 if self.plotgroup.plot_immediately: 51 self.refresh() 52 53 self.sheet_change()
54 55 56
57 - def sheet_change(self):
58 s = self.sheet 59 l,b,r,t = s.bounds.lbrt() 60 61 x = self.get_parameter_object('x') 62 y = self.get_parameter_object('y') 63 64 x.bounds=(l,r) 65 y.bounds=(b,t) 66 67 self.x = 0.0 68 self.y = 0.0 69 70 if 'x' and 'y' in self.representations: 71 w1,w2=self.representations['x']['widget'],self.representations['y']['widget'] 72 w1.set_bounds(*x.bounds) 73 w2.set_bounds(*y.bounds) 74 75 w1.tag_set();w2.tag_set()
76 77 78
79 - def setup_plotgroup(self):
82 83
84 - def populate_sheet_param(self):
85 sheets = topo.sim.objects(self.sheet_type).values() 86 self.plotgroup.params()['sheet'].objects = sheets 87 self.plotgroup.sheet = sheets[0] # CB: necessary?
88
89 - def _plot_title(self):
90 return self.plotgroup.name+' at time ' + topo.sim.timestr(self.plotgroup.time)
91 92
93 - def display_labels(self):
94 """Plots are displayed in new windows, so do not add any labels.""" 95 pass
96