Page 1 of 1

Cannot access range variable from external mechanism

Posted: Thu May 08, 2014 7:02 pm
by sgratiy
I have problems with accessing a range variable defined in the custom mechanism when using python as a interpreter. However, when working directly in neuron I have no problem:

I create a cell object L2_BC[0] from class where I insert a custom mechanism xtra.mod (see at the end of file for the code)
which basically creates x,y,z range variables for coordinates of segment centers. I also have a member function which I call from

Code: Select all

proc init()
to calculate those segment centers. Unfortunately, when running the code with python as interpreters I get this error:

Code: Select all

>>> h.L2_BC[0].dend[17].x_xtra(0.3)
Traceback (most recent call last):
  File "stdin", line 1, in <module>
TypeError: 'float' object is not callable
when using neuron only however, my code works:

Code: Select all

oc>L2_BC[0].dend[17].x_xtra(0.3)
        69.102923
Could you please help me resolve the issue, so that I could run the code with python as an interpreter

below is my xtra.mod:

Code: Select all

NEURON {
	SUFFIX xtra
	RANGE x, y, z
}

PARAMETER {
	x = 0 (1) : spatial coords
	y = 0 (1)
	z = 0 (1)
}

ASSIGNED {
	v (millivolts)
	area (micron2)
}

INITIAL {

}


Re: Cannot access range variable from external mechanism

Posted: Thu May 08, 2014 8:20 pm
by ted
If L2_BC[0].dend[17].x_xtra(0.3) is the hoc name of the variable you want, I bet the Python name is something like
L2_BC[0].dend[17](0.3).xtra.x
or
h.L2_BC[0].dend[17](0.3).xtra.x

Re: Cannot access range variable from external mechanism

Posted: Fri May 09, 2014 8:55 pm
by sgratiy
thanks