-
Notifications
You must be signed in to change notification settings - Fork 0
/
membfig.py
executable file
·106 lines (84 loc) · 3 KB
/
membfig.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
#!/bin/env python
"""
@description: Performs a 1D Langevin dynamics simulation to validate the results
of the milestoning pemreability derivation
@authors: Christopher T. Lee (ctlee@ucsd.edu)
@copyright Amaro Lab 2015. All rights reserved.
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import plottools
##################################
# Figure 2: Brute Force Scheme
##################################
fig = plt.figure(1, facecolor='white', figsize=(7, 5.6))
ax1 = fig.add_subplot(111)
a = 2
b = 8
x = [0,a,b,10]
y = [1,1,0,0]
ax1.plot(x, y, lw=3, color='r')
ax1.axvline(x=a, lw=2, color='k', linestyle='--')
ax1.axvline(x=b, lw=2, color='k', linestyle='--')
ax1.set_ylabel(r'Concentration [$u(z)$]')
ax1.set_xlabel(r'Position [$z$]')
ylabels = [0, r'$u_0$']
plt.yticks([0,1], ylabels)
xlabels = [0, 'b', 'a']
plt.xticks([0,a,b], xlabels)
ax1.text(0.25,0.75, 'Donor Compartment', rotation='vertical', )
ax1.text(9.5,0.76, 'Acceptor Compartment', rotation='vertical', )
ax1.margins(0,0.05)
plt.savefig('figures/ISDplot.png', dpi=300, transparent=True)
##################################
# Figure 2: PCBP Scheme
##################################
fig = plt.figure(2, facecolor='white', figsize=(7, 5.6))
ax1 = fig.add_subplot(111)
# Set boundaries of regions
q = 1.5
b = 5
a = 10
# Red lines for the concentrations
x = [0,q,b]
y = [1,0.95,0]
ax1.plot(x, y, lw=3, color='r')
# Vertical dotted separating regions
ax1.axvline(x=0, lw=2, color='k', linestyle='--')
ax1.axvline(x=q, lw=2, color='k', linestyle='--')
ax1.axvline(x=a, lw=2, color='k', linestyle='--')
ax1.axvline(x=b, lw=2, color='k', linestyle='--')
for i in xrange(a,b,1):
ax1.axvline(x=i, lw=0.5, color='k', linestyle='--')
# Setting x, y-labels
ax1.set_ylabel(r'Concentration [$u(z)$]')
ax1.set_xlabel(r'Position [$z$]')
ylabels = [0, r'$u_0$']
plt.yticks([0,1], ylabels)
xlabels = [0, 'q', 'b', 'a']
plt.xticks([0,q,b,a], xlabels)
ax1.set_ylim([0,2])
ax1.margins(0.05,0.05)
# Text labels of features
ax1.text(-0.4,1.5, 'Donor Compartment', rotation='vertical', )
ax1.text(10.1,1.55, 'Acceptor Compartment', rotation='vertical', )
ax1.text(0.5,1.15, r'$J_1$')
ax1.arrow(0.1, 1.1, 1.2, 0, head_length=0.1, head_width=0.05,
width=0.015, facecolor='green')
ax1.text(3,0.65, r'$J_2$')
ax1.arrow(1.7, 0.6, 3, 0, head_length=0.15, head_width=0.06,
width=0.02, facecolor='green')
ax1.text(7.5, 1.05, r'$\mathbf{\rho}$', fontsize=20, color='blue',
bbox=dict(facecolor='white', alpha=0.85,
joinstyle='round', linewidth=0))
ax1.arrow(5.2, 0.95, 4.6, 0, head_length=0.1, head_width=0.05,
width=0.015, facecolor='blue')
ax1.text(2.9, 1.05, r'$\mathbf{1-\rho}$', fontsize=20, color='blue')
ax1.arrow(4.8, 0.95, -3.1, 0, head_length=0.1, head_width=0.05,
width=0.015, facecolor='blue')
ax1.text(0.35,0.875, r'$u_1(z)$', color='red')
ax1.text(2.7,0.35, r'$u_2(z)$', color='red')
ax1.text(6.75,0.05, r'Milestones')
plt.savefig('figures/probplot.png', dpi=300, transparent=True)
plt.show()