Passing an object parameter to execute() in a function
Posted: Fri Aug 03, 2018 5:20 pm
I'm am trying to build an object function that adds a cluster of synapses to a dendrite of a neuron that is defined in a class, and returns the synapse objects in a List. I would like to pass the synapse (MOD object) as a parameter in the function. To attempt this I am passing the name of the MOD object as a string parameter and then using sprint() and execute() to add the synapse to the appropiate dendrite segment. This is the code I'm using :
I would then call the function like this, where AMPA_S is defined in a MOD file:
As it stands I get the following error:
If I understand corretly, excute can't take the passed object parameters. Is there anyway around this problem? Any help would be greatly appreciated.
Code: Select all
//$o1: Synpase parameter list
//$o2: Cell object
//$s3: Mod object
obfunc Add_Synapses(){\
local i, j, jump_distance, position, next_position\
localobj synapse_list, command, cell
command = new String()
synapse_list = new List()
for i=0,11{
jump_distance = 0.5/$o1.o[1].x[i] //distance to adjacent synapse as percentage
position = $o1.o[2].x[i]/$o1.o[1].x[i] //Synapse starting insertion location as percentage
for j=0,$o1.o[3].x[i]-1{
next_position = position-(-1)^j*jump_distance*j //next location (first time j=0)
position = next_position //save last location
sprint(command.s, "$o2.dendrite[$o1.o[0].x[i]] synapse_list.append(new %s(next_position))", $s3)
execute(command.s)
}
}
return synapse_list
}//Add_Synapses
Code: Select all
objref reference_AMPA
reference_AMPA = Add_Synapses(reference_parameters, cell, "AMPA_S")
Code: Select all
/Applications/NEURON-7.5/nrn/x86_64/bin/nrniv: $o used outside definition
in Build_Cell.hoc near line 1
{$o2.dendrite[$o1.o[0].x[i]] mod_object.append(new AMPA_S(next_position))}
^
execute("$o2.dendri...")
Add_Synapses(List[12], ..., "AMPA_S")
initcode failed with 1 left
/Applications/NEURON-7.5/nrn/x86_64/bin/nrniv: execute error: $o2.dendrite[$o1.o[0].x[i]] mod_object.append(new AMPA_S(next_position))
in Build_Cell.hoc near line 32