Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of SpikeSourceArrays with pyNN.nest and min_delay='auto' #536

Open
philipsgithub opened this issue Nov 4, 2017 · 0 comments
Open
Milestone

Comments

@philipsgithub
Copy link

philipsgithub commented Nov 4, 2017

Hello,

my setup: PYNN 0.9.1, NEST 2.12.0.

The following example code shows how the use of min_delay='auto' together with the creation of SpikeSourceArray-Populations can cause wrong simulation results.

I assume after a debugging session that the reason is the following:

  1. sim.setup() is called with the default settings: min_delay='auto', in nest this causes min_delay=max_delay=sim_step
  2. When creating a SpikeSourceArray-Population the actual min_delay is used to adjust the spike_times-Sequence (substract min_delay) for the later use with parrot neurons.
  3. When connecting the population to another population (Projection) the synapse delay will be used to set the new value of min_delay. The min_delay is considered as set now. (Caution: It might be reduced if other connections have lower synapse delays!!)
  4. When sim.run() is called the parrot neurons belonging to the SpikeSourceArrays are connected to the source neurons of the SpikeSourceArrays with a synapse delay that equals the actual min_delay at this exact moment. That min_delay is not the same that was taken into account when creating the source-neurons of the SpikeSourceArray-Population. So the sum of both delays (source->parrot->***) will not be as desired by the user.
import pyNN.nest as sim

sim.setup(timestep=0.2, spike_precision="on_grid")

p_in = sim.Population(1, sim.SpikeSourceArray(spike_times=[3.]))
p_out= sim.Population(1, sim.IF_curr_exp())

con = sim.AllToAllConnector()
syn1 = sim.StaticSynapse(delay=2., weight=7.)
syn2 = sim.StaticSynapse(delay=1., weight=7.)

print("MinDelay before Projection:   ", sim.get_min_delay())
prj = sim.Projection(p_in, p_out, con, syn1)
print("MinDelay after Projection 1:  ", sim.get_min_delay())

p_in2 = sim.Population(1, sim.SpikeSourceArray(spike_times=[3.]))
prj2 = sim.Projection(p_in2, p_out, con, syn2)
print("MinDelay after Projection 2:  ", sim.get_min_delay())

p_in.record('spikes')
p_in2.record('spikes')

# Note: In run() the SourceNeurons of the SpikeSourceArray
# are connected to the ParrotNeurons of the SpikeSourceArray
# using the current min_delay as a synapse delay.
sim.run(20)

data_in = p_in.get_data()
data_in2 = p_in2.get_data()

print("In-Spikes at (should be 3.):  ", data_in.segments[0].spiketrains[0].as_array().tolist())
print("In2-Spikes at (should be 3.): ", data_in2.segments[0].spiketrains[0].as_array().tolist())
print("MinDelay: ", sim.get_min_delay())
print("MaxDelay: ", sim.get_max_delay())

Produces following output:

('MinDelay before Projection:   ', 0.2)
('MinDelay after Projection 1:  ', 2.0)
('MinDelay after Projection 2:  ', 1.0)
('In-Spikes at (should be 3.):  ', [3.8000000000000003])
('In2-Spikes at (should be 3.): ', [2.0])
('MinDelay: ', 1.0)
('MaxDelay: ', 2.0)

Relevant settings:
-Timestep is 0.2ms
-SpikeTime of the SpikeSourceArrays is 3ms
-Delay of StaticSynapse is 2ms and 1ms

@apdavison apdavison added this to the 0.9.3 milestone Jan 4, 2018
@apdavison apdavison modified the milestones: 0.9.3, 0.9.4 Dec 3, 2018
@apdavison apdavison modified the milestones: 0.9.4, 0.9.5 Mar 14, 2019
@apdavison apdavison modified the milestones: 0.9.5, 0.9.6 Jan 8, 2020
@apdavison apdavison modified the milestones: 0.9.6, 0.10.0 Dec 22, 2020
@apdavison apdavison modified the milestones: 0.10.0, 0.10.1 Mar 21, 2022
@apdavison apdavison modified the milestones: 0.10.1, 0.10.2 Oct 13, 2022
@apdavison apdavison modified the milestones: 0.10.2, 0.11.0 Feb 5, 2023
@apdavison apdavison modified the milestones: 0.11.0, 0.13.0 Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants