Skip to content

Commit a445bd8

Browse files
committed
cleaned up paper_plots and minor fixes
1 parent 72c6210 commit a445bd8

File tree

8 files changed

+555
-295
lines changed

8 files changed

+555
-295
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
__pycache__
22
.VSCodeCounter
3+
.vscode
34
examples/plots
4-
usr_prefs/
5+
*.egg-info

examples/paper_plots.ipynb

+357-194
Large diffs are not rendered by default.
+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"color_coding": {
3+
"Vd": "#256f25",
4+
"Vs": "#df7c20",
5+
"Vpsd": "#bbce50",
6+
"V_n": [
7+
0.5803921568627451,
8+
0.403921568627451,
9+
0.7411764705882353,
10+
1.0
11+
],
12+
"V_tot": "#ff4d4d",
13+
"V_eff": "#a782c9",
14+
"stim": [
15+
0.4980392156862745,
16+
0.788235294117647,
17+
0.4980392156862745,
18+
1.0
19+
],
20+
"LFS": [
21+
0.7450980392156863,
22+
0.6823529411764706,
23+
0.8313725490196079,
24+
1.0
25+
],
26+
"crosslink": [
27+
0.2196078431372549,
28+
0.4235294117647059,
29+
0.6901960784313725,
30+
1.0
31+
],
32+
"protein": [
33+
1.0,
34+
1.0,
35+
0.6,
36+
1.0
37+
],
38+
"Matsuzaki 2004": "#273914",
39+
"Kasai Noguchi 2015": "#391414"
40+
},
41+
"var": [
42+
[
43+
0.4,
44+
0.4,
45+
0.4
46+
],
47+
[
48+
0.12156862745098039,
49+
0.4666666666666667,
50+
0.7058823529411765
51+
],
52+
[
53+
1.0,
54+
0.4980392156862745,
55+
0.054901960784313725
56+
],
57+
[
58+
0.17254901960784313,
59+
0.6274509803921569,
60+
0.17254901960784313
61+
],
62+
[
63+
0.8392156862745098,
64+
0.15294117647058825,
65+
0.1568627450980392
66+
],
67+
[
68+
0.5803921568627451,
69+
0.403921568627451,
70+
0.7411764705882353
71+
],
72+
[
73+
0.5490196078431373,
74+
0.33725490196078434,
75+
0.29411764705882354
76+
],
77+
[
78+
0.8901960784313725,
79+
0.4666666666666667,
80+
0.7607843137254902
81+
],
82+
[
83+
0.4980392156862745,
84+
0.4980392156862745,
85+
0.4980392156862745
86+
],
87+
[
88+
0.7372549019607844,
89+
0.7411764705882353,
90+
0.13333333333333333
91+
],
92+
[
93+
0.09019607843137255,
94+
0.7450980392156863,
95+
0.8117647058823529
96+
]
97+
],
98+
"event": [
99+
"#bcbd22",
100+
"#17becf",
101+
"#1f77b4",
102+
"#ff7f0e",
103+
"#2ca02c",
104+
"#d62728"
105+
],
106+
"_ordered_quantities": [
107+
"stim",
108+
"LFS",
109+
"crosslink",
110+
"protein"
111+
]
112+
}

examples/required_files/models.py

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def quantity_dependencies(self):
5454
raise AttributeError(f"The following quantity is not defined in the model, but it is needed by the experimental procedure {q}\n"
5555
"Make sure you define all the needed constants before running a simulation")
5656
dependencies = {
57+
# These link the values that each parameter takes when an event occurs
58+
# to the parameter name. Outside of these events, when the parameter is in its standard state,
59+
# the Simulation looks for a param_0 value in the constants used to define the model (for example k_u_0 is defined in required_files/const.py).
60+
# Essentially: when the crosslink event happens, then k_u is changed from k_u_0 to k_u_1, and so on...
5761
"k_u": {"crosslink": self.k_u_1},
5862
"k_b": {"crosslink": self.k_b_1},
5963
"protein": {"protein": 1},
@@ -69,6 +73,7 @@ def quantity_dependencies(self):
6973
return dependencies
7074

7175
def stochastic_variables_dict(self):
76+
# Since we are only really using the deterministic model, this is not needed.
7277
stochastic_variables = {
7378
"nf" : (bd_process,["gamma","mu"])
7479
}
@@ -109,6 +114,8 @@ def V_tot_calc(self,t):
109114
return self.variables.Vd + self.variables.Vs
110115

111116
class MomentumModel(BaseModel):
117+
"""The more convoluted version of the model.
118+
"""
112119
def latex_equations(self):
113120
eq = [r'$\frac{dV_d}{dt} = \mathrm{b}n_f(t) + \left(\frac{V_{e}-V_s-V_d}{\tau_V}\right)\frac{V_d}{V_{d,eq}} + k_uV_s - k_bV_d$',
114121
r'$\frac{dV_s}{dt} = k_bV_d - k_uV_s$',

examples/usr_prefs/user_prefs.json

+57-84
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,112 @@
11
{
22
"color_coding": {
3-
"Vd": "#df7c20",
4-
"Vs": "#bbce50",
5-
"Vpsd": "#a782c9",
3+
"Vd": "#256f25",
4+
"Vs": "#df7c20",
5+
"Vpsd": "#bbce50",
66
"V_n": [
77
0.5803921568627451,
88
0.403921568627451,
99
0.7411764705882353,
1010
1.0
1111
],
12-
"V_tot": [
13-
0.12156862745098039,
14-
0.4666666666666667,
15-
0.7058823529411765,
16-
1.0
17-
],
18-
"Ve": [
19-
0.5490196078431373,
20-
0.33725490196078434,
21-
0.29411764705882354,
22-
1.0
23-
],
12+
"V_tot": "#ff4d4d",
13+
"V_eff": "#a782c9",
2414
"stim": [
25-
0.9411764705882353,
26-
0.00784313725490196,
15+
0.4980392156862745,
16+
0.788235294117647,
2717
0.4980392156862745,
2818
1.0
2919
],
3020
"LFS": [
31-
0.7490196078431373,
32-
0.3568627450980392,
33-
0.09019607843137253,
34-
1.0
35-
],
36-
"xlinkers": [
37-
0.9921568627450981,
38-
0.7529411764705882,
39-
0.5254901960784314,
40-
1.0
41-
],
42-
"protein": [
4321
0.7450980392156863,
4422
0.6823529411764706,
4523
0.8313725490196079,
4624
1.0
4725
],
48-
"sLTP_Matsuzaki": "#273914",
49-
"sLTD_Kasai_Noguchi": "#391414",
50-
"Vpsd_ref": "tab:blue",
51-
"V_tot_ref": "tab:orange",
52-
"V_eff": "#ff4d4d",
5326
"crosslink": [
54-
0.4980392156862745,
55-
0.788235294117647,
56-
0.4980392156862745,
27+
0.2196078431372549,
28+
0.4235294117647059,
29+
0.6901960784313725,
5730
1.0
5831
],
59-
"Matsuzaki 2004": [
32+
"protein": [
6033
1.0,
61-
0.4980392156862745,
62-
0.054901960784313725,
34+
1.0,
35+
0.6,
6336
1.0
6437
],
65-
"Kasai Noguchi 2015": [
38+
"Matsuzaki 2004": "#273914",
39+
"Kasai Noguchi 2015": "#391414"
40+
},
41+
"var": [
42+
[
43+
0.4,
44+
0.4,
45+
0.4
46+
],
47+
[
48+
0.12156862745098039,
49+
0.4666666666666667,
50+
0.7058823529411765
51+
],
52+
[
53+
1.0,
54+
0.4980392156862745,
55+
0.054901960784313725
56+
],
57+
[
6658
0.17254901960784313,
6759
0.6274509803921569,
68-
0.17254901960784313,
69-
1.0
60+
0.17254901960784313
7061
],
71-
"y": "tab:blue",
72-
"g": "tab:orange",
73-
"my_event": "brown"
74-
},
75-
"var": [
7662
[
7763
0.8392156862745098,
7864
0.15294117647058825,
79-
0.1568627450980392,
80-
1.0
65+
0.1568627450980392
66+
],
67+
[
68+
0.5803921568627451,
69+
0.403921568627451,
70+
0.7411764705882353
71+
],
72+
[
73+
0.5490196078431373,
74+
0.33725490196078434,
75+
0.29411764705882354
8176
],
8277
[
8378
0.8901960784313725,
8479
0.4666666666666667,
85-
0.7607843137254902,
86-
1.0
80+
0.7607843137254902
8781
],
8882
[
8983
0.4980392156862745,
9084
0.4980392156862745,
91-
0.4980392156862745,
92-
1.0
85+
0.4980392156862745
9386
],
9487
[
9588
0.7372549019607844,
9689
0.7411764705882353,
97-
0.13333333333333333,
98-
1.0
90+
0.13333333333333333
9991
],
10092
[
10193
0.09019607843137255,
10294
0.7450980392156863,
103-
0.8117647058823529,
104-
1.0
105-
],
106-
[
107-
[
108-
0.9411764705882353,
109-
0.00784313725490196,
110-
0.4980392156862745,
111-
1.0
112-
]
113-
],
114-
"#256f25",
115-
"#273914",
116-
"#391414"
95+
0.8117647058823529
96+
]
11797
],
11898
"event": [
119-
[
120-
0.2196078431372549,
121-
0.4235294117647059,
122-
0.6901960784313725,
123-
1.0
124-
],
125-
[
126-
1.0,
127-
1.0,
128-
0.6,
129-
1.0
130-
]
99+
"#bcbd22",
100+
"#17becf",
101+
"#1f77b4",
102+
"#ff7f0e",
103+
"#2ca02c",
104+
"#d62728"
131105
],
132106
"_ordered_quantities": [
133107
"stim",
134108
"LFS",
135109
"crosslink",
136-
"protein",
137-
"my_event"
110+
"protein"
138111
]
139112
}

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ author = ngr-francesco
77
install_requires=
88
numpy
99
matplotlib
10+
ipykernel
11+
bayesian-optimization
1012
packages = find:
1113
exclude = logo

virtual_lab/colors.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from .settings import prefs
33
from copy import deepcopy
44
from virtual_lab.const import ColorCodingStrategies
5+
import json
56

67
# TODO: the current color scheme is not applicable in the case in which you want to compare models
78
# on the same plot (they would have the same color coding).
@@ -100,22 +101,16 @@ def check_if_run_out_of_colors(self):
100101

101102
def add_default_colors(self, keys, var_type = None):
102103
"""
103-
Add default colors to the color coding.
104+
Add default colors to the color coding. Default colors are applied only to variables that weren't already being tracked.
104105
"""
105106
changed_color_coding = []
106107
if var_type is None:
107108
var_type = "var"
108109
for key in keys:
109-
changed_color = self._set_color(key, self.available_colors[var_type][0], var_type)
110-
if changed_color:
111-
changed_color_coding.append(key)
112-
110+
if not key in self.color_coding:
111+
self._set_color(key, self.available_colors[var_type][0], var_type)
112+
113113

114-
if len(changed_color_coding):
115-
color_coding = '\n'.join(self.color_coding)
116-
msg = f"""Updated color coding to account for {var_type}s: {changed_color_coding}:\n{color_coding}"""
117-
self.logger.diagnostic(msg)
118-
119114
def refresh_available_colors(self):
120115
"""
121116
If we run out of colors, we try to refresh the available colors by checking if any colors from the presets are not being used.

0 commit comments

Comments
 (0)