Many poisson inputs to one cell

Moderator: wwlytton

Post Reply
jordanfox
Posts: 1
Joined: Tue Mar 01, 2016 11:11 pm

Many poisson inputs to one cell

Post by jordanfox » Thu Mar 03, 2016 2:53 am

Hello! I have been using NEURON for a few months now and these forums have been a huge help. I am stuck on something new and I have not seen any other threads that address this.

I have created a simple cell model (axon, soma, and small dendrite tree) and would like to create some inputs on the tree that obey Poisson statistics. In my current code, I create a NetStim source and connect it to the cell at some place with NetConn. This works just fine for one input, but I would like to do many inputs at the same time, at many different places in the tree. Right now my code places two identically constructed inputs, but the spike trains do not overlap in time. My code is attached:

Code: Select all


proc celldef() { //builds cell
  topol()
  subsets()
  geom()
  biophys()
  geom_nseg()
}

create soma, axon, dend[6] // create cell pieces

proc topol() { local i //connect cell
  connect axon(0), soma(0)
  for i = 0, 1 connect dend[i](0), soma(1)
  for i = 2, 3 connect dend[i](0), dend(1)
  for i = 4, 5 connect dend[i](0), dend[1](1)
  basic_shape()
}

proc shape3d_1() { // make cell in 3d
  soma {pt3dclear()
	pt3dadd(0, 0, 0, 1)
	pt3dadd(15, 0, 0, 1)
  }
  axon {pt3dclear()
	pt3dadd(0, 0, 0, 1)
	pt3dadd(-179, 0, 0, 1)
  }
  dend {pt3dclear()
	pt3dadd(15, 0, 0, 1)
	pt3dadd(60, -134, 0, 1)
  }
  dend[1] {pt3dclear()
	pt3dadd(15, 0, 0, 1)
	pt3dadd(45, 15, 0, 1)
  }
  dend[2] {pt3dclear()
	pt3dadd(60, -134, 0, 1)
	pt3dadd(90, -134, 0, 1)
  }
  dend[3] {pt3dclear()
	pt3dadd(60, -134, 0, 1)
	pt3dadd(60, -15, 0, 1)
  }
  dend[4] {pt3dclear()
	pt3dadd(45, 15, 0, 1)
	pt3dadd(75, 15, 0, 1)
  }
  dend[5] {pt3dclear()
	pt3dadd(45, 15, 0, 1)
	pt3dadd(45, 135, 0, 1)
  }
}

proc basic_shape() { // does shape3d_1
  shape3d_1()
}

objref all // need for subsets

proc subsets() { local i // make subsets
  objref all
  all = new SectionList()
    soma all.append()
    axon all.append()
    for i=0, 5 dend[i] all.append()

}

proc geom() {
  forsec all {  }
  dend {  }
}

proc geom_nseg() {
   forsec all { nseg = 11  }
}

proc biophys() {  // biophys parameters
  soma {
	 
    insert pas
      g_pas = 0.001
      e_pas = -70
  }
  axon {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
  dend[0] {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
  dend[1] {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
  dend[2] {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
  dend[3] {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
  dend[4] {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
  dend[5] {
     
	insert pas
      g_pas = 0.001
      e_pas = -70
  }
}

proc setdendnseg(){ local i //make all dends have # of segments
	dendnseg=$1		
	for i=0,5{
		dend[i].nseg=$1
		}
	ncomp=dendnseg*6  // 6 dendrites
}

celldef() // builds cell
setdendnseg(11) 

//simulation time
tstop = 200
tlength=tstop/dt

objectvar source1,source2, syn1, syn2, conn1,conn2 // initialize object variables

objref rect, vsoma, ts1, ts2 	//initialize values to record
rect = new Vector()
vsoma = new Vector()
ts1 = new Vector()
ts2 = new Vector()

nspikes = 10 //number of spikes
spikeint = 20  //spike interval
spikeonset = 10 //spike onset


// place stim1

proc places1(){
	s1dend=$1	//s1 dendrite 
	s1comp=$2		//s1 compartment
	s1coord=s1comp/dendnseg 	//s1 coordinate
	source1 = new NetStim(0.5)	//create source 1
	source1.interval = spikeint	
	source1.number = nspikes
	source1.start = spikeonset
	source1.noise = 1			//set to 1 for Poisson mode
	dend[s1dend] syn1 = new Exp2Syn(s1coord)	//exp2 style input
	syn1.tau1 = .1 //rise time
	syn1.tau2 = .2 //decay time
	syn1.e = 0 //rev potential
	thresh1 = 10
	delay1 = 0.1
	weight1 = 0.1
	conn1 = new NetCon(source1, syn1, thresh1, delay1, weight1)
}	

//place stim2

proc places2(){
	s2dend=$1	//s2 dendrite 
	s2comp=$2		//s2 compartment
	s2coord=s2comp/dendnseg 	//s2 coordinate
	source2 = new NetStim(0.5)
	source2.interval = spikeint
	source2.number = nspikes
	source2.start = spikeonset
	source2.noise = 1
	dend[s2dend] syn2 = new Exp2Syn(s2coord)
	syn2.tau1 = .1 //rise time
	syn2.tau2 = .2 //decay time
	syn2.e = 0 //rev potential
	thresh2 = 10
	delay2 = 0.1
	weight2 = 0.1
	conn2 = new NetCon(source2, syn2, thresh2, delay2, weight2)
}	

places1(5,5)
places2(5,5)

proc getrect(){ 
	rect.record(&t)
	init()
	run()
	rect.play_remove()
}

proc getv(){
	source1.number = nspikes
	source2.number = nspikes
	vsoma.record(&soma.v(0.5))
	conn1.record(ts1)
	conn2.record(ts2)
	init()
	run()
	vsoma.play_remove()
	ts1.play_remove()
	ts2.play_remove()
}

getrect()
getv()

//output data
	objref savdata
	strdef filename
proc exportdata(){ local p
	
	sprint(filename,"simplecell_pas_pois_%g_%1.2g_%g_%1.2g.csv",s1dend,s1comp,s2dend,s2comp)
	savdata = new File(filename)
	savdata.wopen(filename)
	savdata.printf("s1dend, s1comp, s2dend, s2comp\n")
	savdata.printf("%g,%g,%g,%g\n",s1dend, s1comp, s2dend, s2comp)
	savdata.printf("t , vsoma , t_s1 , t_s2\n")
	ts1 = ts1.resize(rect.size())
	ts2 = ts2.resize(rect.size())
	for p=0,(rect.size()-1) {
		savdata.printf("%g , %g , %g , %g\n", rect.x(p), vsoma.x(p), ts1.x(p), ts2.x(p))
	}
}

exportdata()


Observe the output file: t_s2 looks fine, but t_s1 is supposed to have 10 values (times that the input from stim1 occurred). I only ever get 2 values for t_s1, and it looks like maybe the spike trains never overlap despite having set them starting at t=spikeonset=10. Thus, my question is 2-part:
1) How do I get both artificial cells to run spike trains at the same time? or Why is my second connection seemingly overriding the first?
2) Suppose I want 1000 artificial cells to input in this fashion. How do I set this up without hardcoding for 1000 NetStims and 1000 NetConns?

Thank you in advance!
-jordan

ted
Site Admin
Posts: 5628
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Many poisson inputs to one cell

Post by ted » Thu Mar 03, 2016 7:20 pm

A spike source can be presynaptic to more than one target. Suggest you read
M.L. and Carnevale, N.T. Translating network models to parallel hardware in NEURON. J. Neurosci. Methods 169:425-455, 2008. Preprint is available from http://www.neuron.yale.edu/neuron/publications.
Focus on the serial implementatioms. Notice the programs' structure. See how magic numbers are avoided, and how the few instances of such numbers, e.g. number of cells, occur near the top of the program, where they're easy to spot. Especially notice the use of Lists to manage collections of objests. Also notice that repetitive tasks are handled by by abstracting the essence of the task and expressing it in a "for" loop, not by cutting pasting and slightly modifying what was pasted; the latter approach produces code that is long, hard to read, hard to debug, and hard to maintain.

With regard to your questions about multiple NetStims
1. By default all NetStoms pick from the same stream of pseudorandom numbers. That's why they produce different event times.
2. That's also why it's unlikely for any two NetCons to produce the same number of events over the same time interval.

It also means that changing the number of NetCons will change the event streams produced by all NetCons. This is usually a bad idea. This can be avoided by associating each NetStim with its own pseudorandom generator, as described in Randomness in NEURON models--see link on http://www.neuron.yale.edu/neuron/docs

Post Reply