def SimSpikingStimulus(stim1, stim2, time=1000, t_sim=None): ''' Times must be sorted. ex: times = [0, 1, 2] ; scale = [1,0] *poisson*: integer, output is a poisson process with mean data/poisson, scaled by *poisson*. ''' n = stim1.shape[1] SL = pyST.SpikeList(id_list=range(n+n-2)) times = range(0, len(stim1)*time, time) for i in range(n): if np.any(stim1[:, i] > 0): SL[i] = pyST.STCreate.inh_poisson_generator(stim1[:, i], times, t_stop=t_sim) for i in range(n-2): if np.any(stim2[:, i] > 0): SL[n+i] = pyST.STCreate.inh_poisson_generator(stim2[:, i-n+2], times, t_stop=t_sim) plus_times1 = np.array([100]*32)+np.arange(0,2*time*32,2*time) plus_times2 = np.array([2*time]*32)+np.arange(0,2*time*32,2*time) plus_times = np.concatenate([plus_times1,plus_times2]) minus_times1 = np.array([time]*32)+np.arange(0,2*time*32,2*time) minus_times2 = np.array([time+100]*32)+np.arange(0,2*time*32,2*time) minus_times = np.concatenate([minus_times1,minus_times2]) SL[0] = pyST.SpikeTrain(np.sort(plus_times)) SL[1] = pyST.SpikeTrain(np.sort(minus_times)) return SL
def SimSpikingStimulus(t_sim=None): SL = pyST.SpikeList(id_list=[0, 1, 2, 3]) spk_train0 = [60, 110] spk_train1 = [10, 75, 140] spk_train2 = [15, 80, 135] spk_train3 = [20, 130] SL[0] = pyST.SpikeTrain(spk_train0, t_start=1) SL[1] = pyST.SpikeTrain(spk_train1, t_start=1) SL[2] = pyST.SpikeTrain(spk_train2, t_start=1) SL[3] = pyST.SpikeTrain(spk_train3, t_start=1) return SL