How to convert a sequence of spike train containing spike times to a poisson-distributed spike train

I think the answer to this and your other question is to specify the time-varying rate for your PoissonGroup as a TimedArray,
https://brian2.readthedocs.io/en/stable/reference/brian2.input.poissongroup.PoissonGroup.html

dt_drive = 100*ms
time_vec = np.arange(0*ms, duration, dt_drive)
sine_freq = 2*np.pi # modulation frequency of sinusoidal input
sine_amp = 5*Hz
example_sinusoid = sine_amp*(np.sin( time_vec * sine_freq) +1)
time_var_rate = TimedArray(example_sinusoid, dt=dt_drive)

poisson_drive = PoissonGroup(num_drive, rates=time_var_rate)
# ... connect poisson_drive to the rest of network

be sure to check the documentation for is_locally_constant to decide whether you want values to be interpolated or updated in a step-like way

1 Like