NeuralEnsemble / PyNN

A Python package for simulator-independent specification of neuronal network models.
Other
277 stars 126 forks source link

Updating "rate" parameter of SpikeSourcePoisson does not actually affect the rate of the object #143

Closed apdavison closed 11 years ago

apdavison commented 11 years ago

I run a simulation with SpikeSourcePoisson's "rate" parameter equal to r1, and then (without doing setup() again) change it to r2 and run the simulation some more. The output of this second run clearly does not match the output when I start with rate = r2. Code that should replicate this is below; just run it with the two different settings for the "rates" variable near the top of the file. It should be clear that the output when rate=100 after having run already at rate=0 contains no spikes while the output when rate=100 for the first run contains very many spikes.

----------code follows ---------------------- {{{

!python

from pyNN.neuron import *

--------- Set main parameters

mode = 'FF' # options: 'FF', 'FB', 'both', 'FI'

for "feedforward", "feedback", "both", or "generate freq-input curves"

nPyr = 200 nInh = 50 nExtIn = 200 nInhToPyr = 25

ndend = 1

rates of input - try these two different settings

rates = [0, 100]

rates = [100, 0]

wExtToPyr = 0.25 #0.00003 wExtToInh = wExtToPyr wInhToPyr = -1 #-0.1*nInh wPyrToInh = wExtToPyr/2

!! can make these weights follow a random distribution

probExtToPyr = 0.75 probExtToInh = 0.75

if mode == 'FF': wPyrToInh = 0 elif mode == 'FB': wExtToInh = 0 elif mode == 'FI': wPyrToInh = 0 wInhToPyr = 0

-------- biophysical properties of the cells

ra = 200 raInh = 123 rm = 40000 c_m = 0.75 c_mInh = 2.0 v_init = -70

Ek = -90 Ena = 60 Epas = -70 threshold = -50

gna_dend = 30 gk = 100

tauSyn = 0.1 tauRef = 2.0 # refractory period (ms)

cell_paramsE = {'tau_m' : rm*c_m/1000, # in ms 'tau_syn_E' : tauSyn, 'tau_syn_I' : tauSyn, 'tau_refrac' : tauRef, 'v_rest' : v_init, 'v_thresh' : threshold, 'cm' : c_m } # (nF)

cell_paramsI = {'tau_m' : rm*c_mInh/1000, # in ms 'tau_syn_E' : tauSyn, 'tau_syn_I' : tauSyn, 'tau_refrac' : tauRef, 'v_rest' : v_init, 'v_thresh' : threshold, 'cm' : c_mInh } # (nF)

-------- build network

setup()

neuron populations

print "creating neuron populations..." E1pop = Population(nPyr, IF_curr_alpha, cellparams=cell_paramsE, label="Pyramidal 1") #!! need to replace this cell type E2pop = Population(nPyr, IF_curr_alpha, cellparams=cell_paramsE, label="Pyramidal 2") Ipop = Population(nInh, IF_curr_alpha, cellparams=cell_paramsI, label="Inhibitory") Extpop1 = Population(nExtIn, SpikeSourcePoisson, {'rate': rates[0]}, label="External inputs to Pyr1") Extpop2 = Population(nExtIn, SpikeSourcePoisson, {'rate': rates[0]}, label="External inputs to Pyr2")

connections between populations

print "connecting populations..." print " Ext to Pyr" prjExtToPyr1 = Projection(Extpop1, E1pop, FixedProbabilityConnector(weights=wExtToPyr, p_connect=probExtToPyr)) prjExtToPyr2 = Projection(Extpop2, E2pop, FixedProbabilityConnector(weights=wExtToPyr, p_connect=probExtToPyr)) print " Ext to Inh" prjExt1ToInh = Projection(Extpop1, Ipop, FixedProbabilityConnector(weights=wExtToInh, p_connect=probExtToInh)) prjExt2ToInh = Projection(Extpop2, Ipop, FixedProbabilityConnector(weights=wExtToInh, p_connect=probExtToInh)) print " Pyr to Inh" prjPyr1ToInh = Projection(E1pop, Ipop, FixedNumberPostConnector(weights=wPyrToInh, n=nInh/5)) prjPyr2ToInh = Projection(E2pop, Ipop, FixedNumberPostConnector(weights=wPyrToInh, n=nInh/5)) print " Inh to Pyr" prjInhToPyr1 = Projection(Ipop, E1pop, FixedNumberPostConnector(weights=wInhToPyr, n=nPyr/5), target='inhibitory') prjInhToPyr2 = Projection(Ipop, E2pop, FixedNumberPostConnector(weights=wInhToPyr, n=nPyr/5), target='inhibitory')

randomize initial states

print "randomizing states..." vinit_distr = RandomDistribution('uniform', [v_init-5, v_init+5]) E1pop.randomInit(vinit_distr) E2pop.randomInit(vinit_distr) Ipop.randomInit(vinit_distr)

print "running..."

iterate over all input rates

for x in range(2):

print "  run " + str(x)
# change input rates
Extpop1.set("rate", rates[x])
Extpop2.set("rate", rates[x])

# this DOES claim that the rates have been correctly set, but the output files don't show it
print Extpop1.describe()   
print Extpop2.describe()  

# record spike times
E1pop.record()
E2pop.record()
Ipop.record()
# and voltages
E1pop.record_v(record_from=2) # record membrane potential of only two cells
E2pop.record_v(record_from=2)
Ipop.record_v(record_from=2)    

run(200)

# write to file
print "  writing output to file..."
E1pop.printSpikes('testE1spikes' + str(x) + '.dat')
E2pop.printSpikes('testE2spikes' + str(x) + '.dat')
Ipop.printSpikes('testIspikes' + str(x) + '.dat')

E1pop.print_v('testE1Vm' + str(x) + '.dat')
E2pop.print_v('testE2Vm' + str(x) + '.dat')
Ipop.print_v('testIVm' + str(x) + '.dat')

end()

print "done." }}}


Imported from Trac ticket:152

Opened: 2010-01-13 20:02:07 Last modified: 2010-02-03 15:18:51 Component: neuron Priority: minor Owner: apdavison Reporter: nick.steinmetz@gmail.com

apdavison commented 11 years ago

apdavison wrote on 2010-02-03 15:18:51:

fixed in r704