コード例 #1
0
def pscan2d(sim, prange1, prange2, pname1, pname2, res, rangefun = np.linspace):
    inputs = get_2dinputs(prange1, prange2, res, rangefun)
    outputs = np.zeros(res**2)

    for i, input in enumerate(inputs):
        p1, p2 = input
        sim.params[pname1] = p1
        sim.params[pname2] = p2
        cells, mols = sim.get_cells()
        r = get_max(cells)
        outputs[i] = r

    return outputs
コード例 #2
0
import numpy as np
from src.modules.exp import Sim
from src.tests.parameters import d
from src.models.models import vir_model_gamma
import src.modules.proc as proc
from joblib import Parallel, delayed
import multiprocessing

# init model
vir_model = vir_model_gamma
time = np.arange(0, 40, 0.01)
pname1 = "vir_alpha"
pname2 = "vir_beta"

# init models
sim = Sim(name="il2", params=d, time=time, virus_model=vir_model)

res = 20
inputs = proc.get_2dinputs(prange1=(1, 100), prange2=(0.1, 100), res=res)

n_cor = multiprocessing.cpu_count()
params = [sim, pname1, pname2]
outputs = Parallel(n_jobs=n_cor)(delayed(proc.get_2doutput)(i, *params)
                                 for i in inputs)
out = proc.get_2dscan(outputs)
コード例 #3
0
import src.modules.pl as pl
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
import multiprocessing

# init model
vir_model = vir_model_const
time = np.arange(0, 50, 0.01)
pname1 = "r_chronic"
pname2 = "vir_load"

# init models
sim = Sim(name="il2", params=d, time=time, virus_model=vir_model)

res = 30
inputs = proc.get_2dinputs(prange1=(0, 50), prange2=(0, 1.0), res=res)

#for input in inputs:
#     p1,p2 = input
#sim.params[pname1] = p1
#sim.params[pname2] = p2
#     print(p1,p2)
#cells, molecules = sim.run_sim()
#pl.plot_timecourse(cells, cells = ["teff"])
#plt.show()

n_cor = multiprocessing.cpu_count()
params = [sim, pname1, pname2]
outputs = Parallel(n_jobs=n_cor)(delayed(proc.get_2doutput)(i, *params)
                                 for i in inputs)
#outputs = [proc.get_2doutput(i, *params) for i in inputs]
コード例 #4
0
import multiprocessing

# init model
vir_model = vir_model_gamma
name = "il2"
time = np.arange(0, 50, 0.01)
pname1 = "r_chronic"
pname2 = "vir_beta"

# init models
sim = Sim(name=name, params=d, time=time, virus_model=vir_model)

res = 30
rangefun = np.geomspace
inputs = proc.get_2dinputs(prange1=(0.1, 50),
                           prange2=(0.1, 3.0),
                           res=res,
                           rangefun=rangefun)

n_cor = multiprocessing.cpu_count()
params = [sim, pname1, pname2]
outputs = Parallel(n_jobs=n_cor)(delayed(proc.get_2doutput)(i, *params)
                                 for i in inputs)
#outputs = [proc.get_2doutput(i, *params) for i in inputs]
out = proc.get_2dscan(outputs)

readouts = ["Area", "Peak", "Peaktime"]
df_list = [out]
for r in readouts:
    for df in df_list:
        pl.plot_heatmap(df,
                        "value",
コード例 #5
0
import multiprocessing

# init model
vir_model = vir_model_gamma
name = "il2"
time = np.arange(0, 50, 0.01)
pname1 = "vir_alpha"
pname2 = "vir_beta"

# init models
sim = Sim(name=name, params=d, time=time, virus_model=vir_model)

res = 30
rangefun = np.geomspace
inputs = proc.get_2dinputs(prange1=(1, 13),
                           prange2=(0.1, 10.0),
                           res=res,
                           rangefun=rangefun)

n_cor = multiprocessing.cpu_count()
params = [sim, pname1, pname2]
outputs = Parallel(n_jobs=n_cor)(delayed(proc.get_2doutput)(i, *params)
                                 for i in inputs)
out = proc.get_2dscan(outputs)

readouts = ["Area", "Peak", "Peaktime"]
df_list = [out]
for r in readouts:
    for df in df_list:
        pl.plot_heatmap(df,
                        "value",
                        r,