fit no dend_tau increased v_offset baseline sim to 9 from 5
This commit is contained in:
parent
f1268b291c
commit
52e6fea5f8
@ -184,7 +184,7 @@ class LifacNoiseModel(AbstractModel):
|
||||
|
||||
def find_v_offset(self, goal_baseline_frequency, base_stimulus, threshold=2, border=50000):
|
||||
test_model = self.get_model_copy()
|
||||
simulation_length = 5
|
||||
simulation_length = 9
|
||||
|
||||
v_search_step_size = 100
|
||||
|
||||
@ -229,8 +229,8 @@ def binary_search_base_freq(model: LifacNoiseModel, base_stimulus, goal_frequenc
|
||||
raise ValueError("binary_search_base_freq() - LifacNoiseModel: Goal frequency might be nan?")
|
||||
|
||||
if abs(upper_bound - lower_bound) < 0.0001:
|
||||
print("v_offset search stopped. bounds converged! freq: {:.2f}, lower {:.1f}, upper: {:.1f}"
|
||||
.format(frequency, lower_bound, upper_bound))
|
||||
print("v_offset search stopped. bounds converged! freq: {:.2f}, bounds: {:.0f}"
|
||||
.format(frequency, lower_bound))
|
||||
warn("Search was stopped. Upper and lower bounds converged without finding a value closer than threshold!")
|
||||
return middle
|
||||
|
||||
|
@ -14,8 +14,8 @@ from helperFunctions import plot_errors
|
||||
|
||||
import multiprocessing as mp
|
||||
|
||||
SAVE_DIRECTORY = "./results/ref_and_tau/no_ref_period"
|
||||
SAVE_DIRECTORY_BEST = "./results/ref_and_tau/nrp_best"
|
||||
SAVE_DIRECTORY = "./results/ref_and_tau/no_dend_tau/"
|
||||
SAVE_DIRECTORY_BEST = "./results/ref_and_tau/ndt_best"
|
||||
# [vs, sc, cv, isi_hist, bursty, f_inf, f_inf_slope, f_zero, f_zero_slope, f0_curve]
|
||||
ERROR_WEIGHTS = (1, 1, 1, 1, 1, 1, 1, 1, 0, 1)
|
||||
|
||||
@ -31,7 +31,7 @@ def main():
|
||||
quit()
|
||||
|
||||
# test_single_cell("data/invivo/2010-11-08-al-invivo-1/")
|
||||
test_single_cell("data/ref_and_dend_set/2012-12-21-am-invivo-1/")
|
||||
test_single_cell("data/final/2012-12-21-am-invivo-1/")
|
||||
|
||||
# start_parameters = [p for p in iget_start_parameters()]
|
||||
# cell_data = CellData("data/invivo_bursty/2014-03-19-ae-invivo-1/")
|
||||
@ -45,7 +45,7 @@ def test_single_cell(path):
|
||||
for i, p in enumerate(start_parameters):
|
||||
fitter = Fitter()
|
||||
fitter.set_data_reference_values(cell_data)
|
||||
fmin, res_par = fitter.fit_routine_no_ref_period(p, ERROR_WEIGHTS)
|
||||
fmin, res_par = fitter.fit_routine_no_dend_tau(p, ERROR_WEIGHTS)
|
||||
|
||||
cell_path = os.path.split(cell_data.get_data_path())[-1]
|
||||
|
||||
@ -60,7 +60,7 @@ def fit_cell_base(parameters):
|
||||
time1 = time.time()
|
||||
fitter = Fitter()
|
||||
fitter.set_data_reference_values(parameters[0])
|
||||
fmin, res_par = fitter.fit_routine_no_ref_period(parameters[2], ERROR_WEIGHTS)
|
||||
fmin, res_par = fitter.fit_routine_no_dend_tau(parameters[2], ERROR_WEIGHTS)
|
||||
|
||||
cell_data = parameters[0]
|
||||
cell_name = os.path.split(cell_data.get_data_path())[-1]
|
||||
|
41
test.py
41
test.py
@ -19,7 +19,7 @@ import helperFunctions as hF
|
||||
import models.smallModels as sM
|
||||
from stimuli.SinusoidalStepStimulus import SinusoidalStepStimulus
|
||||
from matplotlib import gridspec
|
||||
from plottools.axes import labelaxes_params
|
||||
# from plottools.axes import labelaxes_params
|
||||
|
||||
|
||||
|
||||
@ -34,30 +34,19 @@ from plottools.axes import labelaxes_params
|
||||
|
||||
fit = ModelFit("results/final_2/2012-07-12-ag-invivo-1/start_parameter_4_err_6.11/")
|
||||
model = fit.get_model()
|
||||
print(model.parameters)
|
||||
eodf = fit.get_cell_data().get_eod_frequency()
|
||||
baseline = BaselineModel(model, eod_frequency=eodf)
|
||||
print("model BF: {:.2f}".format(baseline.get_baseline_frequency()))
|
||||
|
||||
base_stim = SinusoidalStepStimulus(fit.get_cell_data().get_eod_frequency(), 0, 0)
|
||||
time_list = []
|
||||
freq_list = []
|
||||
con_freq_list = []
|
||||
duration = 10
|
||||
step = model.get_sampling_interval()
|
||||
g = gaussian_kernel(0.005, step)
|
||||
for i in range(20):
|
||||
print(i)
|
||||
v1, spikes = model.simulate(base_stim, duration)
|
||||
|
||||
binary = np.zeros(int(np.rint(duration / step)))
|
||||
for s in spikes:
|
||||
binary[int(np.rint(s/step))] = 1
|
||||
rate = np.convolve(binary, g, mode='same')
|
||||
con_freq_list.append(rate)
|
||||
|
||||
time, freq = hF.calculate_time_and_frequency_trace(spikes, model.get_sampling_interval())
|
||||
time_list.append(time)
|
||||
freq_list.append(freq)
|
||||
rates = np.array(con_freq_list)
|
||||
mean_rate = np.mean(rates, axis=0)
|
||||
mean_time, mean_freq = hF.calculate_mean_of_frequency_traces(time_list, freq_list, model.get_sampling_interval())
|
||||
plt.plot(np.arange(0, 10, step), mean_rate, alpha=0.5)
|
||||
plt.plot(mean_time, mean_freq, alpha=0.5)
|
||||
model_no_dend = model.get_model_copy()
|
||||
model_no_dend.parameters["dend_tau"] = 0
|
||||
model_no_dend.parameters["input_scaling"] = 20
|
||||
|
||||
baseline = BaselineModel(model_no_dend, eod_frequency=eodf)
|
||||
print("no dend BF: {:.2f}".format(baseline.get_baseline_frequency()))
|
||||
baseline.plot_interspike_interval_histogram()
|
||||
|
||||
v1, spikes = model_no_dend.simulate(SinusoidalStepStimulus(eodf, 0, 0), 2)
|
||||
plt.plot(v1)
|
||||
plt.show()
|
Loading…
Reference in New Issue
Block a user