forked from dbratcher/MediaKhan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.py
32 lines (24 loc) · 1019 Bytes
/
graph.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
import matplotlib.pyplot as plt
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-e", type="int", dest="exp_num")
parser.add_option("-f", type="int", dest="func_num")
(option, args) = parser.parse_args()
i = args[0]
frame = i.split('i')
x = filter(lambda x: x != 'null' and x != '', frame[0].split(' '))
y = filter(lambda x: x != 'null' and x != '', frame[1].split(' '))
im1 = list(range(len(x)+1))[1:]
basepath = '/net/hu21/agangil3/experiments/'
def Plot():
#image_path = '/net/hu21/agangil3/MediaKhan/khan' + '_experiment_id_' + str(option.attr_num)
image_path = basepath + 'experiment_' + str(option.exp_num) +'_graph'
plt.plot(im1, x, 'b-', im1, y, 'r-')
plt.savefig(image_path)
def Stats():
f = open(basepath + 'experiment_' + str(option.exp_num) + '_stats.txt', 'w+')
f.write( 'Max Frame1 Intensity: ' + str(max(x)) + '\n'
+ 'Max Frame2 Intensity: ' + str(max(y)) + '\n')
f.close()
attr = {1: Plot, 2: Stats}
attr[option.func_num]()