Input Variables into Templates
Input Variables into Templates
I've currently got a template for collateral axons that makes repeated collaterals. However, I'd like to be able to vary these collaterals based on the fiber diameter designated in my main file. Is it possible for templates to take in input variables? Thanks.
Re: Input Variables into Templates
Figured it out:
Code: Select all
// Build collaterals
objectvar collat[nocol]
for i=0,nocol-1 {
collat[i]=new collateral(5)
}
Code: Select all
begintemplate collateral
print "loading collateral.hoc"
public collsec
create collsec[1]
proc init(){
fiberD = $1
print "fiberD=",fiberD
}
endtemplate collateral
Re: Input Variables into Templates
However, I notice that there is a significant reduction in computational speed when using input arguments rather than hard-coding values in. Any insight into this?
Re: Input Variables into Templates
There is obviously more to your cell building strategy than the fragments you presented since all the collaterals are independent cells unless colat.collsec[0] gets connected to some parent.
My preference generally, is to keep all the sections of a cell in a single cell object. The exception is spines which might usefully be associated with a synapse wrapper object.
In your case, a Cell template can declare
create collateral[0]
and the in the proc init() redeclare with the statement
create collateral[$1]
Anyway, I would not expect a noticable reduction in setup time (or any reduction at all in simulation time) due to the object wrapping differences. If you send me your code which compares
input args vs hard coded values I would be interested in diagnosing the reason for the poor perforamace of the former. Send to michael dot hines at yale dot edu.
My preference generally, is to keep all the sections of a cell in a single cell object. The exception is spines which might usefully be associated with a synapse wrapper object.
In your case, a Cell template can declare
create collateral[0]
and the in the proc init() redeclare with the statement
create collateral[$1]
Anyway, I would not expect a noticable reduction in setup time (or any reduction at all in simulation time) due to the object wrapping differences. If you send me your code which compares
input args vs hard coded values I would be interested in diagnosing the reason for the poor perforamace of the former. Send to michael dot hines at yale dot edu.