if SAMPLES[drawn_samples[trial_num]][0] == 1: spike_times = np.array(static_spikes_arr[neuron_idx]) spike_times += time_elapsed neuron_poisson_spikes = np.hstack((neuron_poisson_spikes, spike_times)) else: if SAMPLES[drawn_samples[trial_num]][1] == 1: spike_times = np.array(static_spikes_arr[neuron_idx]) spike_times += time_elapsed neuron_poisson_spikes = np.hstack((neuron_poisson_spikes, spike_times)) time_elapsed += STIMULUS_TIMESTEPS wait_plus_iti = WAIT_TIMESTEPS + itis[trial_num] spike_times = create_poisson_spikes(wait_plus_iti, WAIT_FREQ, SPIKE_DT, TIME_FACTOR) spike_times += time_elapsed neuron_poisson_spikes = np.hstack((neuron_poisson_spikes, spike_times)) time_elapsed += wait_plus_iti poisson_spikes.append(neuron_poisson_spikes) spike_counts = [len(n) for n in poisson_spikes] end_spike = np.cumsum(spike_counts) start_spike = np.empty_like(end_spike) start_spike[0] = 0 start_spike[1:] = end_spike[0:-1] spikeTimes = np.hstack(poisson_spikes).astype(float) # """
""" First we create the poisson spike trains for all the input neurons. Below, `poisson_spikes` is a list of 100 lists: each list is the spike times for each neuron. We create `start_spike` and `end_spike`, which we need to initialize the input layer. `start_spike` and `end_spike` give the indices at which each neuron's spike times starts and ends e.g. start_spike[0] is the starting index and end_spike[0] is the ending index of the 0th neuron's spike times. """ poisson_spikes = [] freq = 8 spike_dt = 0.001 N_INPUT = 100 interval = int(PRESENT_TIMESTEPS) for p in range(N_INPUT): neuron_spike_train = create_poisson_spikes(interval, freq, spike_dt, 1.0) poisson_spikes.append(neuron_spike_train) spike_counts = [len(n) for n in poisson_spikes] end_spike = np.cumsum(spike_counts) start_spike = np.empty_like(end_spike) start_spike[0] = 0 start_spike[1:] = end_spike[0:-1] spikeTimes = np.hstack(poisson_spikes).astype(float) """ The target spike train is a series of 5 equidistant spikes, which we create below. """
SUPERSPIKE_PARAMS["update_t"] = PRESENT_TIMESTEPS TIME_FACTOR = 0.1 """ First we create the poisson spike trains for all the input neurons. Below, `poisson_spikes` is a list of 100 lists: each list is the spike times for each neuron. We create `start_spike` and `end_spike`, which we need to initialize the input layer. `start_spike` and `end_spike` give the indices at which each neuron's spike times starts and ends e.g. start_spike[0] is the starting index and end_spike[0] is the ending index of the 0th neuron's spike times. """ poisson_spikes = [] freq = 8 spike_dt = 0.001 N_INPUT = 100 for p in range(N_INPUT): neuron_spike_train = create_poisson_spikes(interval, freq, spike_dt, TIME_FACTOR) poisson_spikes.append(neuron_spike_train) spike_counts = [len(n) for n in poisson_spikes] end_spike = np.cumsum(spike_counts) start_spike = np.empty_like(end_spike) start_spike[0] = 0 start_spike[1:] = end_spike[0:-1] spikeTimes = np.hstack(poisson_spikes).astype(float) """ The target spike train is a series of 5 equidistant spikes, which we create below. """ base_target_spike_times = np.linspace(0, 500, num=7)[1:6].astype(int)
target_spike_counts = [len(n) for n in target_poisson_spikes] target_end_spike = np.cumsum(target_spike_counts) target_start_spike = np.empty_like(target_end_spike) target_start_spike[0] = 0 target_start_spike[1:] = target_end_spike[0:-1] target_spikeTimes = np.hstack(target_poisson_spikes).astype(float) """ We also create the spike trains we need for the repeating Poisson input noise. """ poisson_spikes = [] for neuron_idx in range(N_INPUT): spike_times = create_poisson_spikes(TIMESTEPS, INPUT_FREQ, spike_dt, TIME_FACTOR) time_elapsed = 0 neuron_poisson_spikes = np.empty(0) for trial_idx in range(TRIALS): neuron_poisson_spikes = np.hstack((neuron_poisson_spikes, spike_times)) spike_times += TIMESTEPS poisson_spikes.append(neuron_poisson_spikes) spike_counts = [len(n) for n in poisson_spikes] end_spike = np.cumsum(spike_counts) start_spike = np.empty_like(end_spike) start_spike[0] = 0 start_spike[1:] = end_spike[0:-1] spikeTimes = np.hstack(poisson_spikes).astype(float) """