本文整理汇总了Python中enthought.chaco.api.OverlayPlotContainer.request_redraw方法的典型用法代码示例。如果您正苦于以下问题:Python OverlayPlotContainer.request_redraw方法的具体用法?Python OverlayPlotContainer.request_redraw怎么用?Python OverlayPlotContainer.request_redraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enthought.chaco.api.OverlayPlotContainer
的用法示例。
在下文中一共展示了OverlayPlotContainer.request_redraw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TemplatePicker
# 需要导入模块: from enthought.chaco.api import OverlayPlotContainer [as 别名]
# 或者: from enthought.chaco.api.OverlayPlotContainer import request_redraw [as 别名]
#.........这里部分代码省略.........
@on_trait_change('left, top, tmp_size')
def update_tmp_plot(self):
self.tmp_plotdata.set_data("imagedata",
self.sig.data[self.top:self.top+self.tmp_size,self.left:self.left+self.tmp_size,self.img_idx])
grid_data_source = self.tmp_plot.range2d.sources[0]
grid_data_source.set_data(np.arange(self.tmp_size), np.arange(self.tmp_size))
self.tmp_img_idx=self.img_idx
return
@on_trait_change('left, top, tmp_size')
def update_CC(self):
if self.ShowCC:
self.CC = cv_funcs.xcorr(self.sig.data[self.top:self.top+self.tmp_size,
self.left:self.left+self.tmp_size,self.tmp_img_idx],
self.sig.data[:,:,self.img_idx])
self.img_plotdata.set_data("imagedata",self.CC)
grid_data_source = self.img_plot.range2d.sources[0]
grid_data_source.set_data(np.arange(self.CC.shape[1]),
np.arange(self.CC.shape[0]))
if self.numpeaks_total>0:
self.peaks=[np.array([[0,0,-1]])]
@on_trait_change('cbar_selection:selection')
def update_thresh(self):
try:
thresh=self.cbar_selection.selection
self.thresh=thresh
self.cmap_renderer.color_data.metadata['selections']=thresh
self.thresh_lower=thresh[0]
self.thresh_upper=thresh[1]
#cmap_renderer.color_data.metadata['selection_masks']=self.thresh
self.cmap_renderer.color_data.metadata_changed={'selections':thresh}
self.container.request_redraw()
self.img_container.request_redraw()
except:
pass
@on_trait_change('thresh_upper,thresh_lower')
def manual_thresh_update(self):
self.thresh=[self.thresh_lower,self.thresh_upper]
self.cmap_renderer.color_data.metadata['selections']=self.thresh
self.cmap_renderer.color_data.metadata_changed={'selections':self.thresh}
self.container.request_redraw()
self.img_container.request_redraw()
@on_trait_change('peaks,cbar_selection:selection,img_idx')
def calc_numpeaks(self):
try:
thresh=self.cbar_selection.selection
self.thresh=thresh
except:
thresh=[]
if thresh==[] or thresh==() or thresh==None:
thresh=(0,1)
self.numpeaks_total=int(np.sum([np.sum(np.ma.masked_inside(self.peaks[i][:,2],thresh[0],thresh[1]).mask) for i in xrange(len(self.peaks))]))
try:
self.numpeaks_img=int(np.sum(np.ma.masked_inside(self.peaks[self.img_idx][:,2],thresh[0],thresh[1]).mask))
except:
self.numpeaks_img=0
@on_trait_change('findpeaks')
def locate_peaks(self):
from hyperspy import peak_char as pc
peaks=[]
for idx in xrange(self.numfiles):