示例#1
0
文件: ucc.py 项目: keflavich/hyperspy
 def toggle_cc_view(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.img_idx],
                                                self.sig.data[:,:,self.img_idx])
         self.img_plotdata.set_data("imagedata",self.CC)
     else:
         self.img_plotdata.set_data("imagedata",self.sig.data[:,:,self.img_idx])
     self.redraw_plots()
示例#2
0
文件: ucc.py 项目: keflavich/hyperspy
 def update_img_depth(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.img_idx],
                                                self.sig.data[:,:,self.img_idx])
         self.img_plotdata.set_data("imagedata",self.CC)
     else:
         self.img_plotdata.set_data("imagedata",self.sig.data[:,:,self.img_idx])
     self.img_plot.title="%s of %s: "%(self.img_idx+1,self.numfiles)+self.titles[self.img_idx]
     self.redraw_plots()        
示例#3
0
文件: ucc.py 项目: keflavich/hyperspy
 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]])]
示例#4
0
文件: ucc.py 项目: keflavich/hyperspy
 def locate_peaks(self):
     from hyperspy import peak_char as pc
     peaks=[]
     for idx in xrange(self.numfiles):
         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[:,:,idx])
         # peak finder needs peaks greater than 1.  Multiply by 255 to scale them.
         pks=pc.two_dim_findpeaks(self.CC*255, peak_width=self.peak_width, medfilt_radius=None)
         pks[:,2]=pks[:,2]/255.
         peaks.append(pks)
     self.peaks=peaks
示例#5
0
文件: ucc.py 项目: Gazworth/hyperspy
 def locate_peaks(self):
     from hyperspy import peak_char as pc
     peaks=[]
     """from hyperspy.misc.progressbar import ProgressBar, \
         Percentage, RotatingMarker, ETA, Bar
     widgets = ['Locating peaks: ', Percentage(), ' ', Bar(marker=RotatingMarker()),
                ' ', ETA()]
     pbar = ProgressBar(widgets=widgets, maxval=100).start()"""
     progress = ProgressDialog(title="Peak finder progress", message="Finding peaks on %s images"%self.numfiles, max=self.numfiles, show_time=True, can_cancel=False)
     progress.open()
     for idx in xrange(self.numfiles):
         #pbar.update(float(idx)/self.numfiles*100)
         self.CC = cv_funcs.xcorr(self.sig.data[self.tmp_img_idx,
                                                self.top:self.top+self.tmp_size,
                                                self.left:self.left+self.tmp_size],
                                            self.sig.data[idx,:,:])
         # peak finder needs peaks greater than 1.  Multiply by 255 to scale them.
         pks=pc.two_dim_findpeaks(self.CC*255, peak_width=self.peak_width, medfilt_radius=None)
         pks[:,2]=pks[:,2]/255.
         peaks.append(pks)
         progress.update(idx+1)
     #pbar.finish()
     self.peaks=peaks
示例#6
0
文件: ucc.py 项目: Gazworth/hyperspy
 def update_CC(self):
     if self.ShowCC:
         self.CC = cv_funcs.xcorr(self.sig.data[self.tmp_img_idx,self.top:self.top+self.tmp_size,
                                                self.left:self.left+self.tmp_size],
                                  self.sig.data[self.img_idx,:,:])
         self.img_plotdata.set_data("imagedata",self.CC)