fix saving of other_freq, change naming structure

This commit is contained in:
Jan Grewe 2020-09-16 16:55:21 +02:00
parent 2212e435c1
commit 7d2d133d19

View File

@ -39,7 +39,6 @@ def save(filename, name, stimulus_settings, model_settings, self_signal, other_s
b.metadata = mdata
# save stimulus
stim_da = b.create_data_array("complete_stimulus", "nix.timeseries.sampled", dtype=nix.DataType.Float,
data=complete_stimulus)
stim_da.label = "voltage"
@ -61,7 +60,7 @@ def save(filename, name, stimulus_settings, model_settings, self_signal, other_s
other_freq_da = None
if other_freq is not None:
other_freq_da = b.create_data_array("other frequency", "nix.timeseries.sampled", dtype=nix.DataType.Float,
data=self_freq)
data=other_freq)
self_freq_da.label = "frequency"
self_freq_da.label = "Hz"
dim = other_freq_da.append_sampled_dimension(model_settings["deltat"])
@ -172,7 +171,7 @@ def simulate_responses(stimulus_params, model_params, repeats=10, deltaf=20):
cell_params["v_zero"] = v_0
no_other_spikes.append(simulate(np.hstack((pre_stim, self_signal)), **cell_params))
if condition == "self":
name = "contrast_%.3f_condition_no_other_deltaf_%i" %(contrast, deltaf)
name = "contrast_%.3f_condition_no-other_deltaf_%i" %(contrast, deltaf)
save(filename, name, params, cell_params, self_signal, None, self_freq, None, self_signal, no_other_spikes)
save(filename, block_name, params, cell_params, self_signal, other_signal, self_freq, other_freq, full_signal, spikes)
print("\n")
@ -181,14 +180,14 @@ def simulate_responses(stimulus_params, model_params, repeats=10, deltaf=20):
def main():
models = load_models("models.csv")
deltafs = [-200, -100, -20, 20, 100, 200] # Hz, difference frequency between self and other
stimulus_params = { "eodfs": {"self": 0.0, "other": 0.0},
stimulus_params = { "eodfs": {"self": 0.0, "other": 0.0}, # eod frequency in Hz, to be overwritten
"contrasts": [20, 10, 5, 2.5, 1.25, 0.625, 0.3125],
"chirp_size": 100, # Hz, frequency excursion
"chirp_duration": 0.015, # s, chirp duration
"chirp_amplitude_dip": 0.05, # %, amplitude drop during chirp
"chirp_frequency": 5, # Hz, how often does the fish chirp
"duration": 5., # s, total duration of simulation
"dt": 1, # s, stepsize of the simulation
"dt": 1, # s, stepsize of the simulation, to be overwritten
}
for cell_id in range(len(models)):
@ -210,5 +209,7 @@ def main():
stimulus_params["chirp_times"] = chirp_times
simulate_responses(stimulus_params, model_params, repeats=25, deltaf=deltaf)
exit()
if __name__ == "__main__":
main()