def draw1DMovie(solution, t_filming_step, x_start, x_end, legend, t_grid_step):
#??????? ????? ?? ?????????? img\ ????? ????????? ????????.
files = glob.glob('img' + os.sep + '*')
for f in files:
os.remove(f)
#???????? ????????? ?????? ?? ??????? ? ?????.
for i in range(0, solution.shape[0], t_filming_step):
draw1DSlice(solution[i], i * t_grid_step, x_start, x_end, legend, np.max(solution))
#?????? ????? ?? ??????????? ????? img\, ????????? ?? ???? ??.
images = []
filenames = sorted(fn for fn in os.listdir(path='img' + os.sep) if fn.endswith('.png'))
for filename in filenames:
images.append(imageio.imread('img' + os.sep + filename))
imageio.mimsave('img' + os.sep + 'movie.gif', images, duration = 0.1)
评论列表
文章目录