"/Users/Dani/TDK/parameter_estim/stim_protocol2/zap/best_comb/%i/stim.txt" % item) working_path = "/Users/Dani/TDK/parameter_estim/stim_protocol2/zap/best_comb/%i" % item # Do statistics for each parameter stat_list = [] for _ in p_names: stat_list.append(np.empty((n, 6), dtype=np.float)) # Load fixed parameters: list of parameters to be inferred fixed_params = [] for name in p_names: fixed_params.append(get_default_param(name)) # Generate deterministic trace and create synthetic data with noise model t, v = model(stype='custom', custom_stim=stim) data = white(noise, v) pset = ParameterSet(*fixed_params) modell = partial(model, stype='custom', custom_stim=stim) inf = IndependentInference(model=modell, noise_std=noise, target_trace=data, parameter_set=pset, working_path=working_path, speed=speed) if __name__ == '__main__': inf.run_sim()
startTime = time.time() for i in range(num_of_iter): print(str(i) + " is DONE out of " + str(num_of_iter)) # Sampling current parameter from normal distribution current_Ra = np.random.normal(pRa.mean, 10) current_gpas = np.random.normal(pgpas.mean, pgpas.sigma) current_cm = np.random.normal(pcm.mean, pcm.sigma) # Generate deterministic trace and create synthetic data with noise model t, v = stick_and_ball(Ra=current_Ra, gpas=current_gpas, cm=current_cm, stype='custom', custom_stim=stim) data = white(noise_sigma, v) # if i == 0: # plt.figure() # plt.title("Neuron voltage response to stimuli") # plt.xlabel('Time [ms]') # plt.ylabel('Voltage [mV]') # plt.plot(t, v, color='#2FA5A0') # plt.show() # Set up range in a way that the true parameter value will be in the middle Ra_start = current_Ra - 50 Ra_end = current_Ra + 50 gpas_start = current_gpas - 0.00005 gpas_end = current_gpas + 0.00005 cm_start = current_cm - 0.5
value=1.) gpas = RandomVariable(name='gpas', range_min=0.00005, range_max=0.00015, resolution=60, mean=0.00008, sigma=0.00002, value=0.0001) # Ra = RandomVariable(name='Ra', range_min=50., range_max=150., resolution=60, mean=100., sigma=20.) # 2.) Set up parameter set cm_gpas = ParameterSet(cm, gpas) # 3.) Sythetic data t, v = stick_and_ball() exp_v = white(noise, v) # 4.) Set up inference inf = IndependentInference( model=stick_and_ball, noise_std=noise, target_trace=exp_v, parameter_set=cm_gpas, working_path= "/home/terbed/PROJECTS/SPE/parameter-inference/module/examples/output", speed='max', save=False) # 5.) Run inference if __name__ == "__main__": inf.run_sim()