예제 #1
0
    def onrelease(self, event):
        '''Select the button-up position, and zoom in on the selected range'''

        if self.button == True:  # only for left mouse clicks
            self._stop = (event.x, event.y, event.xdata, event.ydata)
            self.button = False

            # Only zoom in if a "reasonably" large area has been selected
            curDist = dist(np.r_[self._start[:2]], np.r_[self._stop[:2]])

            if dist(np.r_[self._start[:2]],
                    np.r_[self._stop[:2]]) > self.epsilon:
                # Zoom in
                for ii in range(self.numData):
                    self.axs[ii].set_xlim([
                        min(self._start[2], self._stop[2]),
                        max(self._start[2], self._stop[2])
                    ])
                    self.axs[ii].set_ylim([
                        min(self._start[3], self._stop[3]),
                        max(self._start[3], self._stop[3])
                    ])

                xLim = self.axs[0].get_xlim()
                self.xRange = np.diff(xLim)[0]
                self.sliderMax = self.range[1] - self.xRange
                self.scale.set(xLim[0] / self.sliderMax)

                (x, y) = ([0, 0], [0, 0])
                for ii in range(self.numData):
                    self.rects[ii].set_xdata([x[0], x[1], x[1], x[0], x[0]])
                    self.rects[ii].set_ydata([y[0], y[0], y[1], y[1], y[0]])

                self.canvas.draw()
예제 #2
0
 def onrelease(self, event):
     '''Select the button-up position, and zoom in on the selected range'''
     
     if self.button == True: # only for left mouse clicks
         self._stop = (event.x, event.y, event.xdata, event.ydata)
         self.button = False
         
         # Only zoom in if a "reasonably" large area has been selected
         curDist = dist(np.r_[self._start[:2]], np.r_[self._stop[:2]])
         
         if dist(np.r_[self._start[:2]], np.r_[self._stop[:2]]) > self.epsilon:
             # Zoom in
             for ii in range(self.numData):
                 self.axs[ii].set_xlim([min(self._start[2], self._stop[2]), max(self._start[2], self._stop[2])])
                 self.axs[ii].set_ylim([min(self._start[3], self._stop[3]), max(self._start[3], self._stop[3])])
             
             xLim = self.axs[0].get_xlim()
             self.xRange = np.diff(xLim)[0]
             self.sliderMax = self.range[1]-self.xRange
             self.scale.set(xLim[0]/self.sliderMax)
             
             (x,y) = ([0,0], [0,0])
             for ii in range(self.numData):
                 self.rects[ii].set_xdata([x[0],x[1],x[1],x[0],x[0]])
                 self.rects[ii].set_ydata([y[0],y[0],y[1],y[1],y[0]])
             
             self.canvas.draw()
예제 #3
0
파일: clusterCURE.py 프로젝트: adsar/repo01
def min_dist(point, ps, k):
    mind = 0
    first = True
    for j in ps.keys():
        if dist(point[k], ps[j]) < mind or first:
            mind = dist(point[k], ps[j])
            first = False
    return mind
예제 #4
0
파일: clusterCURE.py 프로젝트: adsar/repo01
def main():
    point = {}
    point['x'] = np.array([0,0])
    point['y'] = np.array([10,10])
    point['a'] = np.array([1,6])
    point['b'] = np.array([3,7])
    point['c'] = np.array([4,3])
    point['d'] = np.array([7,7])
    point['e'] = np.array([8,2])
    point['f'] = np.array([9,5])
    
    print point
    
    print dist(point['x'], point['y'])
    

    ps = {}
    ps['x'] = point['x']
    ps['y'] = point['y']
    
    assign_CURE(point, ps, 6)        

    print ps
예제 #5
0
 def inside(p):
     pcirc = array([p.center[0], p.center[1]])
     return dist(pclicked, pcirc) < p.radius