Пример #1
0
 def test_num(self):
     position_list = [[10, 10], [30, 20]]
     frames = apt._generate_frames_position_list(position_list, num=16)
     assert len(frames) == 18
     assert frames[0][0:2] == position_list[0]
     assert frames[-1][0:2] == position_list[-1]
     assert frames[0][-1] is True
     assert frames[-1][-1] is True
     for frame in frames[1:-1]:
         assert frame[-1] is False
Пример #2
0
ifig = plt.get_fignums()[0]
fig = plt.figure(ifig)
ax = fig.axes[0]

position_list = [
    [-20, 20],
    [51, 215],
    [90, 215],
    [129, 215],
    [159, 220],
    [170, 215],
    [159, 220],
    [211.5, 215],
    [232, 250],
]
frames = apt._generate_frames_position_list(position_list, num=10)

fig.dpi = 100
fargs = [
    fig,
]
apt._draw_cursor(ax, frames[0][0], frames[0][1])
anim = FuncAnimation(fig,
                     apt._update_frame,
                     frames=frames,
                     fargs=fargs,
                     interval=200,
                     repeat=False)
anim.save(os.path.join(my_path, "atoms_add_remove_gui.gif"), writer='pillow')
plt.close(fig)
Пример #3
0
 def test_longer(self):
     position_list = [[10, 10], [30, 20], [50, 30], [20, 54], [13, 89]]
     frames = apt._generate_frames_position_list(position_list, num=10)
     assert len(frames) == 45