-
Notifications
You must be signed in to change notification settings - Fork 1
/
Histogram_DV_xy.py
79 lines (54 loc) · 1.72 KB
/
Histogram_DV_xy.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import sys
import os
import math
import numpy as np
sys.path.append('.')
import matplotlib.pyplot as plt
# RUN: python /Users/MariaGabriela/cellmodeller/Scripts/5_jun/Histogram_DV_xy.py /Users/MariaGabriela/cellmodeller/data/ex1_simpleGrowth-17-05-30-20-45/
#Path file
path = sys.argv[1]
def dv_xy(file, Ra, time, path):
#Read file col
file1 = open(file, 'r')
lines = file1.readlines()
x = []
y = []
z = []
for line in lines:
if line[0]==time[0] and line[1]==time[1] and line[2]== time[2]:
line = line.split()
vx = float(line[5])
vy = float(line[6])
vz = float(line[7])
vx1 = float(line[9])
vy1 = float(line[10])
vz1 = float(line[11])
dx = vx-vx1
x.append(dx)
dy = vy-vy1
y.append(dy)
dz = vz-vz1
z.append(dz)
plt.hist(x, bins=100, log = True, alpha=0.5, color='g', label='x')
plt.hist(y, bins=100, log = True, alpha=0.5, color='b', label='y')
plt.legend(loc='upper right')
#plt.hist(z, bins=100, color='b')
plt.title('DVx and DVy Histogram; R = %s, Time = %s' %(Ra, time))
plt.xlabel("DV")
plt.ylabel("Frecuency")
#plt.show()
Ra2 = str(Ra)
Ra2 = Ra2[0]+Ra2[2]
t = time[:3].replace(' ', '')
plt.savefig('%sHistogram_MDV/Histogram_xy_R_%s_t_%s.png' %(path,Ra2,t))
plt.close()
for i in range (0,20):
time = str(i*5+700)
time = time+' '
print time
c = 5
while c <= 6 :
Ra = round(c, 1)
file_velocity = '%sVelocity_%s.txt' %(path,Ra)
dv_xy(file_velocity,Ra, time, path)
c = c+1