ocsr_viz.py 706 Bytes
Newer Older
Fabien Grzeskowiak's avatar
Fabien Grzeskowiak committed
1 2
import pandas as pd
import os
3
import matplotlib
Fabien Grzeskowiak's avatar
Fabien Grzeskowiak committed
4 5
import matplotlib.pyplot as plt
import matplotlib.animation as anim
6 7 8
import random as rd

matplotlib.use('Agg')
Fabien Grzeskowiak's avatar
Fabien Grzeskowiak committed
9 10 11 12 13

files = os.listdir("./output")

df_ref = pd.read_csv("./output/"+files[0])

14
os.system("mkdir tmp")
Fabien Grzeskowiak's avatar
Fabien Grzeskowiak committed
15

16 17 18 19 20 21 22 23 24 25 26
for i in range(0,df_ref.shape[0]):
    fig = plt.figure()
    ax1 = fig.add_subplot(1,1,1)
    axes = plt.gca()
    axes.set_xlim([-20 ,20])
    axes.set_ylim([-10,10])
    for name in files:
        df = pd.read_csv("./output/"+name)
        ax1.scatter(df.iloc[i][1],df.iloc[i][2])
    fig.savefig("tmp/test_{}.png".format(i))
    plt.close(fig)
Fabien Grzeskowiak's avatar
Fabien Grzeskowiak committed
27

28 29
os.system("ffmpeg -r 30 -i tmp/test_%01d.png -vcodec mpeg4 -y visual.mp4")
os.system("rm -r tmp")