improve ram usage in fitting and fix in sam
This commit is contained in:
parent
7f0c89b65f
commit
189293ff0e
@ -274,8 +274,9 @@ def test_effect_of_refractory_period():
|
|||||||
ref_periods = [0.0006, 0.001, 0.0015]
|
ref_periods = [0.0006, 0.001, 0.0015]
|
||||||
counter = 0
|
counter = 0
|
||||||
core_count = mp.cpu_count()
|
core_count = mp.cpu_count()
|
||||||
pool = mp.Pool(core_count - 1)
|
|
||||||
for cell in icelldata_of_dir("./data/"):
|
for cell in icelldata_of_dir("./data/"):
|
||||||
|
pool = mp.Pool(core_count - 1)
|
||||||
counter += 1
|
counter += 1
|
||||||
if counter < 10:
|
if counter < 10:
|
||||||
continue
|
continue
|
||||||
@ -293,6 +294,7 @@ def test_effect_of_refractory_period():
|
|||||||
fit_all_cells_parallel_sync([cell], all_start_parameters, pool, results_base_folder)
|
fit_all_cells_parallel_sync([cell], all_start_parameters, pool, results_base_folder)
|
||||||
|
|
||||||
del cell
|
del cell
|
||||||
|
del pool
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -9,45 +9,48 @@ from CellData import CellData
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
# 2012-12-13_ao fit and eod frequency:
|
# 2012-12-13_ao fit and eod frequency:
|
||||||
parameters = {'mem_tau': 0.0133705462739553, 'tau_a': 0.06682759542588587, 'input_scaling': 60.766243690761144,
|
parameters = {'step_size': 5e-05, 'mem_tau': 0.009946816831208656, 'v_base': 0, 'v_zero': 0, 'threshold': 1,
|
||||||
'v_base': 0, 'step_size': 5e-05, 'dend_tau': 0.0008667253013050408, 'v_zero': 0, 'v_offset': -6.25,
|
'v_offset': -9.375, 'input_scaling': 85.90592189374783, 'delta_a': 0.11098554500597714,
|
||||||
'noise_strength': 0.03337309379328535, 'a_zero': 2, 'threshold': 1, 'delta_a': 0.0726267312975076}
|
'tau_a': 0.04533432159583689, 'a_zero': 2, 'noise_strength': 0.02947375332925044,
|
||||||
|
'dend_tau': 0.001154822221492827, 'refractory_period': 0.0006}
|
||||||
eod_freq = 658
|
eod_freq = 658
|
||||||
cell_data = CellData("./data/2012-12-13-ao-invivo-1/")
|
cell_data = CellData("./data/2012-12-13-ao-invivo-1/")
|
||||||
model = LifacNoiseModel(parameters)
|
model = LifacNoiseModel(parameters)
|
||||||
mean_duration = np.mean(cell_data.get_sam_durations())
|
mean_duration = np.mean(cell_data.get_sam_durations())
|
||||||
contrasts = cell_data.get_sam_contrasts()
|
contrasts = cell_data.get_sam_contrasts()
|
||||||
spiketimes = cell_data.get_sam_spiketimes()
|
spiketimes = cell_data.get_sam_spiketimes()
|
||||||
for i, m_freq in enumerate(cell_data.get_sam_delta_frequencies()):
|
delta_freqs = np.unique(cell_data.get_sam_delta_frequencies())
|
||||||
|
for i, m_freq in enumerate(delta_freqs):
|
||||||
|
|
||||||
stimulus = SAM(eod_freq, contrasts[i], m_freq)
|
stimulus = SAM(eod_freq, contrasts[i]/100, m_freq)
|
||||||
prob_desnity_function_model = generate_pdf(model, stimulus, sim_length=mean_duration)
|
v1, spikes_model = model.simulate_fast(stimulus, mean_duration)
|
||||||
for spikes in spiketimes[i]:
|
prob_density_function_model = spiketimes_calculate_pdf(spikes_model, model.get_sampling_interval())
|
||||||
prob_density_cell = spiketimes_calculate_pdf(spikes, cell_data.get_sampling_interval())
|
for spikes_cell in spiketimes[i]:
|
||||||
|
prob_density_cell = spiketimes_calculate_pdf(spikes_cell, cell_data.get_sampling_interval())
|
||||||
|
|
||||||
|
plt.plot(prob_density_function_model)
|
||||||
plt.plot(prob_density_cell)
|
plt.plot(prob_density_cell)
|
||||||
plt.plot(prob_desnity_function_model)
|
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
# __init__(carrier_frequency, contrast, modulation_frequency, start_time=0, duration=np.inf, amplitude=1)
|
# # __init__(carrier_frequency, contrast, modulation_frequency, start_time=0, duration=np.inf, amplitude=1)
|
||||||
mod_freqs = np.arange(-60, eod_freq*4 + 61, 10)
|
# mod_freqs = np.arange(-60, eod_freq*4 + 61, 10)
|
||||||
sigma_of_pdfs = []
|
# sigma_of_pdfs = []
|
||||||
for m_freq in mod_freqs:
|
# for m_freq in mod_freqs:
|
||||||
print(m_freq, "max: {:.2f}".format(mod_freqs[-1]))
|
# print(m_freq, "max: {:.2f}".format(mod_freqs[-1]))
|
||||||
stimulus = SAM(eod_freq, 0.2, m_freq)
|
# stimulus = SAM(eod_freq, 0.2, m_freq)
|
||||||
|
#
|
||||||
prob_density_function = generate_pdf(model, stimulus)
|
# prob_density_function = generate_pdf(model, stimulus)
|
||||||
buffer = 0.25
|
# buffer = 0.25
|
||||||
buffer_idx = int(buffer / model.get_parameters()["step_size"])
|
# buffer_idx = int(buffer / model.get_parameters()["step_size"])
|
||||||
|
#
|
||||||
sigma_of_pdfs.append(np.std(prob_density_function[buffer_idx:-buffer_idx]))
|
# sigma_of_pdfs.append(np.std(prob_density_function[buffer_idx:-buffer_idx]))
|
||||||
|
#
|
||||||
normed_mod_freqs = (mod_freqs + eod_freq) / eod_freq
|
# normed_mod_freqs = (mod_freqs + eod_freq) / eod_freq
|
||||||
plt.plot(normed_mod_freqs, sigma_of_pdfs)
|
# plt.plot(normed_mod_freqs, sigma_of_pdfs)
|
||||||
plt.savefig("./figures/sam/test.png")
|
# plt.savefig("./figures/sam/test.png")
|
||||||
plt.close()
|
# plt.close()
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user