Page 1 of 1

Netcon source

Posted: Sun Feb 20, 2011 7:22 pm
by shyam_u2
Hi i am shyam. I am a PhD student working on network modelling of Cerebellum. I have a data file which has the spike times.. I want to give this pattern of input. I am planning to read the contents into a vector and pass it as a source of Netcon. Is it possible to pass a vector as a source of netcon ?

Thanks,
shyam

Re: Netcon source

Posted: Mon Feb 21, 2011 9:37 am
by ted
See
Driving a synapse with recorded or precomputed spike events
in the Hot tips area of the NEURON Forum.
viewforum.php?f=28

Re: Netcon source

Posted: Mon Feb 21, 2011 7:16 pm
by shyam_u2
Dear Ted,

Thanks for your reply. My code is designed in such a way that NetCon object doesnt have a target. The target is just a null object. The netcon object is passed to a cell which send spikes to all other processors in the machine. Please see the code below. In that case how do i proceed ?

Code: Select all

netcon = new NetCon(alocalMF,nil)
	pc.set_gid2node(i+$2+$3,pc.id)  // associate gid i with this host
	netcon.record(VecList.object(i))
	pc.cell(i+$2+$3,netcon)
I am currently using Netstim so alocalMF is an object of netstim. pc is the parallel context object. I am running it in a parallel environment.

Re: Netcon source

Posted: Tue Feb 22, 2011 10:16 am
by ted
VecStim is a class of artificial spiking cell. In other words, it is a "spike source," just like a NetStim is a "spike source." Any application that uses a NetStim as a spike source can use a VecStim instead, regardless of whether or not the NetCons have "real" targets.

A comment about implementation: if possible, it would be most efficient keep the amount of data that must be communicated between hosts to a minimum. If the event streams generated by your NetStims &/or VecStims must be delivered to many targets, can your implementation ensure that each NetStim (or VecStim) is on the same host as its targets?

Re: Netcon source

Posted: Wed Feb 23, 2011 12:22 am
by shyam_u2
Hi Ted,

Thanks for your reply. In the current implementation, all the Netstim spikes are generated in one host(say host 0). The target neurons are generated equally in all hosts. The suggestion is wise and definitely further modelling has to be done take this point into account.
Regarding Vecstim, I am getting an error stating that the Netcon source should be a point process. I have pasted it below.

Code: Select all

if arg 1 is an object it must be a point process or NULLObject
 in test.hoc near line 23
 }
  ^
        NetCon(..., NULLobject)
initcode failed with 1 left
Can you please help me on this ?

Re: Netcon source

Posted: Wed Feb 23, 2011 9:15 am
by ted
There is indeed an error. The question is, does it lie in the source code for the VecStim class, or does it lie elsewhere?

Hypothesis: The error occurs because the source code for the VecStim class defines neither a point process or NULLObject.
Test: Read the VecStim class's source code.
Observation: The first line in the NEURON block is

Code: Select all

        ARTIFICIAL_CELL VecStim
Interpretation: Artificial spiking cells were originally implemented as point processes, and had to be attached to a "host" section. After a couple of years this awkwardness was eliminated by adding the ARTIFICIAL_CELL keyword to NMODL. An ARTIFICIAL_CELL does not need a host section, can serve as a spike source, and does not generate an error message when used as arg 1 in a "new NetCon()" statement.

Here's an example with an instance of the VecStim class:

Code: Select all

oc>objref xs
oc>xs = new VecStim()
oc>objref nil
oc>objref nc
oc>nc = new NetCon(xs, nil)
oc>run()
oc>
Observation: No error messages during model setup, and no run time errors, which demonstrates that an instance of the VecStim class can be used as a spike source.

So it appears that hoc's error message should be revised to " . . . it must be a point process, artificial spiking cell, or NULLobject"

That said, the error message emitted by hoc is "real" in that there is an error.

Did you copy vecevent.mod to the directory where your model's hoc and mod files are located, then run mknrndll (or nrnivmodl if you're using Linux)? If you aren't sure, run nrngui in that directory and examine the first few lines that NEURON prints out. You should see something like this

Code: Select all

[ted@loki vecevent]$ nrngui
NEURON -- VERSION . . .
 . . .
loading membrane mechanisms from . . .
Additional mechanisms from files . . . vecevent.mod . . .

Re: Netcon source

Posted: Wed Feb 23, 2011 7:33 pm
by shyam_u2
Dear Ted,

Well i tried that way previously. here is my code.

Code: Select all

load_file("nrngui.hoc")
load_file("vecevent.ses")
objref vec,net,nil,fih,pc,vec1,vs,r
objectvar f
pc = new ParallelContext()
vec = new Vector()
vec1 = new Vector()
r = new Vector()
vs = new VecStim()
f = new File()
f.ropen("data.dat")
//for i = 1,42 {
//d = f.scanvar()
vec.scanf(f)
for (i = 0;i<19950;i=i+50) {
vec1.copy(vec,i,i+50)
vec1.printf()
vec1.indgen
vs.play(vec1)

net = new NetCon(vs,nil)
net.record(r)
}
//print d 
//vec.size()
r.printf()

f.close()
Though it doesnt generate any error, when i try to print r(the vector in which i record spike times using netcon) it justs prints 0. If I am right, it has to print the spike times. May i know why is it so ?

Re: Netcon source

Posted: Wed Feb 23, 2011 9:40 pm
by ted
Where is the run() statement? Without a run, nothing will be recorded to any Vector.

I wish I had a nickel for every time somebody said "I have this code
for i=0,N-1 { . . . } where N is an arbitrarily large number, but it isn't working right."
The first step in debugging such code is almost always "get it working for an N of 1."
The second step is "now get it working for an N of 2."
The third step is "now get it working for an N of 3."
After that it usally works for an arbitrarily large N (subject to limitations of time and storage).