-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindconfig.py
More file actions
52 lines (40 loc) · 796 Bytes
/
findconfig.py
File metadata and controls
52 lines (40 loc) · 796 Bytes
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
import os, sys
import numpy as np
import matplotlib.pyplot as plt
from configuration import *
from barplot import *
from lineplot import *
from heatmapplot import *
def findconfig(filename):
f = open(filename, "r")
lines = f.readlines()
f.close()
filetype = ""
i = 0
lines_count = len(lines)
while i < lines_count:
l = lines[i].strip()
if l == "":
i += 1
continue
if l[0] == "#":
i += 1
continue
l = l.split(":")
i += 1
k = l[0]
v = l[1]
k = k.strip()
v = v.strip()
if k == "type":
filetype = v
break
if filetype == "barplot":
return BarPlot(filename)
elif filetype == "lineplot":
return LinePlot(filename)
elif filetype == "heatmapplot":
return HeatmapPlot(filename)
else:
print "Unable to recognize the file type."
exit(1)