-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplotflim.py
executable file
·58 lines (50 loc) · 1.36 KB
/
plotflim.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
from pylab import *
import pylab
from optparse import OptionParser
import sys
import re
import os
import glob
def FileToPlot(filename, outname):
clf()
file = open(filename, 'r')
is_title = False
is_x = False
is_y = False
legende = []
for lines in file:
if(re.match("^#", lines)):
if(not is_title):
title(lines[2:])
is_title = True
else:
if(not is_x):
xlabel(lines[2:])
is_x = True
else:
if(not is_y):
ylabel(lines[2:])
is_y = True
else:
legende.append(lines[2:])
file.close()
data = pylab.loadtxt(filename)
for i in range(1, len(data[0])):
plot(data[:, i], data[:, 0], label=legende[i-1])
xscale("log")
legend()
savefig(outname)
if len(sys.argv) == 1:
print "zut", sys.argv
print "you must define a regular expression to check your files"
sys.exit(1)
files = glob.glob(sys.argv[1])
print files
for i in files:
number = re.findall(r"[0-9]+", i)[0]
nb = number.zfill(5)
FileToPlot(i, "tmp"+nb)
os.system("ffmpeg -r 2 -i tmp%5d.png test.ogv")
os.system("rm tmp[0-9]*.png")
#os.system("ffmpeg -r 10 -b 1800 -i tmp%05d test1800.mp4")