postprocess.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:OpenSAPM 作者: pathfinder14 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号