-
Notifications
You must be signed in to change notification settings - Fork 1
/
Histogram_MDVN.py
65 lines (41 loc) · 1.36 KB
/
Histogram_MDVN.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
import sys
import os
import math
import numpy as np
sys.path.append('.')
import matplotlib.pyplot as plt
# RUN: python /Users/MariaGabriela/cellmodeller/Scripts/Histogram_MDVN.py /Users/MariaGabriela/cellmodeller/data/ex1_simpleGrowth-17-03-27-21-20/
#Path file
path = sys.argv[1]
def dmv(file, Ra, path):
#Read file col
file1 = open(file, 'r')
lines = file1.readlines()
mv = []
for line in lines:
if line[0] != 'T':
line = line.split()
v = [float(line[5]), float(line[6]), float(line[7])]
v = np.asarray(v)
v1 = [float(line[9]), float(line[10]), float(line[11])]
v1 = np.asarray(v1)
u = v - v1
vv1 = np.linalg.norm(v1)
uu = np.linalg.norm(u)
mdvn = uu/vv1
mv.append(mdvn)
plt.hist(mv, log = True, bins=100, color='g')
plt.title('MDVN Histogram; R = %s' %(Ra))
plt.xlabel("MDVN")
plt.ylabel("Frecuency")
#plt.show()
Ra2 = str(Ra)
Ra2 = Ra2[0]+Ra2[2]
plt.savefig('%sHistogram_MDVN/HistogramN_R_%s.png' %(path,Ra2))
plt.close()
c = 0.5
while c <= 2.5 :
Ra = round(c, 1)
file_velocity = '%sVelocity_%s.csv' %(path,Ra)
dmv(file_velocity,Ra, path)
c = c+0.5