示例#1
0
from test_module import run_exp, multi_exp, update_dict, update_dicts
import module_models as models
import numpy as np
import seaborn as sns
sns.set(context="poster", style="ticks", rc={"lines.linewidth": 4})
import matplotlib
# =============================================================================
# define exp conditions
# =============================================================================
cond1 = [d_il7, d_il2, d_timer]
cond_names = ["K", "IL2", "Timer"]
time = np.arange(0, 20, 0.01)
model = models.th_cell_diff

arr = np.arange(1, 2.05, 0.05)
cond_list = [update_dicts(cond1, val, "n_div") for val in arr]
cond_names2 = ["ndiv" + str(val) for val in arr]

# =============================================================================
# run experiment
# =============================================================================
exp = multi_exp(time, cond_list, cond_names, cond_names2)

norm = matplotlib.colors.Normalize(vmin=np.min(arr), vmax=np.max(arr))

# choose a colormap
cm = matplotlib.cm.Blues

# create a ScalarMappable and initialize a data structure
sm = matplotlib.cm.ScalarMappable(cmap=cm, norm=norm)
sm.set_array([])
示例#2
0
from test_module import run_exp, multi_exp, update_dict, update_dicts
import module_models as models
import numpy as np
import seaborn as sns
sns.set(context="poster", style="ticks", rc={"lines.linewidth": 4})
import matplotlib
# =============================================================================
# define exp conditions
# =============================================================================
cond1 = [d_il7, d_il2, d_timer]
cond_names = ["K", "IL2", "Timer"]
time = np.arange(0, 10, 0.01)
model = models.th_cell_diff

arr = np.arange(1, 2.1, 0.1)
cond_list = [update_dicts(cond1, val, "d_eff") for val in arr]
cond_names2 = ["d_eff" + str(val) for val in arr]

# =============================================================================
# run experiment
# =============================================================================
exp = multi_exp(time, cond_list, cond_names, cond_names2)

norm = matplotlib.colors.Normalize(vmin=np.min(arr), vmax=np.max(arr))

# choose a colormap
cm = matplotlib.cm.Blues

# create a ScalarMappable and initialize a data structure
sm = matplotlib.cm.ScalarMappable(cmap=cm, norm=norm)
sm.set_array([])
示例#3
0
import module_models as models
import numpy as np
import seaborn as sns
sns.set(context = "poster", style = "ticks", rc = {"lines.linewidth": 4})
import matplotlib

# =============================================================================
# define exp conditions
# =============================================================================
cond1 = [d_null, d_il7, d_il2, d_timer]
cond_names = ["Null", "K", "IL2", "Timer"]
time = np.arange(0,20,0.01)
model = models.th_cell_diff

arr = np.arange(10,30.5,0.5)
cond_list = [update_dicts(cond1, val, "beta_p") for val in arr]
cond_names2 = ["betap"+str(val) for val in arr]

# =============================================================================
# run experiment
# =============================================================================
exp = multi_exp(time, cond_list, cond_names, cond_names2)
exp2 = exp.loc[exp["cond2"] == "betap30.0", :]

norm = matplotlib.colors.Normalize(
    vmin=np.min(arr),
    vmax=np.max(arr))

# choose a colormap
cm = matplotlib.cm.Blues
df = fun(arr, pname, guess_arr, cond_list, cond_names)
g = sns.relplot(x="x", y="ylog", data=df, hue="model")

timer_arr = df.y[df.model == "crit_timer"].array
il2_arr = df.y[df.model == "rate_il2"].array
il7_arr = df.y[df.model == "rate_il7"].array

timer_dicts = [update_dict(d_timer, val, "crit_timer") for val in timer_arr]
il2_dicts = [update_dict(d_il2, val, "rate_il2") for val in il2_arr]
il7_dicts = [update_dict(d_il7, val, "rate_il7") for val in il7_arr]

cond_list = [[d1, d2, d3]
             for d1, d2, d3 in zip(timer_dicts, il2_dicts, il7_dicts)]
cond_list = [
    update_dicts(dict_list, val, "beta_p")
    for dict_list, val in zip(cond_list, arr)
]

names = ["crit_timer", "rate_il2", "rate_il7"]
cond_names2 = ["betap" + str(val) for val in arr]

# =============================================================================
# run experiment
# =============================================================================
cond1 = [d_timer, d_il2, d_il7]
cond_names = ["Timer", "IL2", "Carr. Cap."]

time = np.arange(0, 7, 0.01)

exp = multi_exp(time, cond_list, cond_names, cond_names2)