Newer
Older
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
59
60
61
62
63
64
65
66
67
68
69
#coding=utf8
########################################################################
### ###
### Created by Martin Genet, 2016 ###
### ###
### École Polytechnique, Palaiseau, France ###
### ###
########################################################################
import math
import numpy
import os
import sys
########################################################################
def plot_displacement_error(
working_folder,
working_basenames,
suffix="",
verbose=1):
n_frames = len(open(working_folder+"/"+working_basenames[0]+"-error.dat").readlines())-1
#print "n_frames = " + str(n_frames)
plotfile = open("plot_displacement_error"+("-"+suffix)*(suffix!="")+".plt", "w")
plotfile.write('''\
set terminal pdf enhanced size 5,3
set output "plot_displacement_error'''+('''-'''+suffix)*(suffix!="")+'''.pdf"
load "Set1.plt"
set linestyle 1 pointtype 1
set linestyle 2 pointtype 1
set linestyle 3 pointtype 1
set linestyle 4 pointtype 1
set linestyle 5 pointtype 1
set linestyle 6 pointtype 1
set linestyle 7 pointtype 1
set linestyle 8 pointtype 1
set linestyle 9 pointtype 1
set key box textcolor variable width +0
set grid
''')
plotfile.write('''\
set xlabel "frame number"
set xrange [0:'''+str(n_frames-1)+''']
set ylabel "displacement error (%)"
set yrange [0:*]
''')
for k_basename in range(len(working_basenames)):
working_basename = working_basenames[k_basename]
plotfile.write('''\
'''+(k_basename==0)*('''plot ''')+(k_basename>0)*(''' ''')+'''"'''+working_folder+'''/'''+working_basename+'''-error.dat" using ($1):(100*$4) with lines linestyle '''+str(k_basename+1)+''' linewidth 5 title "'''+working_basename+'''"'''+(k_basename<len(working_basenames)-1)*(''',\\
''')+(k_basename==len(working_basenames)-1)*('''
'''))
plotfile.close()
os.system("gnuplot plot_displacement_error"+("-"+suffix)*(suffix!="")+".plt")