many changes
This commit is contained in:
parent
f176a7db4f
commit
45aa212b8a
@ -337,13 +337,13 @@ class BaselineModel(Baseline):
|
||||
self.v1_traces = []
|
||||
self.spiketimes = []
|
||||
for i in range(trials):
|
||||
v, st = model.simulate_fast(self.stimulus, self.simulation_time)
|
||||
v, st = model.simulate(self.stimulus, self.simulation_time)
|
||||
self.v1_traces.append(v)
|
||||
self.spiketimes.append(st)
|
||||
|
||||
def set_model_adaption_to_baseline(self):
|
||||
stimulus = SinusoidalStepStimulus(self.eod_frequency, 0, 0, 0)
|
||||
self.model.simulate_fast(stimulus, 1)
|
||||
self.model.simulate(stimulus, 1)
|
||||
adaption = self.model.get_adaption_trace()
|
||||
self.model.set_variable("a_zero", adaption[-1])
|
||||
# print("Baseline: model a_zero set to", adaption[-1])
|
||||
|
26
FiCurve.py
26
FiCurve.py
@ -18,8 +18,11 @@ class FICurve:
|
||||
self.save_file_name = "fi_curve_values.pkl"
|
||||
self.stimulus_values = stimulus_values
|
||||
|
||||
self.indices_f_baseline = []
|
||||
self.f_baseline_frequencies = []
|
||||
self.indices_f_inf = []
|
||||
self.f_inf_frequencies = []
|
||||
self.indices_f_zero = []
|
||||
self.f_zero_frequencies = []
|
||||
|
||||
# increase, offset
|
||||
@ -295,15 +298,19 @@ class FICurveCellData(FICurve):
|
||||
# self.f_inf_frequencies.append(-1)
|
||||
# continue
|
||||
|
||||
f_zero = hF.detect_f_zero_in_frequency_trace(time_axes[i], mean_frequencies[i],
|
||||
f_zero, f_zero_idx = hF.detect_f_zero_in_frequency_trace(time_axes[i], mean_frequencies[i],
|
||||
stimulus_start, sampling_interval)
|
||||
self.f_zero_frequencies.append(f_zero)
|
||||
f_baseline = hF.detect_f_baseline_in_freq_trace(time_axes[i], mean_frequencies[i],
|
||||
self.indices_f_zero.append(f_zero_idx)
|
||||
|
||||
f_baseline, f_base_idx = hF.detect_f_baseline_in_freq_trace(time_axes[i], mean_frequencies[i],
|
||||
stimulus_start, sampling_interval)
|
||||
self.f_baseline_frequencies.append(f_baseline)
|
||||
f_infinity = hF.detect_f_infinity_in_freq_trace(time_axes[i], mean_frequencies[i],
|
||||
self.indices_f_baseline.append(f_base_idx)
|
||||
f_infinity, f_inf_idx = hF.detect_f_infinity_in_freq_trace(time_axes[i], mean_frequencies[i],
|
||||
stimulus_start, stimulus_duration, sampling_interval)
|
||||
self.f_inf_frequencies.append(f_infinity)
|
||||
self.indices_f_inf.append(f_inf_idx)
|
||||
|
||||
def get_mean_time_and_freq_traces(self):
|
||||
return self.cell_data.get_time_axes_fi_curve_mean_frequencies(), self.cell_data.get_mean_fi_curve_isi_frequencies()
|
||||
@ -404,7 +411,7 @@ class FICurveModel(FICurve):
|
||||
|
||||
def set_model_adaption_to_baseline(self):
|
||||
stimulus = SinusoidalStepStimulus(self.eod_frequency, 0, 0, 0)
|
||||
self.model.simulate_fast(stimulus, 1)
|
||||
self.model.simulate(stimulus, 1)
|
||||
adaption = self.model.get_adaption_trace()
|
||||
self.model.set_variable("a_zero", adaption[-1])
|
||||
# print("FiCurve: model a_zero set to", adaption[-1])
|
||||
@ -422,7 +429,7 @@ class FICurveModel(FICurve):
|
||||
time_traces = []
|
||||
for j in range(self.trials):
|
||||
|
||||
_, spiketimes = self.model.simulate_fast(stimulus, self.total_simulation_time)
|
||||
_, spiketimes = self.model.simulate(stimulus, self.total_simulation_time)
|
||||
self.spiketimes_array[i, j] = spiketimes
|
||||
trial_time, trial_frequency = hF.calculate_time_and_frequency_trace(spiketimes, sampling_interval)
|
||||
frequency_traces.append(trial_frequency)
|
||||
@ -440,14 +447,17 @@ class FICurveModel(FICurve):
|
||||
self.f_baseline_frequencies.append(0)
|
||||
continue
|
||||
|
||||
f_inf = hF.detect_f_infinity_in_freq_trace(time, frequency, self.stim_start, self.stim_duration, sampling_interval)
|
||||
f_inf, f_inf_idx = hF.detect_f_infinity_in_freq_trace(time, frequency, self.stim_start, self.stim_duration, sampling_interval)
|
||||
self.f_inf_frequencies.append(f_inf)
|
||||
self.indices_f_inf.append(f_inf_idx)
|
||||
|
||||
f_zero = hF.detect_f_zero_in_frequency_trace(time, frequency, self.stim_start, sampling_interval)
|
||||
f_zero, f_zero_idx = hF.detect_f_zero_in_frequency_trace(time, frequency, self.stim_start, sampling_interval)
|
||||
self.f_zero_frequencies.append(f_zero)
|
||||
self.indices_f_zero.append(f_zero_idx)
|
||||
|
||||
f_baseline = hF.detect_f_baseline_in_freq_trace(time, frequency, self.stim_start, sampling_interval)
|
||||
f_baseline, f_base_idx = hF.detect_f_baseline_in_freq_trace(time, frequency, self.stim_start, sampling_interval)
|
||||
self.f_baseline_frequencies.append(f_baseline)
|
||||
self.indices_f_baseline.append(f_base_idx)
|
||||
|
||||
def get_mean_time_and_freq_traces(self):
|
||||
return self.mean_time_traces, self.mean_frequency_traces
|
||||
|
@ -1,8 +1,32 @@
|
||||
|
||||
|
||||
SAVE_FOLDER = "./thesis/figures/"
|
||||
|
||||
# 2013-04-17-ae-invivo-1
|
||||
eod_1 = 601
|
||||
model_cell_1 = {'v_zero': 0, 'tau_a': 0.10594195682772084, 'a_zero': 20.297158690978996, 'v_base': 0, 'step_size': 5e-05,
|
||||
'input_scaling': 199.04341472682282, 'mem_tau': 0.0013351097297217276, 'dend_tau': 0.005031489230091817,
|
||||
'threshold': 1, 'noise_strength': 0.020762013938241387, 'delta_a': 0.19269473149955363,
|
||||
'refractory_period': 0.002371738343145318, 'v_offset': -43.75}
|
||||
|
||||
# 2013-01-08-ab-invivo-1
|
||||
eod_2 = 800
|
||||
model_cell_2 = {'v_offset': -48.828125, 'mem_tau': 0.0021479243799079964, 'threshold': 1, 'a_zero': 27.680206509021417,
|
||||
'step_size': 5e-05, 'v_zero': 0, 'delta_a': 0.12873961597602196, 'input_scaling': 242.8680596636849,
|
||||
'tau_a': 0.10796132718941187, 'v_base': 0, 'refractory_period': 0.0007639751586561779,
|
||||
'dend_tau': 0.005438366305916608, 'noise_strength': 0.02022218133038218}
|
||||
|
||||
# 2012-06-27-ah-invivo-1
|
||||
eod_3 = 752 # Hz
|
||||
model_cell_3 = {'v_base': 0, 'noise_strength': 0.05081267319483283, 'threshold': 1, 'a_zero': 27.063463123260032,
|
||||
'tau_a': 0.08095824056298784, 'step_size': 5e-05, 'delta_a': 0.2030821656947388,
|
||||
'mem_tau': 0.0030522466803712903, 'v_zero': 0, 'v_offset': -160.9375, 'refractory_period': 0.0012932884089886,
|
||||
'input_scaling': 591.8852909105865, 'dend_tau': 0.005488247178541381}
|
||||
|
||||
FIG_SIZE_SMALL = (4, 4)
|
||||
FIG_SIZE_MEDIUM = (6, 6)
|
||||
FIG_SIZE_LARGE = (8, 8)
|
||||
|
||||
COLOR_MODEL = "orange"
|
||||
COLOR_DATA = "blue"
|
||||
|
||||
|
@ -10,16 +10,17 @@ from CellData import CellData
|
||||
from Baseline import BaselineCellData
|
||||
from FiCurve import FICurveCellData
|
||||
|
||||
MODEL_COLOR = "blue"
|
||||
DATA_COLOR = "orange"
|
||||
MODEL_COLOR = "orange"
|
||||
DATA_COLOR = "blue"
|
||||
|
||||
DATA_SAVE_PATH = "data/figure_data/"
|
||||
|
||||
|
||||
def main():
|
||||
# data_isi_histogram()
|
||||
# data_mean_freq_step_stimulus_examples()
|
||||
data_mean_freq_step_stimulus_examples()
|
||||
# data_mean_freq_step_stimulus_with_detections()
|
||||
data_fi_curve()
|
||||
# data_fi_curve()
|
||||
pass
|
||||
|
||||
|
||||
@ -29,6 +30,7 @@ def data_fi_curve():
|
||||
fi = FICurveCellData(cell_data, cell_data.get_fi_contrasts())
|
||||
fi.plot_fi_curve()
|
||||
|
||||
|
||||
def data_mean_freq_step_stimulus_with_detections():
|
||||
cell = "data/invivo/2013-04-17-ac-invivo-1/"
|
||||
cell_data = CellData(cell)
|
||||
@ -109,7 +111,5 @@ def data_isi_histogram(recalculate=True):
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
147
Figures_Model.py
147
Figures_Model.py
@ -1,19 +1,134 @@
|
||||
|
||||
from models.LIFACnoise import LifacNoiseModel
|
||||
from stimuli.SinusoidalStepStimulus import SinusoidalStepStimulus
|
||||
|
||||
import helperFunctions as hF
|
||||
import Figure_constants as consts
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import models.smallModels as sM
|
||||
|
||||
def main():
|
||||
plot_model_example()
|
||||
# stimulus_development()
|
||||
# model_adaption_example()
|
||||
model_comparison()
|
||||
pass
|
||||
|
||||
|
||||
def isi_development():
|
||||
model_params = consts.model_cell_1
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def plot_model_example():
|
||||
def model_comparison():
|
||||
step = 0.00001
|
||||
duration = 0.5
|
||||
stimulus = np.arange(0, duration, step)
|
||||
stimulus[0:8000] = 2
|
||||
stimulus[8000:20000] = 0
|
||||
stimulus[20000:] = 1
|
||||
|
||||
fig, axes = plt.subplots(5, 2, sharex=True, sharey="col", figsize=consts.FIG_SIZE_LARGE)
|
||||
|
||||
axes[1, 0].set_title("Voltage")
|
||||
axes[1, 1].set_title("Frequency")
|
||||
|
||||
axes[0, 0].plot(np.arange(0, duration, step)[:len(stimulus)], stimulus)
|
||||
axes[0, 0].set_ylabel("Stimulus")
|
||||
axes[0, 1].set_frame_on(False)
|
||||
axes[0, 1].set_axis_off()
|
||||
|
||||
v1, spikes = sM.pif_simulation(stimulus, step)
|
||||
axes[1, 0].plot(np.arange(0, duration, step)[:len(v1)], v1)
|
||||
axes[1, 0].eventplot(spikes, lineoffsets=1.2, linelengths=0.2, colors="black")
|
||||
time, freq = hF.calculate_time_and_frequency_trace(spikes, step)
|
||||
axes[1, 1].plot(time, freq)
|
||||
axes[1, 0].set_ylabel("PIF")
|
||||
|
||||
v1, spikes = sM.lif_simulation(stimulus, step)
|
||||
axes[2, 0].plot(np.arange(0, duration, step)[:len(v1)], v1)
|
||||
axes[2, 0].eventplot(spikes, lineoffsets=1.2, linelengths=0.2, colors="black")
|
||||
time, freq = hF.calculate_time_and_frequency_trace(spikes, step)
|
||||
axes[2, 1].plot(time, freq)
|
||||
axes[2, 0].set_ylabel("LIF")
|
||||
|
||||
v1, spikes = sM.lifac_simulation(stimulus, step)
|
||||
axes[3, 0].plot(np.arange(0, duration, step)[:len(v1)], v1)
|
||||
axes[3, 0].eventplot(spikes, lineoffsets=1.2, linelengths=0.2, colors="black")
|
||||
time, freq = hF.calculate_time_and_frequency_trace(spikes, step)
|
||||
axes[3, 1].plot(time, freq)
|
||||
axes[3, 0].set_ylabel("LIFAC")
|
||||
|
||||
v1, spikes = sM.lifac_ref_simulation(stimulus, step)
|
||||
axes[4, 0].plot(np.arange(0, duration, step)[:len(v1)], v1)
|
||||
axes[4, 0].eventplot(spikes, lineoffsets=1.2, linelengths=0.2, colors="black")
|
||||
time, freq = hF.calculate_time_and_frequency_trace(spikes, step)
|
||||
axes[4, 1].plot(time, freq)
|
||||
axes[4, 0].set_ylabel("LIFAC + ref")
|
||||
axes[4, 0].set_xlabel("Time [s]")
|
||||
axes[4, 1].set_xlabel("Time [s]")
|
||||
|
||||
# v1, spikes = sM.lifac_ref_noise_simulation(stimulus, step)
|
||||
# axes[5, 0].plot(np.arange(0, duration, step)[:len(v1)], v1)
|
||||
# axes[5, 0].eventplot(spikes, lineoffsets=1.2, linelengths=0.2, colors="black")
|
||||
# time, freq = hF.calculate_time_and_frequency_trace(spikes, step)
|
||||
# print(np.mean(freq))
|
||||
# axes[5, 1].plot(time, freq)
|
||||
plt.tight_layout()
|
||||
plt.savefig(consts.SAVE_FOLDER + "model_comparison.pdf")
|
||||
plt.close()
|
||||
|
||||
|
||||
def stimulus_development():
|
||||
time_start = 0
|
||||
time_duration = 0.025
|
||||
|
||||
stimulus = SinusoidalStepStimulus(745, 0.2, 0.1, 0.1)
|
||||
step_size = 0.00005
|
||||
stim_array = stimulus.as_array(time_start, time_duration, step_size)
|
||||
|
||||
rectified = hF.rectify_stimulus_array(stim_array)
|
||||
filtered = dendritic_lowpass(rectified, 0.0014, step_size)
|
||||
|
||||
fig, axes = plt.subplots(3, 1, figsize=(6, 6), sharex="col")
|
||||
time = np.arange(time_start, time_duration, step_size)
|
||||
axes[0].plot(time, stim_array)
|
||||
axes[0].set_title("stimulus")
|
||||
|
||||
axes[1].plot(time, rectified)
|
||||
axes[1].set_title("rectified stimulus")
|
||||
|
||||
axes[2].plot(time, filtered)
|
||||
axes[2].set_title("rectified with dendritic filter")
|
||||
|
||||
axes[0].set_ylim((-1.05, 1.05))
|
||||
axes[1].set_ylim((-1.05, 1.05))
|
||||
|
||||
for ax in axes:
|
||||
ax.set_ylabel("Amplitude [mV]")
|
||||
axes[2].set_xlabel("Time [s]")
|
||||
axes[0].set_xlim((time_start-0.0005, time_duration))
|
||||
# axes[2].set_ylim((0, 1.05))
|
||||
|
||||
plt.tight_layout()
|
||||
plt.savefig(consts.SAVE_FOLDER + "stimulus_development.pdf")
|
||||
plt.close()
|
||||
|
||||
|
||||
parameter = {}
|
||||
def dendritic_lowpass(stimulus, dend_tau, step_size):
|
||||
filtered = np.zeros(len(stimulus))
|
||||
filtered[0] = stimulus[0]
|
||||
|
||||
for i in range(1, len(stimulus), 1):
|
||||
filtered[i] = filtered[i - 1] + ((-filtered[i - 1] + stimulus[i]) / dend_tau) * step_size
|
||||
|
||||
return filtered
|
||||
|
||||
|
||||
def model_adaption_example():
|
||||
# TODO find a god example model
|
||||
parameter = consts.model_cell_2
|
||||
model = LifacNoiseModel(parameter)
|
||||
# frequency, contrast, start_time=0, duration=np.inf, amplitude=1)
|
||||
frequency = 350
|
||||
@ -25,10 +140,10 @@ def plot_model_example():
|
||||
time_start = 0
|
||||
time_duration = 0.5
|
||||
time_step = model.get_sampling_interval()
|
||||
v1, spikes = model.simulate_fast(stimulus, total_time_s=time_duration, time_start=time_start)
|
||||
v1, spikes = model.simulate(stimulus, total_time_s=time_duration, time_start=time_start)
|
||||
adaption = model.get_adaption_trace()
|
||||
time = np.arange(time_start, time_start+time_duration, time_step)
|
||||
fig, axes = plt.subplots(2, sharex=True)
|
||||
fig, axes = plt.subplots(2, sharex=True, gridspec_kw={'height_ratios': [1, 1]})
|
||||
|
||||
# axes[0].plot(time, stimulus.as_array(time_start, time_duration, time_step))
|
||||
|
||||
@ -36,21 +151,25 @@ def plot_model_example():
|
||||
end = 0.29
|
||||
start_idx = int(start / time_step)
|
||||
end_idx = int(end / time_step)
|
||||
time_part = np.arange(0, end_idx-start_idx, 1) * time_step *1000
|
||||
time_part = time[start_idx:end_idx]
|
||||
# axes[0].plot(time[start_idx:end_idx], v1[start_idx:end_idx])
|
||||
axes[0].eventplot([s for s in spikes if start < s < end], lineoffsets=1.2, linelengths=0.2, colors="black")
|
||||
# axes[0].set_ylim((0.5, 1.5))
|
||||
# axes[0].set_frame_on(False)
|
||||
# axes[0].set_axis_off()
|
||||
# axes[0].set_ylabel("Spikes")
|
||||
|
||||
axes[0].plot(time_part, v1[start_idx:end_idx])
|
||||
axes[0].set_ylabel("Membrane voltage [mV]")
|
||||
# axes[1].plot(time[start_idx:end_idx], adaption[start_idx:end_idx])
|
||||
axes[1].plot(time_part, adaption[start_idx:end_idx])
|
||||
axes[1].set_ylabel("Adaption current [mV]")
|
||||
axes[1].set_xlabel("Time [ms]")
|
||||
axes[1].set_xlim((0, 30))
|
||||
plt.show()
|
||||
plt.close()
|
||||
|
||||
|
||||
axes[1].set_xlim((start, end))
|
||||
|
||||
plt.savefig(consts.SAVE_FOLDER + "adaptionExample.pdf")
|
||||
plt.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
@ -196,7 +196,7 @@ class Fitter:
|
||||
# calculate errors with reference values
|
||||
error_bf = abs((baseline_freq - self.baseline_freq) / self.baseline_freq)
|
||||
error_vs = abs((vector_strength - self.vector_strength) / 0.01)
|
||||
error_cv = abs((coefficient_of_variation - self.coefficient_of_variation) / 0.2)
|
||||
error_cv = abs((coefficient_of_variation - self.coefficient_of_variation) / 0.05)
|
||||
error_bursty = (abs(burstiness - self.burstiness) / 0.2)
|
||||
error_hist = np.mean((isi_bins - self.isi_bins) ** 2) / 600
|
||||
# print("error hist: {:.2f}".format(error_hist))
|
||||
|
@ -243,7 +243,7 @@ class ModelFit:
|
||||
freq_traces = []
|
||||
time_traces = []
|
||||
for i in range(10):
|
||||
v1, spikes = model.simulate_fast(stimulus, cell.get_time_end() - cell.get_time_start(), cell.get_time_start())
|
||||
v1, spikes = model.simulate(stimulus, cell.get_time_end() - cell.get_time_start(), cell.get_time_start())
|
||||
time, freq = hF.calculate_time_and_frequency_trace(spikes, model.get_sampling_interval())
|
||||
freq_traces.append(freq)
|
||||
time_traces.append(time)
|
||||
|
@ -30,7 +30,7 @@ def find_fitting_line(lifac_model, stimulus_strengths):
|
||||
|
||||
duration = 0.2
|
||||
for stim_strength in stimulus_strengths:
|
||||
lifac_model.simulate(StepStimulus(0, duration, stim_strength), duration)
|
||||
lifac_model.simulate_slow(StepStimulus(0, duration, stim_strength), duration)
|
||||
|
||||
spiketimes = lifac_model.get_spiketimes()
|
||||
if len(spiketimes) == 0:
|
||||
@ -73,7 +73,7 @@ def find_relation(lifac, line_vars, stimulus_strengths, parameter="", value=0, c
|
||||
for stim in stimulus_strengths:
|
||||
#print("stim:", stim)
|
||||
stimulus = StepStimulus(0, duration, stim)
|
||||
lifac.simulate(stimulus, duration)
|
||||
lifac.simulate_slow(stimulus, duration)
|
||||
spiketimes = lifac.get_spiketimes()
|
||||
time, freq = hf.calculate_time_and_frequency_trace(spiketimes, lifac.get_sampling_interval())
|
||||
|
||||
|
@ -18,7 +18,7 @@ def main():
|
||||
# args = parser.parse_args()
|
||||
|
||||
dir_path = "results/invivo_results/" # args.dir
|
||||
dir_path = "results/test_data/"
|
||||
dir_path = "results/invivo-1/"
|
||||
|
||||
# if not os.path.isdir(dir_path):
|
||||
# print("Argument dir is not a directory.")
|
||||
|
@ -511,11 +511,13 @@ def detect_f_zero_in_frequency_trace(time, frequency, stimulus_start, sampling_i
|
||||
f_zero = min_during_start_of_stim
|
||||
else:
|
||||
f_zero = max_during_start_of_stim
|
||||
f_zero_idx = (frequency[start_idx:end_idx].index(f_zero) + start_idx,)
|
||||
|
||||
peak_buffer = (max_before - min_before) * peak_buffer_percent
|
||||
if min_before - peak_buffer <= f_zero <= max_before + peak_buffer:
|
||||
end_idx = start_idx + int((end_idx-start_idx)/2)
|
||||
f_zero = np.mean(frequency[start_idx:end_idx])
|
||||
f_zero_idx = (start_idx, end_idx)
|
||||
|
||||
# import matplotlib.pyplot as plt
|
||||
# plt.plot(time, frequency)
|
||||
@ -528,7 +530,7 @@ def detect_f_zero_in_frequency_trace(time, frequency, stimulus_start, sampling_i
|
||||
raise AssertionError("Detection of f-zero went very wrong! frequency above 1/sampling_interval.")
|
||||
if int_f_zero > max(frequency):
|
||||
raise AssertionError("detected f_zero bigger than the highest peak in the frequency trace...")
|
||||
return f_zero
|
||||
return f_zero, f_zero_idx
|
||||
|
||||
|
||||
def time_window_detect_f_zero(time_start, stimulus_start, sampling_interval, buffer=0.025):
|
||||
@ -540,7 +542,7 @@ def time_window_detect_f_zero(time_start, stimulus_start, sampling_interval, buf
|
||||
|
||||
def detect_f_infinity_in_freq_trace(time, frequency, stimulus_start, stimulus_duration, sampling_interval, length=0.1, buffer=0.025):
|
||||
start_idx, end_idx = time_window_detect_f_infinity(time[0], stimulus_start, stimulus_duration, sampling_interval, length, buffer)
|
||||
return np.mean(frequency[start_idx:end_idx])
|
||||
return np.mean(frequency[start_idx:end_idx]), (start_idx, end_idx)
|
||||
|
||||
|
||||
def time_window_detect_f_infinity(time_start, stimulus_start, stimulus_duration, sampling_interval, length=0.1, buffer=0.025):
|
||||
@ -555,7 +557,7 @@ def detect_f_baseline_in_freq_trace(time, frequency, stimulus_start, sampling_in
|
||||
start_idx, end_idx = time_window_detect_f_baseline(time[0], stimulus_start, sampling_interval, buffer)
|
||||
f_baseline = np.mean(frequency[start_idx:end_idx])
|
||||
|
||||
return f_baseline
|
||||
return f_baseline, (start_idx, end_idx)
|
||||
|
||||
|
||||
def time_window_detect_f_baseline(time_start, stimulus_start, sampling_interval, buffer=0.025):
|
||||
|
@ -27,12 +27,13 @@ class AbstractModel:
|
||||
def simulates_spiketimes(self) -> bool:
|
||||
raise NotImplementedError("NOT IMPLEMENTED")
|
||||
|
||||
def simulate(self, stimulus: AbstractStimulus, total_time_s):
|
||||
def simulate(self, stimulus: AbstractStimulus, total_time_s, time_start=0):
|
||||
"""
|
||||
Simulate the given stimulus in the model
|
||||
and simulate up to the given total time
|
||||
and saves the simulated data in the model.
|
||||
|
||||
:param time_start: when the simulation should start
|
||||
:param stimulus: given stimulus
|
||||
:param total_time_s: time to simulate
|
||||
:return: depending on availability: [voltage, spiketimes, frequency]
|
||||
|
@ -40,7 +40,7 @@ class LifacNoiseModel(AbstractModel):
|
||||
self.stimulus = None
|
||||
# self.frequency_trace = []
|
||||
|
||||
def simulate(self, stimulus: AbstractStimulus, total_time_s):
|
||||
def simulate_slow(self, stimulus: AbstractStimulus, total_time_s):
|
||||
|
||||
self.stimulus = stimulus
|
||||
time = np.arange(0, total_time_s, self.parameters["step_size"])
|
||||
@ -108,7 +108,7 @@ class LifacNoiseModel(AbstractModel):
|
||||
(-current_i + rectified_input * self.parameters["input_scaling"]) / self.parameters["dend_tau"]) * \
|
||||
self.parameters["step_size"]
|
||||
|
||||
def simulate_fast(self, stimulus: AbstractStimulus, total_time_s, time_start=0):
|
||||
def simulate(self, stimulus: AbstractStimulus, total_time_s, time_start=0):
|
||||
|
||||
v_zero = self.parameters["v_zero"]
|
||||
a_zero = self.parameters["a_zero"]
|
||||
@ -234,7 +234,7 @@ def binary_search_base_freq(model: LifacNoiseModel, base_stimulus, goal_frequenc
|
||||
def test_v_offset(model: LifacNoiseModel, v_offset, base_stimulus, simulation_length):
|
||||
model.set_variable("v_offset", v_offset)
|
||||
try:
|
||||
v, spiketimes = model.simulate_fast(base_stimulus, simulation_length)
|
||||
v, spiketimes = model.simulate(base_stimulus, simulation_length)
|
||||
|
||||
freq = hF.mean_freq_of_spiketimes_after_time_x(spiketimes, simulation_length / 3)
|
||||
except ZeroDivisionError:
|
||||
|
149
models/smallModels.py
Normal file
149
models/smallModels.py
Normal file
@ -0,0 +1,149 @@
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import helperFunctions as hF
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
|
||||
def pif_simulation(stimulus, step_size):
|
||||
|
||||
v_0 = 0
|
||||
v_base = 0
|
||||
threshold = 1
|
||||
v_offset = 0.15
|
||||
mem_tau = 0.015
|
||||
|
||||
v_1 = np.zeros(len(stimulus))
|
||||
v_1[0] = v_0
|
||||
spikes = []
|
||||
|
||||
for i in range(1, len(v_1), 1):
|
||||
# dvdt = (v_offset + stimulus[i]) / mem_tau
|
||||
v_1[i] = v_1[i - 1] + ((v_offset + stimulus[i]) / mem_tau) * step_size
|
||||
|
||||
if v_1[i] > threshold:
|
||||
v_1[i] = v_base
|
||||
spikes.append(i*step_size)
|
||||
|
||||
return v_1, spikes
|
||||
|
||||
|
||||
def lif_simulation(stimulus, step_size):
|
||||
v_0 = 0
|
||||
v_base = 0
|
||||
threshold = 1
|
||||
v_offset = 1.0013
|
||||
mem_tau = 0.015
|
||||
|
||||
v_1 = np.zeros(len(stimulus))
|
||||
v_1[0] = v_0
|
||||
spikes = []
|
||||
|
||||
for i in range(1, len(v_1), 1):
|
||||
v_1[i] = v_1[i - 1] + ((v_offset - v_1[i-1] + stimulus[i]) / mem_tau) * step_size
|
||||
|
||||
if v_1[i] > threshold:
|
||||
v_1[i] = v_base
|
||||
spikes.append(i * step_size)
|
||||
|
||||
return v_1, spikes
|
||||
|
||||
|
||||
def lifac_simulation(stimulus, step_size):
|
||||
v_0 = 0
|
||||
v_base = 0
|
||||
threshold = 1
|
||||
v_offset = 1.35
|
||||
mem_tau = 0.015
|
||||
adaption_tau = 0.1
|
||||
adaption_step = 0.05
|
||||
|
||||
adaption = np.zeros(len(stimulus))
|
||||
adaption[0] = 0.5
|
||||
v_1 = np.zeros(len(stimulus))
|
||||
v_1[0] = v_0
|
||||
spikes = []
|
||||
|
||||
for i in range(1, len(v_1), 1):
|
||||
v_1[i] = v_1[i - 1] + ((v_offset - v_1[i-1] - adaption[i-1] + stimulus[i]) / mem_tau) * step_size
|
||||
adaption[i] = adaption[i-1] + (-adaption[i-1] / adaption_tau) * step_size
|
||||
if v_1[i] > threshold:
|
||||
v_1[i] = v_base
|
||||
spikes.append(i * step_size)
|
||||
adaption[i] += adaption_step / adaption_tau
|
||||
|
||||
return v_1, spikes
|
||||
|
||||
|
||||
def lifac_ref_simulation(stimulus, step_size):
|
||||
v_0 = 0
|
||||
v_base = 0
|
||||
threshold = 1
|
||||
v_offset = 1.35
|
||||
mem_tau = 0.015
|
||||
adaption_tau = 0.1
|
||||
adaption_step = 0.05
|
||||
ref_time = 0.005
|
||||
adaption = np.zeros(len(stimulus))
|
||||
adaption[0] = 0.5
|
||||
v_1 = np.zeros(len(stimulus))
|
||||
v_1[0] = v_0
|
||||
spikes = []
|
||||
|
||||
for i in range(1, len(v_1), 1):
|
||||
if len(spikes) > 0 and i*step_size < spikes[-1] + ref_time:
|
||||
v_1[i] = v_base
|
||||
else:
|
||||
v_1[i] = v_1[i - 1] + ((v_offset - v_1[i-1] - adaption[i-1] + stimulus[i]) / mem_tau) * step_size
|
||||
|
||||
adaption[i] = adaption[i-1] + (-adaption[i-1] / adaption_tau) * step_size
|
||||
if v_1[i] > threshold:
|
||||
v_1[i] = v_base
|
||||
spikes.append(i * step_size)
|
||||
adaption[i] += adaption_step / adaption_tau
|
||||
|
||||
return v_1, spikes
|
||||
|
||||
|
||||
def lifac_ref_noise_simulation(stimulus, step_size):
|
||||
v_0 = 0
|
||||
v_base = 0
|
||||
threshold = 1
|
||||
v_offset = 1.32
|
||||
mem_tau = 0.015
|
||||
adaption_tau = 0.1
|
||||
adaption_step = 0.05
|
||||
ref_time = 0.005
|
||||
|
||||
noise_strength = 0.05
|
||||
|
||||
adaption = np.zeros(len(stimulus))
|
||||
adaption[0] = 1
|
||||
v_1 = np.zeros(len(stimulus))
|
||||
v_1[0] = v_0
|
||||
spikes = []
|
||||
|
||||
for i in range(1, len(v_1), 1):
|
||||
|
||||
noise_value = np.random.normal()
|
||||
noise = noise_strength * noise_value / np.sqrt(step_size)
|
||||
|
||||
if len(spikes) > 0 and i*step_size < spikes[-1] + ref_time:
|
||||
v_1[i] = v_base
|
||||
else:
|
||||
v_1[i] = v_1[i - 1] + ((v_offset - v_1[i-1] - adaption[i-1] + stimulus[i] + noise) / mem_tau) * step_size
|
||||
|
||||
adaption[i] = adaption[i-1] + (-adaption[i-1] / adaption_tau) * step_size
|
||||
if v_1[i] > threshold:
|
||||
v_1[i] = v_base
|
||||
spikes.append(i * step_size)
|
||||
adaption[i] += adaption_step / adaption_tau
|
||||
|
||||
return v_1, spikes
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -16,9 +16,9 @@ import multiprocessing as mp
|
||||
|
||||
|
||||
# SAVE_DIRECTORY = "./results/invivo_results/"
|
||||
SAVE_DIRECTORY = "./results/test_data/"
|
||||
SAVE_DIRECTORY = "./results/invivo-1/"
|
||||
# SAVE_DIRECTORY_BEST = "./results/invivo_best/"
|
||||
SAVE_DIRECTORY_BEST = "./results/test_data_best/"
|
||||
SAVE_DIRECTORY_BEST = "./results/invivo-1_best/"
|
||||
# [bf, vs, sc, cv, isi_hist, bursty, f_inf, f_inf_slope, f_zero, f_zero_slope, f0_curve]
|
||||
ERROR_WEIGHTS = (2, 2, 1, 1, 0, 1, 1, 1, 0, 1)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
for file in data/test_data/*; do
|
||||
for file in data/invivo_bursty/*; do
|
||||
if [ -d "$file" ]; then
|
||||
nice python3 run_Fitter.py --cell $file
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
@ -58,7 +58,7 @@ def main():
|
||||
if mean_duration < 2*1/float(m_freq):
|
||||
continue
|
||||
stimulus = SAM(eod_freq, contrast/100, m_freq)
|
||||
v1, spikes_model = model.simulate_fast(stimulus, mean_duration*4)
|
||||
v1, spikes_model = model.simulate(stimulus, mean_duration * 4)
|
||||
prob_density_function_model = spiketimes_calculate_pdf(spikes_model, step_size)
|
||||
# plt.plot(prob_density_function_model)
|
||||
# plt.show()
|
||||
@ -163,7 +163,7 @@ def sam_analysis(fit_path):
|
||||
# axes[0].plot(np.mean(cell_means, axis=0), color="black")
|
||||
|
||||
stimulus = SAM(eod_freq, contrasts[i] / 100, mod_freq)
|
||||
v1, spikes_model = model.simulate_fast(stimulus, durations[i] * 4)
|
||||
v1, spikes_model = model.simulate(stimulus, durations[i] * 4)
|
||||
model_pdf = spiketimes_calculate_pdf(spikes_model, step_size)
|
||||
model_cuts = cut_pdf_into_periods(model_pdf, 1/mod_freq, step_size, factor=1.1)
|
||||
model_mean = np.mean(model_cuts, axis=0)
|
||||
@ -208,7 +208,7 @@ def generate_pdf(model, stimulus, trials=4, sim_length=3, kernel_width=0.005):
|
||||
trials_rate_list = []
|
||||
step_size = model.get_parameters()["step_size"]
|
||||
for _ in range(trials):
|
||||
v1, spikes = model.simulate(stimulus, total_time_s=sim_length)
|
||||
v1, spikes = model.simulate_slow(stimulus, total_time_s=sim_length)
|
||||
|
||||
binary = np.zeros(int(sim_length/step_size))
|
||||
spikes = [int(s / step_size) for s in spikes]
|
||||
|
35
test.py
35
test.py
@ -7,7 +7,7 @@ from os import listdir
|
||||
import numpy as np
|
||||
from IPython import embed
|
||||
import pyrelacs.DataLoader as Dl
|
||||
from ModelFit import ModelFit
|
||||
from ModelFit import ModelFit, get_best_fit
|
||||
from FiCurve import FICurveModel, FICurveCellData
|
||||
import os
|
||||
import matplotlib.pyplot as plt
|
||||
@ -16,17 +16,30 @@ from scipy.optimize import curve_fit
|
||||
from scipy.signal import find_peaks
|
||||
from thunderfish.eventdetection import threshold_crossing_times, threshold_crossings, detect_peaks
|
||||
|
||||
isis = np.random.normal(0, 1, 200000)
|
||||
bins = np.arange(-5, 5, 0.1)
|
||||
counts = np.array([np.sum((isis >= b) & (isis < b+0.1)) for b in bins]) / len(isis)
|
||||
plt.plot(counts)
|
||||
plt.show()
|
||||
quit()
|
||||
folder = "./results/test_data/start_parameter_1_err_28.43"
|
||||
|
||||
fit = ModelFit(folder)
|
||||
print(fit.get_fit_routine_error())
|
||||
fit.generate_master_plot()
|
||||
folder = "./results/invivo-1/"
|
||||
|
||||
for cell in os.listdir(folder):
|
||||
fit = get_best_fit(os.path.join(folder, cell))
|
||||
cell_data = fit.get_cell_data()
|
||||
model = fit.get_model()
|
||||
fi = FICurveModel(model, np.arange(-0.5, 0.6, 0.1), cell_data.get_eod_frequency())
|
||||
|
||||
times, freq = fi.get_mean_time_and_freq_traces()
|
||||
|
||||
for i in range(len(times)):
|
||||
plt.plot(freq[i])
|
||||
|
||||
plt.plot(fi.indices_f_zero[i], [fi.f_zero_frequencies[i]]*len(fi.indices_f_zero[i]), "o")
|
||||
plt.plot(fi.indices_f_baseline[i], 2*[fi.f_baseline_frequencies[i]])
|
||||
plt.plot(fi.indices_f_inf[i], 2*[fi.f_inf_frequencies[i]])
|
||||
plt.show()
|
||||
plt.close()
|
||||
|
||||
# fit.generate_master_plot("./results/invivo-1_best/")
|
||||
|
||||
|
||||
# fit.generate_master_plot()
|
||||
quit()
|
||||
|
||||
for item in os.listdir(folder):
|
||||
|
@ -59,7 +59,7 @@ def test_lifac_noise():
|
||||
time = np.arange(0, total_time, step_size)
|
||||
stimulus = SinusoidalStepStimulus(700, 0.2, start, duration)
|
||||
|
||||
model.simulate_fast(stimulus, total_time)
|
||||
model.simulate(stimulus, total_time)
|
||||
|
||||
fig, axes = plt.subplots(nrows=4, sharex="col")
|
||||
sparse_time = np.arange(0, total_time, 1/5000)
|
||||
|
@ -88,7 +88,7 @@ def test_simulation_speed():
|
||||
t_start = time.time()
|
||||
for i in range(repetitions):
|
||||
|
||||
v, spikes = model.simulate_fast(stimulus, seconds, time_start)
|
||||
v, spikes = model.simulate(stimulus, seconds, time_start)
|
||||
print(len(v))
|
||||
print(len(spikes))
|
||||
|
||||
@ -195,7 +195,7 @@ def test_vector_strength_calculation():
|
||||
bf, vs1, sc = model.calculate_baseline_markers(600)
|
||||
|
||||
base_stim = SinusAmplitudeModulationStimulus(600, 0, 0)
|
||||
_, spiketimes = model.simulate_fast(base_stim, 30)
|
||||
_, spiketimes = model.simulate(base_stim, 30)
|
||||
stimulus_trace = base_stim.as_array(0, 30, model.get_sampling_interval())
|
||||
time_trace = np.arange(0, 30, model.get_sampling_interval())
|
||||
|
||||
@ -227,7 +227,7 @@ def test_baseline_polar_plot():
|
||||
|
||||
|
||||
def plot_model_during_stimulus(model: LifacNoiseModel, stimulus:SinusAmplitudeModulationStimulus, total_time):
|
||||
_, spiketimes = model.simulate_fast(stimulus, total_time)
|
||||
_, spiketimes = model.simulate(stimulus, total_time)
|
||||
|
||||
time = np.arange(0, total_time, model.get_sampling_interval())
|
||||
fig, axes = plt.subplots(5, 1, figsize=(9, 4*2), sharex="all")
|
||||
|
206
thesis/citations.bib
Normal file
206
thesis/citations.bib
Normal file
@ -0,0 +1,206 @@
|
||||
@article{bastian1981electrolocation,
|
||||
title={Electrolocation},
|
||||
author={Bastian, Joseph},
|
||||
journal={Journal of comparative physiology},
|
||||
volume={144},
|
||||
number={4},
|
||||
pages={465--479},
|
||||
year={1981},
|
||||
publisher={Springer}
|
||||
}
|
||||
|
||||
@article{benda2003universal,
|
||||
title={A universal model for spike-frequency adaptation},
|
||||
author={Benda, Jan and Herz, Andreas VM},
|
||||
journal={Neural computation},
|
||||
volume={15},
|
||||
number={11},
|
||||
pages={2523--2564},
|
||||
year={2003},
|
||||
publisher={MIT Press}
|
||||
}
|
||||
|
||||
@article{benda2005spike,
|
||||
title={Spike-frequency adaptation separates transient communication signals from background oscillations},
|
||||
author={Benda, Jan and Longtin, Andr{\'e} and Maler, Len},
|
||||
journal={Journal of Neuroscience},
|
||||
volume={25},
|
||||
number={9},
|
||||
pages={2312--2321},
|
||||
year={2005},
|
||||
publisher={Soc Neuroscience}
|
||||
}
|
||||
|
||||
@article{benda2010linear,
|
||||
title={Linear versus nonlinear signal transmission in neuron models with adaptation currents or dynamic thresholds},
|
||||
author={Benda, Jan and Maler, Leonard and Longtin, Andr{\'e}},
|
||||
journal={Journal of Neurophysiology},
|
||||
volume={104},
|
||||
number={5},
|
||||
pages={2806--2820},
|
||||
year={2010},
|
||||
publisher={American Physiological Society Bethesda, MD}
|
||||
}
|
||||
|
||||
@article{todd1999identification,
|
||||
title={The identification of peaks in physiological signals},
|
||||
author={Todd, Bryan S and Andrews, David C},
|
||||
journal={Computers and biomedical research},
|
||||
volume={32},
|
||||
number={4},
|
||||
pages={322--335},
|
||||
year={1999},
|
||||
publisher={Elsevier}
|
||||
}
|
||||
|
||||
@article{chacron2001simple,
|
||||
title={Simple models of bursting and non-bursting P-type electroreceptors},
|
||||
author={Chacron, Maurice J and Longtin, Andr{\'e} and Maler, Leonard},
|
||||
journal={Neurocomputing},
|
||||
volume={38},
|
||||
pages={129--139},
|
||||
year={2001},
|
||||
publisher={Elsevier}
|
||||
}
|
||||
|
||||
@article{chacron2005delayed,
|
||||
title={Delayed excitatory and inhibitory feedback shape neural information transmission},
|
||||
author={Chacron, Maurice J and Longtin, Andr{\'e} and Maler, Leonard},
|
||||
journal={Physical Review E},
|
||||
volume={72},
|
||||
number={5},
|
||||
pages={051917},
|
||||
year={2005},
|
||||
publisher={APS}
|
||||
}
|
||||
|
||||
@article{chacron2005electroreceptor,
|
||||
title={Electroreceptor neuron dynamics shape information transmission},
|
||||
author={Chacron, Maurice J and Maler, Leonard and Bastian, Joseph},
|
||||
journal={Nature neuroscience},
|
||||
volume={8},
|
||||
number={5},
|
||||
pages={673--678},
|
||||
year={2005},
|
||||
publisher={Nature Publishing Group}
|
||||
}
|
||||
|
||||
@article{chacron2001negative,
|
||||
title={Negative interspike interval correlations increase the neuronal capacity for encoding time-dependent stimuli},
|
||||
author={Chacron, Maurice J and Longtin, Andre and Maler, Leonard},
|
||||
journal={Journal of Neuroscience},
|
||||
volume={21},
|
||||
number={14},
|
||||
pages={5328--5343},
|
||||
year={2001},
|
||||
publisher={Soc Neuroscience}
|
||||
}
|
||||
|
||||
@article{gussin2007limits,
|
||||
title={Limits of linear rate coding of dynamic stimuli by electroreceptor afferents},
|
||||
author={Gussin, Daniel and Benda, Jan and Maler, Leonard},
|
||||
journal={Journal of neurophysiology},
|
||||
volume={97},
|
||||
number={4},
|
||||
pages={2917--2929},
|
||||
year={2007},
|
||||
publisher={American Physiological Society}
|
||||
}
|
||||
|
||||
@phdthesis{walz2013Phd,
|
||||
author = {Henriette Walz},
|
||||
title = {Encoding of Communication Signals in Heterogeneous Populations ofElectroreceptors},
|
||||
school = {Eberhard-Karls-Universität Tübingen},
|
||||
year = {2013}
|
||||
}
|
||||
|
||||
@article{walz2014static,
|
||||
title={Static frequency tuning accounts for changes in neural synchrony evoked by transient communication signals},
|
||||
author={Walz, Henriette and Grewe, Jan and Benda, Jan},
|
||||
journal={Journal of Neurophysiology},
|
||||
volume={112},
|
||||
number={4},
|
||||
pages={752--765},
|
||||
year={2014},
|
||||
publisher={American Physiological Society Bethesda, MD}
|
||||
}
|
||||
|
||||
@article{kashimori1996model,
|
||||
title={Model of P-and T-electroreceptors of weakly electric fish},
|
||||
author={Kashimori, Yoshiki and Goto, Mituyuki and Kambara, Takeshi},
|
||||
journal={Biophysical journal},
|
||||
volume={70},
|
||||
number={6},
|
||||
pages={2513--2526},
|
||||
year={1996},
|
||||
publisher={Elsevier}
|
||||
}
|
||||
|
||||
@article{nelson1997characterization,
|
||||
title={Characterization and modeling of P-type electrosensory afferent responses to amplitude modulations in a wave-type electric fish},
|
||||
author={Nelson, ME and Xu, Z and Payne, JR},
|
||||
journal={Journal of Comparative Physiology A},
|
||||
volume={181},
|
||||
number={5},
|
||||
pages={532--544},
|
||||
year={1997},
|
||||
publisher={Springer}
|
||||
}
|
||||
|
||||
@article{ratnam2000nonrenewal,
|
||||
title={Nonrenewal statistics of electrosensory afferent spike trains: implications for the detection of weak sensory signals},
|
||||
author={Ratnam, Rama and Nelson, Mark E},
|
||||
journal={Journal of Neuroscience},
|
||||
volume={20},
|
||||
number={17},
|
||||
pages={6672--6683},
|
||||
year={2000},
|
||||
publisher={Soc Neuroscience}
|
||||
}
|
||||
|
||||
@article{xu1996logarithmic,
|
||||
title={Logarithmic time course of sensory adaptation in electrosensory afferent nerve fibers in a weakly electric fish},
|
||||
author={Xu, Zhian and Payne, Jeremy R and Nelson, Mark E},
|
||||
journal={Journal of neurophysiology},
|
||||
volume={76},
|
||||
number={3},
|
||||
pages={2020--2032},
|
||||
year={1996},
|
||||
publisher={American Physiological Society Bethesda, MD}
|
||||
}
|
||||
|
||||
@article{burkitt2006review,
|
||||
title={A review of the integrate-and-fire neuron model: I. Homogeneous synaptic input},
|
||||
author={Burkitt, Anthony N},
|
||||
journal={Biological cybernetics},
|
||||
volume={95},
|
||||
number={1},
|
||||
pages={1--19},
|
||||
year={2006},
|
||||
publisher={Springer}
|
||||
}
|
||||
|
||||
@article{wark2007sensory,
|
||||
title={Sensory adaptation},
|
||||
author={Wark, Barry and Lundstrom, Brian Nils and Fairhall, Adrienne},
|
||||
journal={Current opinion in neurobiology},
|
||||
volume={17},
|
||||
number={4},
|
||||
pages={423--429},
|
||||
year={2007},
|
||||
publisher={Elsevier}
|
||||
}
|
||||
|
||||
@article{herz2006modeling,
|
||||
title={Modeling single-neuron dynamics and computations: a balance of detail and abstraction},
|
||||
author={Herz, Andreas VM and Gollisch, Tim and Machens, Christian K and Jaeger, Dieter},
|
||||
journal={science},
|
||||
volume={314},
|
||||
number={5796},
|
||||
pages={80--85},
|
||||
year={2006},
|
||||
publisher={American Association for the Advancement of Science}
|
||||
}
|
||||
|
||||
|
||||
|
BIN
thesis/figures/adaptionExample.pdf
Normal file
BIN
thesis/figures/adaptionExample.pdf
Normal file
Binary file not shown.
BIN
thesis/figures/model_comparison.pdf
Normal file
BIN
thesis/figures/model_comparison.pdf
Normal file
Binary file not shown.
BIN
thesis/figures/stimulus_development.pdf
Normal file
BIN
thesis/figures/stimulus_development.pdf
Normal file
Binary file not shown.
BIN
thesis/sources/Chacron2000.pdf
Normal file
BIN
thesis/sources/Chacron2000.pdf
Normal file
Binary file not shown.
BIN
thesis/sources/Chacron2001_simpleModels.pdf
Normal file
BIN
thesis/sources/Chacron2001_simpleModels.pdf
Normal file
Binary file not shown.
BIN
thesis/sources/Chacron2005_InhibitoryFeedback.pdf
Normal file
BIN
thesis/sources/Chacron2005_InhibitoryFeedback.pdf
Normal file
Binary file not shown.
BIN
thesis/sources/Chacron2005_ShapeInformation.pdf
Normal file
BIN
thesis/sources/Chacron2005_ShapeInformation.pdf
Normal file
Binary file not shown.
BIN
thesis/sources/RatmannNelson2000_WwakSignalDetection.pdf
Normal file
BIN
thesis/sources/RatmannNelson2000_WwakSignalDetection.pdf
Normal file
Binary file not shown.
BIN
thesis/sources/Xu1996.pdf
Normal file
BIN
thesis/sources/Xu1996.pdf
Normal file
Binary file not shown.
8
thesis/sources/notes/notes.bbl
Normal file
8
thesis/sources/notes/notes.bbl
Normal file
@ -0,0 +1,8 @@
|
||||
\begin{thebibliography}{}
|
||||
|
||||
\bibitem[Benda and Herz, 2003]{benda2003universal}
|
||||
Benda, J. and Herz, A.~V. (2003).
|
||||
\newblock A universal model for spike-frequency adaptation.
|
||||
\newblock {\em Neural computation}, 15(11):2523--2564.
|
||||
|
||||
\end{thebibliography}
|
46
thesis/sources/notes/notes.blg
Normal file
46
thesis/sources/notes/notes.blg
Normal file
@ -0,0 +1,46 @@
|
||||
This is BibTeX, Version 0.99d (TeX Live 2015/Debian)
|
||||
Capacity: max_strings=35307, hash_size=35307, hash_prime=30011
|
||||
The top-level auxiliary file: notes.aux
|
||||
The style file: apalike.bst
|
||||
Database file #1: ../../citations.bib
|
||||
You've used 1 entry,
|
||||
1935 wiz_defined-function locations,
|
||||
480 strings with 3819 characters,
|
||||
and the built_in function-call counts, 443 in all, are:
|
||||
= -- 44
|
||||
> -- 13
|
||||
< -- 1
|
||||
+ -- 6
|
||||
- -- 4
|
||||
* -- 39
|
||||
:= -- 77
|
||||
add.period$ -- 3
|
||||
call.type$ -- 1
|
||||
change.case$ -- 7
|
||||
chr.to.int$ -- 1
|
||||
cite$ -- 1
|
||||
duplicate$ -- 14
|
||||
empty$ -- 33
|
||||
format.name$ -- 7
|
||||
if$ -- 84
|
||||
int.to.chr$ -- 1
|
||||
int.to.str$ -- 0
|
||||
missing$ -- 1
|
||||
newline$ -- 8
|
||||
num.names$ -- 3
|
||||
pop$ -- 4
|
||||
preamble$ -- 1
|
||||
purify$ -- 7
|
||||
quote$ -- 0
|
||||
skip$ -- 12
|
||||
stack$ -- 0
|
||||
substring$ -- 45
|
||||
swap$ -- 1
|
||||
text.length$ -- 0
|
||||
text.prefix$ -- 0
|
||||
top$ -- 0
|
||||
type$ -- 6
|
||||
warning$ -- 0
|
||||
while$ -- 4
|
||||
width$ -- 0
|
||||
write$ -- 15
|
Binary file not shown.
@ -26,27 +26,29 @@
|
||||
\section{To-read}
|
||||
|
||||
\begin{itemize}
|
||||
\item other models of P-units:
|
||||
\item other models/papers to P-units:
|
||||
|
||||
Bastian 1981a Electrolocation I. How the electroreceptors of Apteronotus albifrons code for moving objects and other electrical stimuli
|
||||
|
||||
Benda abd Herz 2003
|
||||
|
||||
Benda et al. 2005
|
||||
%Benda and Herz 2003
|
||||
\cite{benda2003universal}
|
||||
|
||||
Chacron et al 2001, 2005
|
||||
%Benda et al. 2005, 2006
|
||||
|
||||
Kreiman et al. 2000
|
||||
%Chacron et al 2001, 2005a
|
||||
|
||||
Ludtke and Nelson 2006
|
||||
%Kreiman et al. 2000
|
||||
|
||||
Nelson et al. 1997
|
||||
%Ludtke and Nelson 2006
|
||||
|
||||
Ratman and Nelson 2000
|
||||
%Nelson et al. 1997
|
||||
|
||||
Wessel et al 1996
|
||||
%Ratman and Nelson 2000
|
||||
|
||||
Xu et al 1996
|
||||
%Wessel et al 1996
|
||||
|
||||
%Xu et al 1996
|
||||
|
||||
|
||||
\end{itemize}
|
||||
@ -59,12 +61,16 @@ Xu et al 1996
|
||||
|
||||
\item to mention: size range, tank conditions,
|
||||
|
||||
\item continuous sinusoidal electric organ discharge EOD with near constant amplitude and frequency (Moortgat et al. 1998)
|
||||
\item continuous sinusoidal electric organ discharge EOD with near constant amplitude and frequency (Moortgat et al. 1998)
|
||||
|
||||
\item EOD carrier signal for AMs caused by nearby objects like prey or other electric fish
|
||||
\end{itemize}
|
||||
|
||||
\subsection{general P-unit notes}
|
||||
\begin{itemize}
|
||||
|
||||
\item consist of 25-40 receptor cells and a nerve fiber that makes synaptic contact to at least 16 active neurotransmitter release sites per receptor cell. (M.V.L. Bennett, C. Sandri, K. Akert, Fine Structure of the tuberous electroreceptor of the high-frequency electric "sh Sternachus albifrons (gymnotiformes), J. Neurocytol. 18 (1989) 265.)
|
||||
|
||||
\item most abundant tuberous receptor
|
||||
|
||||
\item spikes in probabilistic manner to upward phase of eod
|
||||
@ -75,6 +81,8 @@ Xu et al 1996
|
||||
|
||||
\item can predict up to 80\% of the AM using reverse correlation and coherence but no obvious decoding mechanism
|
||||
|
||||
\item linear coders of intensity, additive noise models are suitable Gussin et al. 2007
|
||||
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Coding}
|
||||
@ -84,9 +92,17 @@ Xu et al 1996
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
\item sample descriptions in: Hernriettes phd, Gussin 2007,
|
||||
\item sample descriptions in: Hernriettes phd, Gussin et al. 2007, Benda et al. 2005
|
||||
\end{itemize}
|
||||
|
||||
\section{Mat\&Met}
|
||||
|
||||
\subsection{model construction}
|
||||
\begin{itemize}
|
||||
|
||||
|
||||
\item explain why adaption current and not a dynamic threshold: chosen AC other possibilities(dyn. thresh. voltage hyperpol.) why AC is better.
|
||||
\end{itemize}
|
||||
|
||||
\section{Paper}
|
||||
|
||||
@ -109,7 +125,21 @@ then more sophisticated methods like spike-triggered stimulus averages (STA) are
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\subsection{Simple models of bursting and non-bursting P-type electroreceptors}
|
||||
Maurice J. Chacron, Andre H Longtin , Leonard Maler, 2001
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
\item simple math. model of P-units for just the baseline behavior.
|
||||
|
||||
\item uses dynamic threshold, abs refractory period, for bursty cells added a delayed depolarization current
|
||||
|
||||
\item wasn't "fitted" to data just compared, chosen and fixed(?) parameters
|
||||
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\bibliography{../../citations}
|
||||
\bibliographystyle{apalike}
|
||||
|
||||
\end{document}
|
Binary file not shown.
Binary file not shown.
BIN
thesis/to-read/Herz2006_SingleNeuronDynamicsModel.pdf
Normal file
BIN
thesis/to-read/Herz2006_SingleNeuronDynamicsModel.pdf
Normal file
Binary file not shown.
BIN
thesis/to-read/Wark2007_SensoryAdaption.pdf
Normal file
BIN
thesis/to-read/Wark2007_SensoryAdaption.pdf
Normal file
Binary file not shown.
@ -21,16 +21,16 @@ class LifacNoiseTester(unittest.TestCase):
|
||||
self.voltage_precision = 0.000001
|
||||
|
||||
def test_simulate_fast_step_sinus(self):
|
||||
v1, spikes = self.model.simulate(self.step_sinus, self.simulation_time)
|
||||
v_fast, spikes_fast = self.model.simulate_fast(self.step_sinus, self.simulation_time)
|
||||
v1, spikes = self.model.simulate_slow(self.step_sinus, self.simulation_time)
|
||||
v_fast, spikes_fast = self.model.simulate(self.step_sinus, self.simulation_time)
|
||||
test = [abs(v1[i] - v_fast[i]) > self.voltage_precision for i in range(len(v1))]
|
||||
|
||||
self.assertTrue(sum(test) == 0, msg="The voltage traces between the fast and slow simulation aren't equal diff: {:}".format(sum(test)))
|
||||
self.assertTrue(np.array_equal(spikes, spikes_fast), msg="The spike times between the fast and slow simulation aren't equal")
|
||||
|
||||
def test_simulate_fast_base_sinus(self):
|
||||
v1, spikes = self.model.simulate(self.base_sinus, self.simulation_time)
|
||||
v_fast, spikes_fast = self.model.simulate_fast(self.base_sinus, self.simulation_time)
|
||||
v1, spikes = self.model.simulate_slow(self.base_sinus, self.simulation_time)
|
||||
v_fast, spikes_fast = self.model.simulate(self.base_sinus, self.simulation_time)
|
||||
|
||||
test = [abs(v1[i] - v_fast[i]) > self.voltage_precision for i in range(len(v1))]
|
||||
|
||||
@ -38,8 +38,8 @@ class LifacNoiseTester(unittest.TestCase):
|
||||
self.assertTrue(np.array_equal(spikes, spikes_fast), msg="The spike times between the fast and slow simulation aren't equal")
|
||||
|
||||
def test_simulate_fast_no_stimulus(self):
|
||||
v1, spikes = self.model.simulate(self.none_stimulus, self.simulation_time)
|
||||
v_fast, spikes_fast = self.model.simulate_fast(self.none_stimulus, self.simulation_time)
|
||||
v1, spikes = self.model.simulate_slow(self.none_stimulus, self.simulation_time)
|
||||
v_fast, spikes_fast = self.model.simulate(self.none_stimulus, self.simulation_time)
|
||||
|
||||
test = [abs(v1[i] - v_fast[i]) > self.voltage_precision for i in range(len(v1))]
|
||||
|
||||
@ -54,7 +54,7 @@ class LifacNoiseTester(unittest.TestCase):
|
||||
for offset in v_offsets:
|
||||
test_model.set_variable("v_offset", offset)
|
||||
|
||||
_, spikes = test_model.simulate_fast(stimulus, 5)
|
||||
_, spikes = test_model.simulate(stimulus, 5)
|
||||
goal_freq = hF.mean_freq_of_spiketimes_after_time_x(spikes, 1)
|
||||
|
||||
if goal_freq <= threshold:
|
||||
|
Loading…
Reference in New Issue
Block a user