Ejemplo n.º 1
0
    """
    mean = np.log(parameter_ic.value)
    cv = cv
    if parameter_ic.name == 'C3_0':
        cv = 0.282
    elif parameter_ic.name == 'XIAP_0' or parameter_ic == 'Bid_0':
        cv = 0.288
    elif parameter_ic.name == 'Bax_0':
        cv = 0.271
    else:
        parameter_ic.name == 'Bcl2_0'

    sd = cv
    return lognormal(mean, sd, size)

parameters_ic = {idx: p for idx, p in enumerate(model.parameters) if p in model.parameters_initial_conditions()[1:]}

samples = 10

f = open('/home/oscar/Documents/tropical_project/parameters_5000/pars_embedded_5400.txt')
data = csv.reader(f)
parames = [float(i[1]) for i in data]
# parames[0] = 10

param_values = np.array(parames).reshape(1, len(parames))
repeated_parameter_values = np.repeat(param_values, samples, axis=0)

for idx, par in parameters_ic.items():
    repeated_parameter_values[:, idx] = sample_lognormal(par, size=samples)

tspan = np.linspace(0, 20000, 100)
# # extracted with a slice expression instead of requiring interpolation.
# tspan = np.linspace(0.0, exp_data['Time'][-1], (ntimes-1) * tmul + 1)
# #tspan = np.linspace(exp_data['Time'][0], exp_data['Time'][-1],
# #                   (ntimes-1) * tmul + 1)

tspan = exp_data['Time']


# Initialize solver object
#solver = Solver(model, tspan, integrator='lsoda', rtol=1e-5, atol=1e-5, nsteps=20000)
solver = Solver(model, tspan, integrator='vode', with_jacobian=True, atol=1e-5, rtol=1e-5, nsteps=20000)


# Determine IDs for rate parameters, original values for all parameters to overlay, and reference values for scaling.

k_ids = [i for i,p in enumerate(model.parameters) if p in model.parameters_initial_conditions()]
#k_ids_names = [p for i,p in enumerate(model.parameters) if p in model.parameters_rules()]
k_ids_names = [p for i,p in enumerate(model.parameters) if p in model.parameters_initial_conditions()]
par_vals = np.array([p.value for p in model.parameters])

ref = np.array([p.value for p in model.parameters_initial_conditions()])

#k_ids = [i for i,p in enumerate(model.parameters) if p in model.parameters_rules()]
#k_ids_names = [p.name for i,p in enumerate(model.parameters) if p in model.parameters_rules()]
#par_vals = np.array([p.value for p in model.parameters])

#ref = np.array([p.value for p in model.parameters_rules()])

# List of model observables and corresponding data file columns for point-by-point fitting
obs_names = ['mBid', 'cPARP']
data_names = ['norm_ICRP', 'norm_ECRP']