Error inserting model into soma

Moderator: wwlytton

Post Reply
vgoudar
Posts: 19
Joined: Fri Dec 03, 2010 3:41 am

Error inserting model into soma

Post by vgoudar »

Hello,

Im having some trouble inserting a custom model (that Ive tested and it works) into the soma, and Id appreciate some help. Here it the definition of my cell template. The big change has been that Im now dynamically determining the type of synapse I want used (see synapses() definition). After Ive made this change, I get a run time error stating that there is a syntax error at "insert IAF":
nrniv: syntax error
in cellsIAF.template.oc near line 33
insert IAF // includes
^



Code: Select all

begintemplate CellSoma          // create a new template object...
public soma, synlist
public init, connect2target
external nSyn
external nEx

objref synlist

create soma
proc init() {
    synlist = new List() // Instantiate list of netcons

    soma {
        Ra = 35         // Axial Resistivity
        nseg = 1
        diam = 10       // diameter in um: L and diam are used to calculate area
        L = 10          // length in um: relevant because g_pas is in mho/cm2 
        cm = 2          // capacitance
        
        insert IAF              // includes     
    }
    synapses($o1)
}

obfunc connect2target() { localobj nc //$o1 target point process, optional $o2 returned NetCon
  soma nc = new NetCon(&spike_IAF(0.5), $o1)
  nc.threshold = 0.5
  if (numarg() == 2) { $o2 = nc } // for backward compatibility
  print "connecting cell"
  return nc
}

proc synapses() { local j
    for(j=0;j<nSyn;j=j+1) {
        if ($o1.x[j] < nEx) {
           synlist.append(new Syn())
        } else {
           synlist.append(new IFixSyn())
        }
        soma synlist.object(j).loc(0.5)
        synlist.object(j).precell = $o1.x[j]
        synlist.object(j).postcell = -1
    }
}
endtemplate CellSoma
Can you please point out what Ive done wrong? Also, I instantiate the cell template as follows:

Code: Select all

 dummy = rand.discunif(0,(nEx+nInh)-1)
 objref preCellInds = new Vector(nSyn)
 for(j=0;j<nSyn;j=j+1) {
      preCellInds.x[j] = rand.repick()
 }
objectvar Cell = new CellSoma(preCellInds)
Thanks in advance!

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

Re: Error inserting model into soma

Post by ted »

The syntax error message has nothing to do with how the cells are instantiated.
It could mean that hoc doesn't know what "IAF" is. This will happen if any of following is true:
--the NMODL code that defines IAF has not been compiled. The fix is obvious.
--the object code produced by compiling that NMODL code that defines IAF was not loaded by NEURON. The easiest fix is to make sure that the mod file(s) needed by your hoc code are in the same directory as your hoc code, then compile the mod files.
--IAF is defined by a Channel Builder, and the Channel Builder's ses file was not loaded before hoc encountered the
insert IAF
statement.

Or it could mean that IAF is the name of a class that defines a point process. Attempting to attach a point process to a section with "insert" will produce a syntax error message.

On the topic of point processes, I don't know why so much user-written code is showing up that spawns new point processes with two steps like this
soma foo = new Whatever()
foo.loc(0.5)
when it's easier to do everything in a single step like this
soma foo = new Whatever(0.5)

So--why bother with

Code: Select all

for(j=0;j<nSyn;j=j+1) {
        . . .
           synlist.append(new Syn())
        } else {
           synlist.append(new IFixSyn())
        }
        soma synlist.object(j).loc(0.5)
when you could simply

Code: Select all

soma for(j=0;j<nSyn;j=j+1) {
        . . .
           synlist.append(new Syn(0.5))
        } else {
           synlist.append(new IFixSyn(0.5))
        }
?

I won't ask whether Syn or IFixSyn is a linear synaptic mechanism that can deal properly with multiple input streams, like ExpSyn or Exp2Syn, thereby allowing a single instance to be the target of multiple NetCons. That would reduce memory usage (each object instance consumes tens of kB) and shorten run times (each object instance whose dynamics are defined by one or more ODEs or state transitions adds DEs to the model's system equations that must be numerically integrated).
Post Reply