Exemplo n.º 1
0
params = {
          'name': 'CellFitProblem',
          'maximize': False,
          'normalize': True,
          'model_dir': '../../../model/cells/toymodel1.json',
          'mechanism_dir': '../../../model/channels/schmidthieber',
          'variables': variables,
          'data_dir': '../../../data/toymodels/toymodel1/ramp.csv',
          'get_var_to_fit': 'get_v',
          'fitnessweights': [1.0],
          'errfun': 'rms',
          'insert_mechanisms': True
         }

# create problem
problem = CellFitProblem(**params)
dt_exp = problem.simulation_params['dt']
dts = dt_exp / 2**dt_fac
channel_list = get_channel_list(problem.cell, 'soma')
ion_list = get_ionlist(channel_list)

# initialize errors
error_weights = np.zeros([n_models, len(dts)])
error_traces = np.zeros([n_models, len(dts)])

# create pseudo random number generator
seed = time()
#np.savetxt(save_dir+'/seed_'+str(trial)+'.txt', np.array([seed]))
prng = Random()
prng.seed(seed)
Exemplo n.º 2
0
params = {
          'name': 'CellFitProblem',
          'maximize': False,
          'normalize': True,
          'model_dir': '../../../model/cells/dapmodelnaka.json',
          'mechanism_dir': '../../../model/channels/schmidthieber',
          'variables': [],
          'data_dir': '../../../data/2015_08_11d/merged/step_dap_zap.csv',
          'get_var_to_fit': 'get_v',
          'fitnessweights': [1.0],
          'errfun': 'rms',
          'insert_mechanisms': True
         }

# create problem
problem = CellFitProblem(**params)

# save all information
if not os.path.exists(save_dir):
    os.makedirs(save_dir)
with open(save_dir+'/problem.json', 'w') as f:
    json.dump(params, f, indent=4)
with open(save_dir+'/cell.json', 'w') as f:
    json.dump(Cell.from_modeldir(params['model_dir']).get_dict(), f, indent=4)

for trial in range(0, n_trials):

    # get current traces
    v_exp = problem.data.v.values
    t_exp = problem.data.t.values
    i_exp = problem.data.i.values