-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinspect_variables_intact.py
executable file
·153 lines (125 loc) · 5.4 KB
/
inspect_variables_intact.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
########################################################################################
"""
File allowing the inspection of variables from pickles
"""
########################################################################################
import pickle
import numpy as np
from plot import create_animated_output
# save_directory = 'results/100cells/'
# save_directory = 'results/**_asymmetric_cut/remove_35L_24R/'
# save_directory = 'results/**_intact_embryo/'
# save_directory = 'results/study_calcium/D_50/'
save_directory = 'results/vary_params_2023/standard_intact/'
number_of_cells = 100
########################################################################################
""" Pickle variables """
pickle_directory = save_directory + 'vars/'
t = pickle.load( open(pickle_directory + 't.p','rb') )
a = pickle.load( open(pickle_directory + 'a.p','rb') )
b = pickle.load( open(pickle_directory + 'b.p','rb') )
c = pickle.load( open(pickle_directory + 'c.p','rb') )
v = pickle.load( open(pickle_directory + 'v.p','rb') )
########################################################################################
print("Basic time data")
print(t.shape)
print(t[0],t[-1])
print("")
########################################################################################
print("Basic calcium data")
print(c.shape)
print('calcium min max', np.min(c),np.max(c))
print('calcium cell 0 1 98 99', c[0, -1], c[1, -1], c[98, -1], c[99, -1])
print("")
########################################################################################
print("Rescale time")
time_scaling = int((t.shape[0]-1) / (c.shape[1]-1))
print(time_scaling)
########################################################################################
print("When does calcium come on intact embryo?")
temp_c = 0
t_idx_counter = 0
while temp_c == 0:
temp_c = np.max(c[:,t_idx_counter])
t_idx_counter += 1
print(t_idx_counter, t[t_idx_counter]*time_scaling)
print('')
ca_on_idx = 15
ca_zero_idx = ca_on_idx - 1
########################################################################################
print("When does calcium reach equilibrium intact embryo?")
max_c = np.max(c)
temp_max_c = 0
t_idx_counter = 0
while temp_max_c < max_c:
temp_max_c = np.max(c[:,t_idx_counter])
t_idx_counter += 1
print(t_idx_counter, t[t_idx_counter]*time_scaling)
print('')
# c_idx = 229, t = 0.0229???
# 228 == 229
########################################################################################
# print("When does calcium reach 95percent equilibrium intact embryo?")
max_c = np.max(c)
temp_max_c_95 = 0
t_idx_counter_95 = 0
while temp_max_c_95 < (0.99*max_c):
temp_max_c_95 = np.max(c[:,t_idx_counter_95])
t_idx_counter_95 += 1
# print(t_idx_counter_95, t[t_idx_counter_95]*time_scaling)
# print('')
########################################################################################
print("Verify calcium reached equilibrium")
t_idx = t_idx_counter - 2
print('Time')
print(t_idx, t[t_idx])
print(t_idx+1, t[t_idx+1])
print(t_idx+2, t[t_idx+2])
print('\nCalcium')
print(c[0, t_idx], c[49, t_idx], c[50, t_idx], c[99,t_idx])
print(c[0, t_idx+1], c[49, t_idx+1], c[50, t_idx+1], c[99,t_idx+1])
print(c[0, t_idx+2], c[49, t_idx+2], c[50, t_idx+2], c[99,t_idx+2])
########################################################################################
print("\nHow long to reach equilibrium?")
t_equil = t[int((t_idx_counter-1)*time_scaling) - int(ca_zero_idx*time_scaling)]
t_equil_95 = t[int((t_idx_counter_95-1)*time_scaling) - int(ca_zero_idx*time_scaling)]
print('full', t_equil)
print('95', t_equil_95)
########################################################################################
# print("\nWhat is the rate of increase of calcium")
# # choose random cell
# cell_idx = 25
#
# def get_rate_of_increase(cal, t, cell_idx, t_idx, time_scaling):
# change_cal = cal[cell_idx, t_idx+1] - cal[cell_idx, t_idx]
# change_time = t[int((t_idx+1)*time_scaling)] - t[int(t_idx*time_scaling)]
# return change_cal / change_time
#
# print('rate', get_rate_of_increase(c, t, 25, ca_zero_idx, time_scaling))
# print('rate', get_rate_of_increase(c, t, 25, 50, time_scaling))
# print('rate', get_rate_of_increase(c, t, 25, 100, time_scaling))
# print('rate', get_rate_of_increase(c, t, 25, 150, time_scaling))
# print('rate', get_rate_of_increase(c, t, 25, 200, time_scaling))
########################################################################################
# print("\nHow long does it take for calcium to increase 5%")
#
# def get_increase_10_percent_time(cal, t, cell_idx, t_idx, time_scaling):
# start_cal = cal[cell_idx, t_idx]
# t_inc = 0
# temp_cal = cal[cell_idx, t_idx + t_inc]
# while temp_cal < start_cal*1.05:
# print(start_cal, temp_cal, start_cal*1.05)
# t_inc += 1
# temp_cal = cal[cell_idx, t_idx + t_inc]
# start_time = t[int(t_idx*time_scaling)]
# end_time = t[int((t_idx+t_inc)*time_scaling)]
# return t_idx, start_time, end_time - start_time
#
# print(get_increase_10_percent_time(c, t, 3, 15, time_scaling))
########################################################################################
print("\nTotal calcium in the system at equilibrium")
print(np.sum(c[:,228]))
########################################################################################
print("\nBMP and Vg1 min and max at end")
print("BMP ", b[0, -1], b[49, -1], b[50, -1], b[99,-1])
print("Vg1 ", v[0, -1], v[49, -1], v[50, -1], v[99,-1])