-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransmembrane_test_solution.py
62 lines (39 loc) · 1.42 KB
/
transmembrane_test_solution.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
from transmembrane_lib import *
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import minimize,basinhopping
import dill
from pytexit import py2tex
import pickle
import os
from scipy import interpolate
T0 = 1e-8
sim_t = np.loadtxt( 'PSOPT/build/t.dat' ) * T0
t0 = 0
tstop = sim_t[-1]
dt = 0.000005e-9
t = np.linspace(t0, tstop, int(tstop/dt))
# dt = (t[1] - t[0])
sim_values = np.loadtxt( 'PSOPT/build/u0.dat' )
# u1 = np.loadtxt( 'PSOPT/build/u1.dat' )
# u2 = np.loadtxt( 'PSOPT/build/u2.dat' )
# flinear = interpolate.interp1d(x, sim_values)
fcubic = interpolate.interp1d(sim_t, sim_values, kind='linear')
ideal_values = fcubic(t)
host_cell = Cell(0.3, 80, 0.3, 80, 1e-7, 5, 20e-6, 5e-9, t)
# small_host_cell = Cell(0.3, 80, 0.3, 80, 1e-7, 5, 2.5e-6, 5e-9, t)
# host_cell = small_host_cell
virus = Cell(0.3, 80, 0.005, 30, 1e-8, 60, 50e-9, 14e-9, t)
def normalized_gaussian_pulse(t,fwhm):
sigma = fwhm/2.355
return np.exp(-((t**2.0)/(2.0*(sigma**2.0))))
plt.figure(1)
plt.plot(t, ideal_values)
plt.show()
plt.figure(2)
plt.plot(t, convolve_output(ideal_values, host_cell, dt))
plt.plot(t, convolve_output(ideal_values, virus, dt))
print((np.max(convolve_output(ideal_values, host_cell, dt) * 1e6) - np.min(convolve_output(ideal_values, host_cell, dt) * 1e6))
/(np.max(convolve_output(ideal_values, virus, dt) * 1e6) - np.min(convolve_output(ideal_values, virus, dt) * 1e6)))
plt.show()
#