# Description of problem

I have an Izhikevich neuron which produces a voltage-based output with a number of spikes during a 600-ms time.
I want to fed my SSN based on LIF neurons using this output.
how can I do it ?

If I give it to my network as an input current : I , I don’t take any spikes in my network neurons while I will take activity with only a pulse input as "I " for an interval of 2 second ( 0-2 second : 1 and 2-4 second : 2 and
4-6 second 1 )

1. If I want to convert my output of Izhikevich neuron to a poison-distributed spike train, then give it to my network as I, is it possible using Brian ? and how ?

Hi Rihana,
When you say a “Poisson-distributed spike train,” would a homogenous-rate Poisson work?
If so, this should be pretty straghtforward:

• measure the overall rate of your source neuron (the izhikevich neuron)
• create a PoissonGroup and set its rate to that of the izhikevich neuron
• connect the PoissonGroup to your LIF neuron with a Synapse

This approach will give you a different Poisson spike train every time your run your simulation, but all the input trains will be generated with the target rate.

I’m not sure I understood the part of your question which discusses pulse inputs and 2-second intervals, so let me know if the approach above works, or whether there’s something I’ve misunderstood.
Thanks,

First, thank you very much for your time.
In fact, my scenario is to give several consecutive sinusoidal signals to my network as current input with 100 ms interval. First of all , I should convert them to spike trains, so I used an Izhikevich neuron.
Now my problem is that how to use Brian class or functions to do this ? How can I use Brian classes such as PoissonGroup or another ones to produce spike train from my primary signal to apply for the network as input current?

Definitely, in this condition, I have not homogeneous rate for my inputs.

Rihana

I think the answer to this and your other question is to specify the time-varying rate for your PoissonGroup as a TimedArray,

``````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

Thank you very much Adam

Actually, I’m not sure this is what I meant.
because it just changes the input signal to an quantized one with negative values not based on spike times.

Suppose, I have a spike train containing for example [12, 16, 20.2, 26, 50.5] second.
I want to give it to my network in the form of 0, 1 depending on when spike time occurs.I can’t give negative value as external input.

How can I do it ?

*** Of course, I have 100 different spike trains which the mentioned is one of them.

• my another question is that it means for dt_drive=1 ms ?

To clarify my meaning, I give an example.
I have a non-priodic signal. I want to give it to my network. As far as I know I can do it in 2 different forms :

1. As external current (I)
2. over a single neuron connected to my network
Is it true?

Now my question is how to do it using these 2 forms ?
If I connect a PoissonGroup via my signal, it will be considered a single neuron in Brian or external input ?
And so I should set " I " in the neuron model equation to “0” or remove it ?

If you simply want to “replay” the exact spike times from one simulation as though it were an input neuron in a new simulation (maybe “option 2” in your most recent message) you can do that with `SpikeGeneratorGroup` and you can specify whether that input acts as though from a single neuron, or multiple:

``````from brain2 import *
import numpy as np

G_output = NeuronGroup(N_output, eqs)

# set up replay input group
input_spike_times_A = [12, 16, 20.2, 26, 50.5]*second
input_spike_times_B = [10, 20, 30]*second
N_input = 2

def spike_times_to_index_array(times, idx):
return np.ones(size(times), dtype=int) * idx

# this concatenation is only necessary if you want to have multiple pre-synaptic neurons replay their spikes in parallel
all_input_spike_times = np.concatenate((input_spike_times_A, input_spike_times_B))

input_neuron_indices = np.concatenate(
(spike_times_to_index_array(input_spike_times_A, 0),
spike_times_to_index_array(input_spike_times_B, 1) ) )

G_replay = SpikeGeneratorGroup(N_input, input_neuron_indices, all_input_spike_times)

# set up output group
N_output = 10
eqs = '''
dv/dt = (I-v)/tau : 1
I : 1
tau : second
'''

#connect
S = Synapses(G_replay, G_output, 'w:1', on_pre='v_post += w')
S.connect() # connect all-to-all
S.w = 1.0 #set synaptic weight
``````
(here's the same code as above, but without the extra complication of multiple neurons being replayed, click to expand)
``````from brain2 import *
import numpy as np

G_output = NeuronGroup(N_output, eqs)

# set up replay input group
input_spike_times = [12, 16, 20.2, 26, 50.5]*second
N_input = 1

def spike_times_to_index_array(times, idx):
return np.ones(size(times), dtype=int) * idx

input_neuron_indices = spike_times_to_index_array(input_spike_times, 0)

G_replay = SpikeGeneratorGroup(1, input_neuron_indices, input_spike_times)

# set up output group
N_output = 10
eqs = '''
dv/dt = (I-v)/tau : 1
I : 1
tau : second
'''

#connect
S = Synapses(G_replay, G_output, 'w:1', on_pre='v_post += w')
S.connect() # connect all-to-all
S.w = 1.0 #set synaptic weight
``````

note that a big difference from using a `PoissonGroup` is that a `PoissonGroup` will generate new random spikes every time you call the script, while this `SpikeGeneratorGroup` will deliver spikes at exactly the times you specify.

The documentation also gives an example of `set_spikes` which can update the spike times for a generator group within a run in case that’s something you need

1 Like