3def parse_file_contents(file_content,file_name):
4
5 x_values = []
6 y_values = []
7 title = ""
8
9
10 lines = file_content.strip().
split(
'\n')
11
12
13 for line in lines:
14 if line.strip().startswith("join"):
15 if title == "":
16 continue
17 print(
"saving plot "+title)
18 new_x = range(len(x_values))
19 new_x = [i/(len(x_values)-1) for i in new_x]
20 plt.plot(x_values,y_values,"o-")
21 plt.plot(new_x,y_values,"o-")
22 plt.title(title)
23 plt.savefig(title+".png",format="png")
24 plt.close()
25 x_values = []
26 y_values = []
27 title = ""
28 if line.strip().startswith("title"):
29 title = line.split('"')[1]
30 title = title.split()
31 title = file_name+"_dim"+title[1]
33
34
35 values = line.split()
36 if title == "":
37 continue
38
39 if len(values) == 2 and all(is_float(v) for v in values):
40
41 x_values.append(float(values[0]))
42 y_values.append(float(values[1]))
43
44
45
46
void print(char *figname, TCanvas *c1)
std::vector< std::string > split(const std::string &s, const std::string &t=":")