示例#1
0
def basics_tests():
    assert temp_dim.dimension != temp_s.dimension
    assert temp_s.name == "temp_s"
    temp_d.name = "TEST NAME"
    assert temp_d.name == "TEST NAME"
    assert np.array_equal(temp_d.points,[[1,2], [3,3], [5,6], [10,10]])
    assert np.array_equal(temp_s.points, [[1,2], [5,6]])
    assert np.array_equal([1.6, 1.8], image_template.group_centroid(
        [temp_d1, temp_nw, temp_s]))
示例#2
0
 def recenter_axes_on_selected(self):
     ax = self.ui.matplot.canvas.ax
     cur_xlim = ax.get_xlim()
     cur_ylim = ax.get_ylim()
     cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5
     cur_yrange = (cur_ylim[1] - cur_ylim[0])*.5
     templates = [self.current_page.templates[i] for i in self.selected_strokes]
     centroid = group_centroid(templates)
     xdata = centroid[0]
     ydata = centroid[1]
     # set new limits
     new_xlim = [xdata - cur_xrange,
                 xdata + cur_xrange]
     new_ylim = [ydata - cur_yrange,
                 ydata + cur_yrange]
     ax.set_xlim(new_xlim)
     ax.set_ylim(new_ylim)
     self.ui.matplot.canvas.draw() # force re-draw